Flake8 fixes
This commit is contained in:
		
							parent
							
								
									9719546bda
								
							
						
					
					
						commit
						d360e880d9
					
				
					 8 changed files with 40 additions and 31 deletions
				
			
		|  | @ -1,3 +0,0 @@ | |||
| from django.contrib import admin | ||||
| 
 | ||||
| # Register your models here. | ||||
|  | @ -3,7 +3,6 @@ from registripe import models | |||
| 
 | ||||
| from django import forms | ||||
| from django.core.urlresolvers import reverse | ||||
| from django.core.exceptions import ValidationError | ||||
| from django.db.models import F, Q | ||||
| from django.forms import widgets | ||||
| from django.utils import timezone | ||||
|  | @ -12,8 +11,6 @@ from django_countries import countries | |||
| from django_countries.fields import LazyTypedChoiceField | ||||
| from django_countries.widgets import CountrySelectWidget | ||||
| 
 | ||||
| from pinax.stripe import models as pinax_stripe_models | ||||
| 
 | ||||
| 
 | ||||
| class NoRenderWidget(forms.widgets.HiddenInput): | ||||
| 
 | ||||
|  | @ -101,7 +98,7 @@ class CreditCardForm(forms.Form): | |||
| 
 | ||||
|     stripe_token = forms.CharField( | ||||
|         max_length=255, | ||||
|         #required=True, | ||||
|         # required=True, | ||||
|         widget=NoRenderWidget(), | ||||
|     ) | ||||
| 
 | ||||
|  | @ -177,8 +174,7 @@ class StripeRefundForm(forms.Form): | |||
|             q2 = ( | ||||
|                 Q(charge__amount_refunded__isnull=False) & | ||||
|                 Q(charge__amount__gte=( | ||||
|                     F("charge__amount_refunded") + min_value) | ||||
|                 ) | ||||
|                     F("charge__amount_refunded") + min_value)) | ||||
|             ) | ||||
|             qs = qs.filter(q1 | q2) | ||||
| 
 | ||||
|  | @ -195,15 +191,22 @@ From stripe.js details: | |||
| 
 | ||||
| Card details: | ||||
| 
 | ||||
| The first argument to createToken is a JavaScript object containing credit card data entered by the user. It should contain the following required members: | ||||
| The first argument to createToken is a JavaScript object containing credit | ||||
| card data entered by the user. It should contain the following required | ||||
| members: | ||||
| 
 | ||||
| number: card number as a string without any separators (e.g., "4242424242424242") | ||||
| exp_month: two digit number representing the card's expiration month (e.g., 12) | ||||
| exp_year: two or four digit number representing the card's expiration year (e.g., 2017) | ||||
| number: card number as a string without any separators | ||||
| (e.g., "4242424242424242") | ||||
| exp_month: two digit number representing the card's expiration month | ||||
| (e.g., 12) | ||||
| exp_year: two or four digit number representing the card's expiration year | ||||
| (e.g., 2017) | ||||
| (The expiration date can also be passed as a single string.) | ||||
| 
 | ||||
| cvc: optional, but we highly recommend you provide it to help prevent fraud. This is the card's security code, as a string (e.g., "123"). | ||||
| The following fields are entirely optional and cannot result in a token creation failure: | ||||
| cvc: optional, but we highly recommend you provide it to help prevent fraud. | ||||
| This is the card's security code, as a string (e.g., "123"). | ||||
| The following fields are entirely optional and cannot result in a token | ||||
| creation failure: | ||||
| 
 | ||||
| name: cardholder name | ||||
| address_line1: billing address line 1 | ||||
|  |  | |||
|  | @ -19,8 +19,15 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             name='StripePayment', | ||||
|             fields=[ | ||||
|                 ('paymentbase_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='registrasion.PaymentBase')), | ||||
|                 ('charge', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pinax_stripe.Charge')), | ||||
|                 ('paymentbase_ptr', models.OneToOneField( | ||||
|                     auto_created=True, | ||||
|                     on_delete=django.db.models.deletion.CASCADE, | ||||
|                     parent_link=True, primary_key=True, serialize=False, | ||||
|                     to='registrasion.PaymentBase')), | ||||
|                 ('charge', | ||||
|                  models.ForeignKey( | ||||
|                     on_delete=django.db.models.deletion.CASCADE, | ||||
|                     to='pinax_stripe.Charge')), | ||||
|             ], | ||||
|             bases=('registrasion.paymentbase',), | ||||
|         ), | ||||
|  |  | |||
|  | @ -18,8 +18,15 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             name='StripeCreditNoteRefund', | ||||
|             fields=[ | ||||
|                 ('creditnoterefund_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='registrasion.CreditNoteRefund')), | ||||
|                 ('charge', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pinax_stripe.Charge')), | ||||
|                 ('creditnoterefund_ptr', models.OneToOneField( | ||||
|                     auto_created=True, | ||||
|                     on_delete=django.db.models.deletion.CASCADE, | ||||
|                     parent_link=True, primary_key=True, serialize=False, | ||||
|                     to='registrasion.CreditNoteRefund')), | ||||
|                 ('charge', | ||||
|                  models.ForeignKey( | ||||
|                      on_delete=django.db.models.deletion.CASCADE, | ||||
|                      to='pinax_stripe.Charge')), | ||||
|             ], | ||||
|             bases=('registrasion.creditnoterefund',), | ||||
|         ), | ||||
|  |  | |||
|  | @ -9,6 +9,7 @@ class StripePayment(commerce.PaymentBase): | |||
| 
 | ||||
|     charge = models.ForeignKey(Charge) | ||||
| 
 | ||||
| 
 | ||||
| class StripeCreditNoteRefund(commerce.CreditNoteRefund): | ||||
| 
 | ||||
|     charge = models.ForeignKey(Charge) | ||||
|  |  | |||
|  | @ -1,3 +0,0 @@ | |||
| from django.test import TestCase | ||||
| 
 | ||||
| # Create your tests here. | ||||
|  | @ -2,14 +2,13 @@ from django.conf.urls import url | |||
| 
 | ||||
| from registripe import views | ||||
| 
 | ||||
| from pinax.stripe.views import ( | ||||
|     Webhook, | ||||
| ) | ||||
| from pinax.stripe.views import Webhook | ||||
| 
 | ||||
| 
 | ||||
| urlpatterns = [ | ||||
|     url(r"^card/([0-9]*)/$", views.card, name="registripe_card"), | ||||
|     url(r"^card/([0-9]*)/([0-9A-Za-z]*)/$", views.card, name="registripe_card"), | ||||
|     url(r"^card/([0-9]*)/([0-9A-Za-z]*)/$", views.card, | ||||
|         name="registripe_card"), | ||||
|     url(r"^pubkey/$", views.pubkey_script, name="registripe_pubkey"), | ||||
|     url(r"^refund/([0-9]*)/$", views.refund, name="registripe_refund"), | ||||
|     url(r"^webhook/$", Webhook.as_view(), name="pinax_stripe_webhook"), | ||||
|  |  | |||
|  | @ -12,10 +12,8 @@ from django.shortcuts import redirect, render | |||
| 
 | ||||
| from registrasion.controllers.credit_note import CreditNoteController | ||||
| from registrasion.controllers.invoice import InvoiceController | ||||
| from registrasion.models import commerce | ||||
| 
 | ||||
| from pinax.stripe import actions | ||||
| from pinax.stripe.actions import refunds as pinax_stripe_actions_refunds | ||||
| 
 | ||||
| from stripe.error import StripeError | ||||
| 
 | ||||
|  | @ -67,7 +65,7 @@ def card(request, invoice_id, access_code=None): | |||
| 
 | ||||
|     if request.POST and form.is_valid(): | ||||
|         try: | ||||
|             inv.validate_allowed_to_pay()  # Verify that we're allowed to do this. | ||||
|             inv.validate_allowed_to_pay() | ||||
|             process_card(request, form, inv) | ||||
|             return to_invoice | ||||
|         except StripeError as e: | ||||
|  | @ -107,7 +105,7 @@ def process_card(request, form, inv): | |||
| 
 | ||||
|     card = actions.sources.create_card(customer, token) | ||||
| 
 | ||||
|     description="Payment for %s invoice #%s" % ( | ||||
|     description = "Payment for %s invoice #%s" % ( | ||||
|         conference.title, inv.invoice.id | ||||
|     ) | ||||
| 
 | ||||
|  | @ -187,7 +185,7 @@ def process_refund(cn, form): | |||
|             "the credit note." | ||||
|         ) | ||||
| 
 | ||||
|     refund = actions.refunds.create(charge, to_refund) | ||||
|     refund = actions.refunds.create(charge, to_refund) # noqa | ||||
| 
 | ||||
|     models.StripeCreditNoteRefund.objects.create( | ||||
|         parent=cn.credit_note, | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Sachi King
						Sachi King