-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add paypal and dummy payment modules
Conflicts: boilerplate/settings/shop.py
- Loading branch information
1 parent
65c324d
commit e4d491a
Showing
7 changed files
with
150 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]> | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]> | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]> | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |