Skip to content

Commit

Permalink
add paypal and dummy payment modules
Browse files Browse the repository at this point in the history
Conflicts:

	boilerplate/settings/shop.py
  • Loading branch information
Lacrymology committed Feb 21, 2013
1 parent 65c324d commit e4d491a
Show file tree
Hide file tree
Showing 7 changed files with 150 additions and 0 deletions.
10 changes: 10 additions & 0 deletions boilerplate/apps/store/modules/payment/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-

"""
.. module:: boilerplate.apps.store.modules.payment
:platform: Unix
:synopsis: base package for base-case payment modules
.. moduleauthor:: Tomas Neme <[email protected]>
"""
10 changes: 10 additions & 0 deletions boilerplate/apps/store/modules/payment/base/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-

"""
.. module:: boilerplate.apps.store.modules.payment.base
:platform: Unix
:synopsis: Base for custom payment modules for usage with the checkout app
.. moduleauthor:: Tomas Neme <[email protected]>
"""
32 changes: 32 additions & 0 deletions boilerplate/apps/store/modules/payment/base/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-

"""
.. module::
:platform: Unix
:synopsis: TODO
.. moduleauthor:: Tomas Neme <[email protected]>
"""
from django.utils.translation import ugettext_noop as _
from oscar.core.application import Application

class PaymentModule(Application):
"""
Base payment module.
"""
#: This is used from the checkout app and needs to be defined in each
#: subclass
module_name = None
#: Human-readable name for the payment app. Should be internationalized if
#: required
verbose_name = _('UNDEFINED')

def get_choice(self):
"""
This is used in the select payment form to generate the list of choices.
By default it returns (module_name, verbose_name)
:return: a Tuple as expected by forms.ChoiceFields' choices parameter
"""
return (self.module_name, self.verbose_name)
48 changes: 48 additions & 0 deletions boilerplate/apps/store/modules/payment/dummy/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# -*- coding: utf-8 -*-

"""
.. module:: boilerplate.apps.store.modules.dummy
:platform: Unix
:synopsis: dummy payment module for oscar. Receives Credit Card data and
billing address. This is the list of valid test credit card numbers:
CREDIT_CARDS = {
'American Express': [
'378282246310005',
'371449635398431',
],
'MasterCard': [
'5555555555554444',
'5105105105105100',
],
'Visa': [
'4111111111111111',
'4012888888881881',
# Note : Even though this number has a different character count than
# the other test numbers, it is the correct and functional number.
'4222222222222'
]
}
.. moduleauthor:: Tomas Neme <[email protected]>
"""

# Test Credit Card Account Numbers
CREDIT_CARDS = {
'American Express': [
'378282246310005',
'371449635398431',
],
'MasterCard': [
'5555555555554444',
'5105105105105100',
],
'Visa': [
'4111111111111111',
'4012888888881881',
# Note : Even though this number has a different character count than
# the other test numbers, it is the correct and functional number.
'4222222222222'
]
}
18 changes: 18 additions & 0 deletions boilerplate/apps/store/modules/payment/dummy/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-

"""
.. module:: boilerplate.apps.store.modules.payment.dummy.app
:platform: Unix
:synopsis: oscar application for the dummy payment module
.. moduleauthor:: Tomas Neme <[email protected]>
"""
from boilerplate.apps.store.modules.payment.base.app import PaymentModule

class DummyPaymentApplication(PaymentModule):
def get_urls(self):
patterns = ('')
return super(DummyPaymentApplication, self).get_urls()

application = DummyPaymentApplication()
10 changes: 10 additions & 0 deletions boilerplate/apps/store/modules/payment/paypal/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-

"""
.. module::
:platform: Unix
:synopsis: TODO
.. moduleauthor:: Tomas Neme <[email protected]>
"""
22 changes: 22 additions & 0 deletions boilerplate/apps/store/modules/payment/paypal/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-

"""
.. module::
:platform: Unix
:synopsis: TODO
.. moduleauthor:: Tomas Neme <[email protected]>
"""
from django.utils.translation import ugettext_lazy as _
from boilerplate.apps.store.modules.payment.base.app import PaymentModule

class PaypalPaymentModule(PaymentModule):
module_name = 'paypal'
verbose_name = _('Paypal')

def get_urls(self):
from paypal.express import urls
return urls.urlpatterns

application = PaypalPaymentModule()

0 comments on commit e4d491a

Please sign in to comment.