Skip to content

Commit

Permalink
Merge pull request #168 from scottp-dpaw/parkstay_pay
Browse files Browse the repository at this point in the history
Current works on Parkstay + Django 1.10 upgrade
  • Loading branch information
dbca-asi committed Jan 10, 2017
2 parents f5c10b6 + 9fac0c7 commit ef8447c
Show file tree
Hide file tree
Showing 157 changed files with 13,840 additions and 572 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,9 @@ media/
*.dump
*.db
*.sqlite3

#parkstay import ignores
import/
importo.py
build.js
build.css
4 changes: 2 additions & 2 deletions ledger/accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from reversion import revisions
from django_countries.fields import CountryField

from social.apps.django_app.default.models import UserSocialAuth
from social_django.models import UserSocialAuth

from datetime import datetime, date

Expand Down Expand Up @@ -639,4 +639,4 @@ def __str__(self):

class Meta:
managed = False
db_table = 'accounts_emailuser_report_v'
db_table = 'accounts_emailuser_report_v'
2 changes: 1 addition & 1 deletion ledger/accounts/pipeline.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#from django.contrib.auth.models import User
from social.exceptions import InvalidEmail
from social_core.exceptions import InvalidEmail
from .models import EmailUser, EmailIdentity
from django.contrib.auth import logout

Expand Down
2 changes: 1 addition & 1 deletion ledger/accounts/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test import Client
from social.apps.django_app.default.models import UserSocialAuth
from social_django.models import UserSocialAuth

from ledger.accounts.models import EmailUser

Expand Down
6 changes: 3 additions & 3 deletions ledger/accounts/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.conf.urls import patterns, url, include
from django.conf.urls import url, include
from django.contrib.auth import views as auth_views

from ledger.accounts import views
Expand All @@ -8,12 +8,12 @@
url(r'api/report/duplicate_identity$', UserReportView.as_view(),name='ledger-user-report'),
]

urlpatterns = patterns('accounts',
urlpatterns = [
url(r'^$', views.home, name='home'),
url(r'^done/$', views.done, name='done'),
url(r'^validation-sent/$', views.validation_sent, name='validation_sent'),
url(r'^token-login/(?P<token>[^/]+)/(?P<email>[^/]+)/$', views.token_login, name='token_login'),
url(r'^logout/', views.logout, name='logout'),
url(r'^firsttime/', views.first_time, name='first_time'),
url(r'accounts/', include(api_patterns)),
)
]
21 changes: 21 additions & 0 deletions ledger/basket/migrations/0010_auto_20170106_1600.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-06 08:00
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('basket', '0009_auto_20160905_1208'),
]

operations = [
migrations.AlterField(
model_name='line',
name='product',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='basket_lines', to='catalogue.Product', verbose_name='Product'),
),
]
12 changes: 11 additions & 1 deletion ledger/basket/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
from django.db import models
from oscar.apps.basket.abstract_models import AbstractBasket as CoreAbstractBasket
from oscar.apps.basket.abstract_models import AbstractBasket as CoreAbstractBasket, AbstractLine as CoreAbstractLine

class Basket(CoreAbstractBasket):
system = models.CharField(max_length=4)

class Line(CoreAbstractLine):
product = models.ForeignKey('catalogue.Product', related_name='basket_lines', on_delete=models.SET_NULL, verbose_name='Product', blank=True, null=True)

def __str__(self):
return _(
u"Basket #%(basket_id)d, Product #%(product_id)d, quantity"
u" %(quantity)d") % {'basket_id': self.basket.pk,
'product_id': self.product.pk if self.product else None,
'quantity': self.quantity}

from oscar.apps.basket.models import * # noqa
20 changes: 20 additions & 0 deletions ledger/catalogue/migrations/0013_auto_20170106_1600.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-06 08:00
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('catalogue', '0012_auto_20160905_1208'),
]

operations = [
migrations.AlterField(
model_name='product',
name='oracle_code',
field=models.CharField(blank=True, max_length=50, null=True, verbose_name='Oracle Code'),
),
]
1 change: 1 addition & 0 deletions ledger/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
class FirstTimeNagScreenMiddleware(object):
def process_request(self, request):
if request.user.is_authenticated() and request.method == 'GET':
#print('DEBUG: {}: {} == {}, {} == {}, {} == {}'.format(request.user, request.user.first_name, (not request.user.first_name), request.user.last_name, (not request.user.last_name), request.user.dob, (not request.user.dob) ))
if (not request.user.first_name) or (not request.user.last_name) or (not request.user.dob):
path_ft = reverse('accounts:first_time')
path_logout = reverse('accounts:logout')
Expand Down
20 changes: 20 additions & 0 deletions ledger/order/migrations/0007_auto_20170106_1600.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-06 08:00
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('order', '0006_auto_20160905_1208'),
]

operations = [
migrations.AlterField(
model_name='line',
name='oracle_code',
field=models.CharField(blank=True, max_length=50, null=True, verbose_name='Oracle Code'),
),
]
2 changes: 1 addition & 1 deletion ledger/payments/bpay/dashboard/app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
from django.conf.urls import patterns, url
from django.conf.urls import url
from django.contrib.admin.views.decorators import staff_member_required

from oscar.core.application import Application
Expand Down
126 changes: 126 additions & 0 deletions ledger/payments/bpay/migrations/0007_auto_20170106_1600.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-06 08:00
from __future__ import unicode_literals

import django.core.validators
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('bpay', '0006_auto_20160912_1134'),
]

operations = [
migrations.AlterField(
model_name='bpayfile',
name='created',
field=models.DateTimeField(help_text='File Creation Date Time.'),
),
migrations.AlterField(
model_name='bpayfile',
name='file_id',
field=models.BigIntegerField(help_text='File Identification Number.'),
),
migrations.AlterField(
model_name='bpaygrouprecord',
name='modifier',
field=models.IntegerField(choices=[(1, 'interim/previous day'), (2, 'final/previous day'), (3, 'interim/same day'), (4, 'final/same day')], help_text='As of Date modifier'),
),
migrations.AlterField(
model_name='bpaygrouprecord',
name='settled',
field=models.DateTimeField(help_text='File Settlement Date Time'),
),
migrations.AlterField(
model_name='bpaytransaction',
name='car',
field=models.CharField(help_text='Customer Additional Reference.', max_length=20, null=True),
),
migrations.AlterField(
model_name='bpaytransaction',
name='cheque_num',
field=models.IntegerField(default=0, help_text='Number of cheques in deposit'),
),
migrations.AlterField(
model_name='bpaytransaction',
name='country',
field=models.CharField(help_text='Country of payment.', max_length=3, null=True),
),
migrations.AlterField(
model_name='bpaytransaction',
name='crn',
field=models.CharField(help_text='Customer Referencer Number', max_length=20),
),
migrations.AlterField(
model_name='bpaytransaction',
name='discount_method',
field=models.CharField(blank=True, help_text='Discount Method Code.', max_length=3, null=True),
),
migrations.AlterField(
model_name='bpaytransaction',
name='discount_ref',
field=models.CharField(blank=True, help_text='Discount Reference Code.', max_length=20, null=True),
),
migrations.AlterField(
model_name='bpaytransaction',
name='discretionary_data',
field=models.CharField(help_text='Reason for refund or reversal.', max_length=50, null=True),
),
migrations.AlterField(
model_name='bpaytransaction',
name='entry_method',
field=models.CharField(blank=True, choices=[('000', 'undefined'), ('001', 'key entry by operator'), ('002', 'touch tone entry by payer'), ('003', 'speech recognition'), ('004', 'internet/on-line banking'), ('005', 'electtronic bill presentment'), ('006', 'batch data entry'), ('007', 'mobile entry')], help_text='Manner in which the payment details are captured.', max_length=3, null=True),
),
migrations.AlterField(
model_name='bpaytransaction',
name='orig_ref_num',
field=models.CharField(blank=True, help_text='Contains the original/previous CRN in the case of a refund or reversal.', max_length=21, null=True),
),
migrations.AlterField(
model_name='bpaytransaction',
name='p_date',
field=models.DateTimeField(help_text='Date of payment.'),
),
migrations.AlterField(
model_name='bpaytransaction',
name='p_instruction_code',
field=models.CharField(choices=[('05', 'payment'), ('15', 'error correction'), ('25', 'reversal')], help_text='Payment instruction method.', max_length=2, validators=[django.core.validators.MinLengthValidator(2)]),
),
migrations.AlterField(
model_name='bpaytransaction',
name='p_method_code',
field=models.CharField(choices=[('001', 'Debit Account'), ('101', 'Visa'), ('201', 'Mastercard'), ('301', 'Bankcard')], help_text='Method of payment.', max_length=3, validators=[django.core.validators.MinLengthValidator(3)]),
),
migrations.AlterField(
model_name='bpaytransaction',
name='payer_name',
field=models.CharField(blank=True, help_text="Name of payer extracted from payer's account details.", max_length=40, null=True),
),
migrations.AlterField(
model_name='bpaytransaction',
name='ref_rev_code',
field=models.CharField(blank=True, choices=[('001', 'payer paid twice'), ('002', 'payer paid wrong account'), ('003', 'payer paid wrong biller'), ('004', 'payer paid wrong amount'), ('005', 'payer did not authorise'), ('400', 'Visa chargeback'), ('500', 'MasterCard chargeback'), ('600', 'Bankcard chargeback')], help_text='Reason code for reversal or refund.', max_length=3, null=True),
),
migrations.AlterField(
model_name='bpaytransaction',
name='service_code',
field=models.CharField(help_text='Unique identification for a service provider realting to a bill.', max_length=7, validators=[django.core.validators.MinLengthValidator(1)]),
),
migrations.AlterField(
model_name='bpaytransaction',
name='state',
field=models.CharField(blank=True, help_text='State code of payer institution.', max_length=4, null=True),
),
migrations.AlterField(
model_name='bpaytransaction',
name='txn_ref',
field=models.CharField(help_text='Transaction Reference Number', max_length=21, validators=[django.core.validators.MinLengthValidator(12)]),
),
migrations.AlterField(
model_name='bpaytransaction',
name='type',
field=models.CharField(choices=[('399', 'credit'), ('699', 'debit')], help_text='Indicates whether it is a credit or debit item', max_length=3, validators=[django.core.validators.MinLengthValidator(3)]),
),
]
2 changes: 1 addition & 1 deletion ledger/payments/bpoint/dashboard/app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
from django.conf.urls import patterns, url
from django.conf.urls import url
from django.contrib.admin.views.decorators import staff_member_required

from oscar.core.application import Application
Expand Down
2 changes: 1 addition & 1 deletion ledger/payments/invoice/dashboard/app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
from django.conf.urls import patterns, url
from django.conf.urls import url
from django.contrib.admin.views.decorators import staff_member_required

from oscar.core.application import Application
Expand Down
29 changes: 15 additions & 14 deletions ledger/settings_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.flatpages',
'social.apps.django_app.default',
'social_django',
'django_extensions',
'reversion',
'widget_tweaks',
Expand Down Expand Up @@ -65,20 +65,21 @@
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'dpaw_utils.middleware.SSOLoginMiddleware',
'dpaw_utils.middleware.AuditMiddleware', # Sets model creator/modifier field values.
'ledger.middleware.FirstTimeNagScreenMiddleware',
# FIXME: find out why django 1.10 breaks
# 'ledger.middleware.FirstTimeNagScreenMiddleware',
'oscar.apps.basket.middleware.BasketMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
]

# Authentication settings
LOGIN_URL = '/'
AUTHENTICATION_BACKENDS = (
'social.backends.email.EmailAuth',
'social_core.backends.email.EmailAuth',
'django.contrib.auth.backends.ModelBackend',
)
AUTH_USER_MODEL = 'accounts.EmailUser'
SOCIAL_AUTH_STRATEGY = 'social.strategies.django_strategy.DjangoStrategy'
SOCIAL_AUTH_STORAGE = 'social.apps.django_app.default.models.DjangoStorage'
SOCIAL_AUTH_STRATEGY = 'social_django.strategy.DjangoStrategy'
SOCIAL_AUTH_STORAGE = 'social_django.models.DjangoStorage'
SOCIAL_AUTH_EMAIL_FORM_URL = '/ledger/'
SOCIAL_AUTH_EMAIL_VALIDATION_FUNCTION = 'ledger.accounts.mail.send_validation'
SOCIAL_AUTH_EMAIL_VALIDATION_URL = '/ledger/validation-sent/'
Expand All @@ -87,20 +88,20 @@
SOCIAL_AUTH_USERNAME_IS_FULL_EMAIL = True
SOCIAL_AUTH_ADMIN_USER_SEARCH_FIELDS = ['first_name', 'last_name', 'email']
SOCIAL_AUTH_PIPELINE = (
'social.pipeline.social_auth.social_details',
'social_core.pipeline.social_auth.social_details',
'ledger.accounts.pipeline.lower_email_address',
'ledger.accounts.pipeline.logout_previous_session',
'social.pipeline.social_auth.social_uid',
'social.pipeline.social_auth.auth_allowed',
'social.pipeline.social_auth.social_user',
'social.pipeline.user.get_username',
'social_core.pipeline.social_auth.social_uid',
'social_core.pipeline.social_auth.auth_allowed',
'social_core.pipeline.social_auth.social_user',
'social_core.pipeline.user.get_username',
# 'social.pipeline.mail.mail_validation',
'ledger.accounts.pipeline.mail_validation',
'ledger.accounts.pipeline.user_by_email',
'social.pipeline.user.create_user',
'social.pipeline.social_auth.associate_user',
'social.pipeline.social_auth.load_extra_data',
'social.pipeline.user.user_details'
'social_core.pipeline.user.create_user',
'social_core.pipeline.social_auth.associate_user',
'social_core.pipeline.social_auth.load_extra_data',
'social_core.pipeline.user.user_details'
)

SESSION_COOKIE_DOMAIN = env('SESSION_COOKIE_DOMAIN', None)
Expand Down
2 changes: 1 addition & 1 deletion ledger/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
url(r'^ledger/admin/', admin.site.urls),
url(r'^ledger/', include('ledger.accounts.urls', namespace='accounts')),
url(r'^ledger/', include('ledger.payments.urls', namespace='payments')),
url(r'^ledger/', include('social.apps.django_app.urls', namespace='social')),
url(r'^ledger/', include('social_django.urls', namespace='social')),
url(r'^ledger/checkout/', application.urls),
url(r'^taxonomy/', include('ledger.taxonomy.urls')),
url(r'^$', TemplateView.as_view(template_name='customers/base.html'), name='home')
Expand Down
Loading

0 comments on commit ef8447c

Please sign in to comment.