From b778f459c0b7fae04dc559bc263d6eb6885b1274 Mon Sep 17 00:00:00 2001 From: JaphetSamuel <40962898+JaphetSamuel@users.noreply.github.com> Date: Wed, 3 Nov 2021 00:35:50 +0000 Subject: [PATCH 01/15] remove importlib for deprecate --- billing/gateway.py | 1 - 1 file changed, 1 deletion(-) diff --git a/billing/gateway.py b/billing/gateway.py index 3f6c6e65..218a8149 100644 --- a/billing/gateway.py +++ b/billing/gateway.py @@ -1,4 +1,3 @@ -from django.utils.importlib import import_module from django.conf import settings from .utils.credit_card import CardNotSupported From 529649b0cdd39bd705f83734c57b5aaf386e4209 Mon Sep 17 00:00:00 2001 From: JaphetSamuel <40962898+JaphetSamuel@users.noreply.github.com> Date: Wed, 3 Nov 2021 00:36:42 +0000 Subject: [PATCH 02/15] remove importlib for deprecate --- billing/integration.py | 1 - 1 file changed, 1 deletion(-) diff --git a/billing/integration.py b/billing/integration.py index 7b9d5d59..a9156163 100644 --- a/billing/integration.py +++ b/billing/integration.py @@ -1,4 +1,3 @@ -from django.utils.importlib import import_module from django.conf import settings from django.conf.urls import patterns From 23930d71c3fd4412a80cf69aaba9cd1fcb158c47 Mon Sep 17 00:00:00 2001 From: JaphetSamuel <40962898+JaphetSamuel@users.noreply.github.com> Date: Wed, 3 Nov 2021 00:43:00 +0000 Subject: [PATCH 03/15] patterns to urlspattern --- billing/integration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/billing/integration.py b/billing/integration.py index a9156163..3f23ffb0 100644 --- a/billing/integration.py +++ b/billing/integration.py @@ -1,5 +1,5 @@ from django.conf import settings -from django.conf.urls import patterns +from django.conf.urls import urlpatterns class IntegrationModuleNotFound(Exception): From 229d1dc1b7749b4bf9f05a21912b7e9bd6f432db Mon Sep 17 00:00:00 2001 From: JaphetSamuel <40962898+JaphetSamuel@users.noreply.github.com> Date: Wed, 3 Nov 2021 00:48:15 +0000 Subject: [PATCH 04/15] pattern resolve --- billing/integration.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/billing/integration.py b/billing/integration.py index 3f23ffb0..4127c79d 100644 --- a/billing/integration.py +++ b/billing/integration.py @@ -1,5 +1,5 @@ from django.conf import settings -from django.conf.urls import urlpatterns + class IntegrationModuleNotFound(Exception): @@ -46,7 +46,7 @@ def service_url(self): def get_urls(self): # Method must be subclassed - urlpatterns = patterns('') + urlpatterns = [] return urlpatterns @property From a25629e5c349df3de6c86503ab5b5b15838ddcd2 Mon Sep 17 00:00:00 2001 From: JaphetSamuel <40962898+JaphetSamuel@users.noreply.github.com> Date: Wed, 3 Nov 2021 00:51:20 +0000 Subject: [PATCH 05/15] Update paylane_models.py --- billing/models/paylane_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/billing/models/paylane_models.py b/billing/models/paylane_models.py index 7345bf24..990b312d 100644 --- a/billing/models/paylane_models.py +++ b/billing/models/paylane_models.py @@ -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) From 1c2799fdcf22ca5bd2ec6af93d4001a4a5e162cd Mon Sep 17 00:00:00 2001 From: JaphetSamuel <40962898+JaphetSamuel@users.noreply.github.com> Date: Wed, 3 Nov 2021 01:00:59 +0000 Subject: [PATCH 06/15] modif on_delete --- billing/models/pin_models.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/billing/models/pin_models.py b/billing/models/pin_models.py index cccb8562..4944bf08 100644 --- a/billing/models/pin_models.py +++ b/billing/models/pin_models.py @@ -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 @@ -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 @@ -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 @@ -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 From 1fa1f493172b4e25221baebc10564c6664c97062 Mon Sep 17 00:00:00 2001 From: JaphetSamuel <40962898+JaphetSamuel@users.noreply.github.com> Date: Wed, 3 Nov 2021 01:10:59 +0000 Subject: [PATCH 07/15] modif sur import_module --- billing/gateway.py | 2 +- billing/integration.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/billing/gateway.py b/billing/gateway.py index 218a8149..daad3d78 100644 --- a/billing/gateway.py +++ b/billing/gateway.py @@ -113,7 +113,7 @@ def get_gateway(gateway, *args, **kwargs): gateway_module = None for app in settings.INSTALLED_APPS: try: - gateway_module = import_module(".gateways.%s" % gateway_filename, package=app) + #gateway_module = import_module(".gateways.%s" % gateway_filename, package=app) except ImportError: pass if not gateway_module: diff --git a/billing/integration.py b/billing/integration.py index 4127c79d..c4a8be36 100644 --- a/billing/integration.py +++ b/billing/integration.py @@ -64,7 +64,7 @@ def get_integration(integration, *args, **kwargs): integration_module = None for app in settings.INSTALLED_APPS: try: - integration_module = import_module(".integrations.%s" % integration_filename, package=app) + #integration_module = import_module(".integrations.%s" % integration_filename, package=app) break except ImportError: pass From 6d6ea9f7f422d99dec90c303d5bd5a33d1eac6db Mon Sep 17 00:00:00 2001 From: JaphetSamuel <40962898+JaphetSamuel@users.noreply.github.com> Date: Wed, 3 Nov 2021 01:14:06 +0000 Subject: [PATCH 08/15] ident error --- billing/gateway.py | 4 ---- billing/integration.py | 5 ----- 2 files changed, 9 deletions(-) diff --git a/billing/gateway.py b/billing/gateway.py index daad3d78..c6fffc4c 100644 --- a/billing/gateway.py +++ b/billing/gateway.py @@ -112,10 +112,6 @@ def get_gateway(gateway, *args, **kwargs): gateway_filename = "%s_gateway" % gateway gateway_module = None for app in settings.INSTALLED_APPS: - try: - #gateway_module = import_module(".gateways.%s" % gateway_filename, package=app) - except ImportError: - pass if not gateway_module: raise GatewayModuleNotFound("Missing gateway: %s" % (gateway)) gateway_class_name = "".join(gateway_filename.title().split("_")) diff --git a/billing/integration.py b/billing/integration.py index c4a8be36..f5078d4f 100644 --- a/billing/integration.py +++ b/billing/integration.py @@ -63,11 +63,6 @@ def get_integration(integration, *args, **kwargs): integration_filename = "%s_integration" % integration integration_module = None for app in settings.INSTALLED_APPS: - try: - #integration_module = import_module(".integrations.%s" % integration_filename, package=app) - break - except ImportError: - pass if not integration_module: raise IntegrationModuleNotFound("Missing integration: %s" % (integration)) integration_class_name = "".join(integration_filename.title().split("_")) From f374166ab67179c1e3d12a60737da6f4ac4816b9 Mon Sep 17 00:00:00 2001 From: JaphetSamuel <40962898+JaphetSamuel@users.noreply.github.com> Date: Wed, 3 Nov 2021 01:17:34 +0000 Subject: [PATCH 09/15] fix abnother --- billing/gateway.py | 1 - billing/integration.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/billing/gateway.py b/billing/gateway.py index c6fffc4c..ae2f67cd 100644 --- a/billing/gateway.py +++ b/billing/gateway.py @@ -111,7 +111,6 @@ def get_gateway(gateway, *args, **kwargs): # Let's actually load it (it's not in the cache) gateway_filename = "%s_gateway" % gateway gateway_module = None - for app in settings.INSTALLED_APPS: if not gateway_module: raise GatewayModuleNotFound("Missing gateway: %s" % (gateway)) gateway_class_name = "".join(gateway_filename.title().split("_")) diff --git a/billing/integration.py b/billing/integration.py index f5078d4f..4da2d7c9 100644 --- a/billing/integration.py +++ b/billing/integration.py @@ -62,7 +62,7 @@ def get_integration(integration, *args, **kwargs): if not klass: integration_filename = "%s_integration" % integration integration_module = None - for app in settings.INSTALLED_APPS: + if not integration_module: raise IntegrationModuleNotFound("Missing integration: %s" % (integration)) integration_class_name = "".join(integration_filename.title().split("_")) From 859e880cd9cc38d570f77b10a9a386c4127c3fbd Mon Sep 17 00:00:00 2001 From: JaphetSamuel <40962898+JaphetSamuel@users.noreply.github.com> Date: Wed, 3 Nov 2021 10:21:52 +0000 Subject: [PATCH 10/15] reintegration de importlib --- billing/gateway.py | 6 ++++++ billing/integration.py | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/billing/gateway.py b/billing/gateway.py index ae2f67cd..1da558ca 100644 --- a/billing/gateway.py +++ b/billing/gateway.py @@ -1,3 +1,4 @@ +from importlib import import_module from django.conf import settings from .utils.credit_card import CardNotSupported @@ -111,6 +112,11 @@ def get_gateway(gateway, *args, **kwargs): # Let's actually load it (it's not in the cache) gateway_filename = "%s_gateway" % gateway gateway_module = None + for app in settings.INSTALLED_APPS: + try: + gateway_module = import_module(".gateways.%s" % gateway_filename, package=app) + except ImportError: + pass if not gateway_module: raise GatewayModuleNotFound("Missing gateway: %s" % (gateway)) gateway_class_name = "".join(gateway_filename.title().split("_")) diff --git a/billing/integration.py b/billing/integration.py index 4da2d7c9..404abf10 100644 --- a/billing/integration.py +++ b/billing/integration.py @@ -1,4 +1,5 @@ from django.conf import settings +from importlib import import_module @@ -62,7 +63,12 @@ def get_integration(integration, *args, **kwargs): if not klass: integration_filename = "%s_integration" % integration integration_module = None - + for app in settings.INSTALLED_APPS: + try: + integration_module = import_module(".integrations.%s" % integration_filename, package=app) + break + except ImportError: + pass if not integration_module: raise IntegrationModuleNotFound("Missing integration: %s" % (integration)) integration_class_name = "".join(integration_filename.title().split("_")) From bea3353e42103b9ae00a5a69bed0546cb8bae1d4 Mon Sep 17 00:00:00 2001 From: JaphetSamuel <40962898+JaphetSamuel@users.noreply.github.com> Date: Thu, 4 Nov 2021 16:28:15 +0000 Subject: [PATCH 11/15] fix max_length str --- billing/models/authorize_models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/billing/models/authorize_models.py b/billing/models/authorize_models.py index c3a60c4c..1636a86d 100644 --- a/billing/models/authorize_models.py +++ b/billing/models/authorize_models.py @@ -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) @@ -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] From 44b9ee6d1dd54dd55c6d9e7142718ebcefec0f88 Mon Sep 17 00:00:00 2001 From: JaphetSamuel <40962898+JaphetSamuel@users.noreply.github.com> Date: Thu, 4 Nov 2021 17:51:28 +0000 Subject: [PATCH 12/15] remove use of coffin --- billing/templatetags/jinja2_tags.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/billing/templatetags/jinja2_tags.py b/billing/templatetags/jinja2_tags.py index 1bf9bd1f..637c054f 100644 --- a/billing/templatetags/jinja2_tags.py +++ b/billing/templatetags/jinja2_tags.py @@ -1,10 +1,10 @@ -from coffin.template import Library +#from coffin.template import Library from django.template.loader import render_to_string from jinja2 import nodes from jinja2.ext import Extension -register = Library() +#register = Library() class MerchantExtension(Extension): From 596681226b6f51fd04ff53312309b381c0c5cfdd Mon Sep 17 00:00:00 2001 From: JaphetSamuel <40962898+JaphetSamuel@users.noreply.github.com> Date: Thu, 4 Nov 2021 17:57:57 +0000 Subject: [PATCH 13/15] use djangotemplate --- billing/templatetags/jinja2_tags.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/billing/templatetags/jinja2_tags.py b/billing/templatetags/jinja2_tags.py index 637c054f..46a735a8 100644 --- a/billing/templatetags/jinja2_tags.py +++ b/billing/templatetags/jinja2_tags.py @@ -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): From c40d605b3a6a63f68fd130c1af972ad08f0ec10d Mon Sep 17 00:00:00 2001 From: JaphetSamuel <40962898+JaphetSamuel@users.noreply.github.com> Date: Thu, 4 Nov 2021 18:12:44 +0000 Subject: [PATCH 14/15] fix ipAdresseField deprecation --- billing/models/world_pay_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/billing/models/world_pay_models.py b/billing/models/world_pay_models.py index 2c604b6f..cbd4b7b3 100644 --- a/billing/models/world_pay_models.py +++ b/billing/models/world_pay_models.py @@ -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] From 1b950fdfdc693138321cf41b966255393410ae0b Mon Sep 17 00:00:00 2001 From: JaphetSamuel <40962898+JaphetSamuel@users.noreply.github.com> Date: Fri, 24 Dec 2021 17:31:58 +0000 Subject: [PATCH 15/15] fix autofield warning; remove some model from admin page --- billing/admin.py | 10 +++++----- billing/apps.py | 5 +++++ 2 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 billing/apps.py diff --git a/billing/admin.py b/billing/admin.py index 35284178..bfb30db9 100644 --- a/billing/admin.py +++ b/billing/admin.py @@ -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): @@ -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) diff --git a/billing/apps.py b/billing/apps.py new file mode 100644 index 00000000..4cf7ecd9 --- /dev/null +++ b/billing/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + +class billingConfig(AppConfig): + name='billing' + default_auto_field = 'django.db.models.BigAutoField' \ No newline at end of file