Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update the code #147

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
10 changes: 5 additions & 5 deletions billing/admin.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from django.contrib import admin
import billing.models as billing_models

admin.site.register(billing_models.GCNewOrderNotification)
admin.site.register(billing_models.AuthorizeAIMResponse)
admin.site.register(billing_models.WorldPayResponse)
admin.site.register(billing_models.AmazonFPSResponse)
#admin.site.register(billing_models.GCNewOrderNotification)
#admin.site.register(billing_models.AuthorizeAIMResponse)
#admin.site.register(billing_models.WorldPayResponse)
#admin.site.register(billing_models.AmazonFPSResponse)


class PaylaneTransactionAdmin(admin.ModelAdmin):
Expand All @@ -13,4 +13,4 @@ class PaylaneTransactionAdmin(admin.ModelAdmin):
ordering = ('-transaction_date',)
search_fields = ['customer_name', 'customer_email']

admin.site.register(billing_models.PaylaneTransaction, PaylaneTransactionAdmin)
#admin.site.register(billing_models.PaylaneTransaction, PaylaneTransactionAdmin)
5 changes: 5 additions & 0 deletions billing/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig

class billingConfig(AppConfig):
name='billing'
default_auto_field = 'django.db.models.BigAutoField'
2 changes: 1 addition & 1 deletion billing/gateway.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.utils.importlib import import_module
from importlib import import_module
from django.conf import settings
from .utils.credit_card import CardNotSupported

Expand Down
6 changes: 3 additions & 3 deletions billing/integration.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.utils.importlib import import_module
from django.conf import settings
from django.conf.urls import patterns
from importlib import import_module



class IntegrationModuleNotFound(Exception):
Expand Down Expand Up @@ -47,7 +47,7 @@ def service_url(self):

def get_urls(self):
# Method must be subclassed
urlpatterns = patterns('')
urlpatterns = []
return urlpatterns

@property
Expand Down
4 changes: 2 additions & 2 deletions billing/models/authorize_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class AuthorizeAIMResponse(models.Model):
response_reason_code = models.IntegerField(blank=True)
response_reason_text = models.TextField(blank=True)
authorization_code = models.CharField(max_length=8)
address_verification_response = models.CharField(max_length='8', choices=ADDRESS_VERIFICATION_RESPONSE)
address_verification_response = models.CharField(max_length=8, choices=ADDRESS_VERIFICATION_RESPONSE)
transaction_id = models.CharField(max_length=64)
invoice_number = models.CharField(max_length=64, blank=True)
description = models.CharField(max_length=255, blank=True)
Expand Down Expand Up @@ -68,7 +68,7 @@ class AuthorizeAIMResponse(models.Model):
shipping_zip_code = models.CharField(max_length=64, blank=True)
shipping_country = models.CharField(max_length=64, blank=True)

card_code_response = models.CharField(max_length='8', choices=CARD_CODE_RESPONSES, help_text=u'Card Code Verification response')
card_code_response = models.CharField(max_length=8, choices=CARD_CODE_RESPONSES, help_text=u'Card Code Verification response')

class Meta:
app_label = __name__.split(".")[0]
Expand Down
2 changes: 1 addition & 1 deletion billing/models/paylane_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Meta:
class PaylaneAuthorization(models.Model):
sale_authorization_id = models.BigIntegerField(db_index=True)
first_authorization = models.BooleanField(default=False)
transaction = models.OneToOneField(PaylaneTransaction)
transaction = models.OneToOneField(PaylaneTransaction, on_delete=models.CASCADE)

def __unicode__(self):
return u'Authorization: %s' % (self.sale_authorization_id)
Expand Down
18 changes: 9 additions & 9 deletions billing/models/pin_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class PinCard(models.Model):
address_state = models.CharField(max_length=255)
address_country = models.CharField(max_length=255)
created_at = models.DateTimeField(auto_now_add=True)
user = models.ForeignKey(User, related_name='pin_cards', blank=True, null=True)
user = models.ForeignKey(User, related_name='pin_cards', blank=True, null=True, on_delete=models.CASCADE)

def __unicode__(self):
return 'Card %s' % self.display_number
Expand All @@ -30,10 +30,10 @@ class Meta:

class PinCustomer(models.Model):
token = models.CharField(unique=True, max_length=32)
card = models.ForeignKey("billing.PinCard", related_name='customers')
card = models.ForeignKey("billing.PinCard", related_name='customers', on_delete=models.CASCADE)
email = models.EmailField()
created_at = models.DateTimeField()
user = models.OneToOneField(User, related_name='pin_customer', blank=True, null=True)
user = models.OneToOneField(User, related_name='pin_customer', blank=True, null=True,on_delete=models.CASCADE)

def __unicode__(self):
return 'Customer %s' % self.email
Expand All @@ -44,18 +44,18 @@ class Meta:

class PinCharge(models.Model):
token = models.CharField(unique=True, max_length=32, editable=False)
card = models.ForeignKey("billing.PinCard", related_name='charges', editable=False)
customer = models.ForeignKey("billing.PinCustomer", related_name='customers', null=True, blank=True, editable=False)
card = models.ForeignKey("billing.PinCard", related_name='charges', editable=False,on_delete=models.CASCADE)
customer = models.ForeignKey("billing.PinCustomer", related_name='customers', null=True, blank=True,on_delete=models.CASCADE, editable=False)
success = models.BooleanField(default=False)
amount = models.DecimalField(max_digits=16, decimal_places=2)
currency = models.CharField(max_length=3)
description = models.CharField(max_length=255)
email = models.EmailField()
ip_address = models.IPAddressField()
ip_address = models.GenericIPAddressField()
created_at = models.DateTimeField()
status_message = models.CharField(max_length=255)
error_message = models.CharField(max_length=255, null=True, blank=True)
user = models.ForeignKey(User, related_name='pin_charges', blank=True, null=True)
user = models.ForeignKey(User, related_name='pin_charges', blank=True, null=True,on_delete=models.CASCADE)

def __unicode__(self):
return 'Charge %s' % self.email
Expand All @@ -66,14 +66,14 @@ class Meta:

class PinRefund(models.Model):
token = models.CharField(unique=True, max_length=32)
charge = models.ForeignKey("billing.PinCharge", related_name='refunds')
charge = models.ForeignKey("billing.PinCharge", related_name='refunds',on_delete=models.CASCADE)
success = models.BooleanField(default=False)
amount = models.DecimalField(max_digits=16, decimal_places=2)
currency = models.CharField(max_length=3)
created_at = models.DateTimeField()
status_message = models.CharField(max_length=255)
error_message = models.CharField(max_length=255, null=True, blank=True)
user = models.ForeignKey(User, related_name='pin_refunds', blank=True, null=True)
user = models.ForeignKey(User, related_name='pin_refunds', blank=True, null=True,on_delete=models.CASCADE)

def __unicode__(self):
return 'Refund %s' % self.charge.email
Expand Down
2 changes: 1 addition & 1 deletion billing/models/world_pay_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class WorldPayResponse(models.Model):
future_pay_id = models.CharField(max_length=64, blank=True)

card_type = models.CharField(max_length=64, blank=True)
ip_address = models.IPAddressField(blank=True, null=True)
ip_address = models.GenericIPAddressField(blank=True, null=True)

class Meta:
app_label = __name__.split(".")[0]
4 changes: 2 additions & 2 deletions billing/templatetags/jinja2_tags.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from coffin.template import Library
from django import template
from django.template.loader import render_to_string
from jinja2 import nodes
from jinja2.ext import Extension


register = Library()
register = template.Library()


class MerchantExtension(Extension):
Expand Down