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

rename PAYMENT_VARIANTS to PAYMENT_VARIANTS_API #137

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Installation
PAYMENT_HOST = 'localhost:8000'
PAYMENT_USES_SSL = False
PAYMENT_MODEL = 'mypaymentapp.Payment'
PAYMENT_VARIANTS = {
PAYMENT_VARIANTS_API = {
'default': ('payments.dummy.DummyProvider', {})}

Variants are named pairs of payment providers and their configuration.
Expand Down
24 changes: 12 additions & 12 deletions doc/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Dummy

Example::

PAYMENT_VARIANTS = {
PAYMENT_VARIANTS_API = {
'dummy': ('payments.dummy.DummyProvider', {})}


Expand All @@ -29,7 +29,7 @@ Authorize.Net
Example::

# use staging environment
PAYMENT_VARIANTS = {
PAYMENT_VARIANTS_API = {
'authorizenet': ('payments.authorizenet.AuthorizeNetProvider', {
'login_id': '1234login',
'transaction_key': '1234567890abcdef',
Expand All @@ -52,7 +52,7 @@ Braintree
Example::

# use sandbox
PAYMENT_VARIANTS = {
PAYMENT_VARIANTS_API = {
'braintree': ('payments.braintree.BraintreeProvider', {
'merchant_id': '112233445566',
'public_key': '1234567890abcdef',
Expand All @@ -77,7 +77,7 @@ Coinbase
Example::

# use sandbox
PAYMENT_VARIANTS = {
PAYMENT_VARIANTS_API = {
'coinbase': ('payments.coinbase.CoinbaseProvider', {
'key': '123abcd',
'secret': 'abcd1234',
Expand All @@ -103,7 +103,7 @@ Cybersource
Example::

# use sandbox
PAYMENT_VARIANTS = {
PAYMENT_VARIANTS_API = {
'cybersource': ('payments.cybersource.CyberSourceProvider', {
'merchant_id': 'example',
'password': '1234567890abcdef',
Expand Down Expand Up @@ -140,7 +140,7 @@ Dotpay
Example::

# use defaults for channel and lang but lock available channels
PAYMENT_VARIANTS = {
PAYMENT_VARIANTS_API = {
'dotpay': ('payments.dotpay.DotpayProvider', {
'seller_id': '123',
'pin': '0000',
Expand All @@ -164,7 +164,7 @@ Google Wallet
Example::

# use sandbox
PAYMENT_VARIANTS = {
PAYMENT_VARIANTS_API = {
'wallet': ('payments.wallet.GoogleWalletProvider', {
'seller_id': '112233445566',
'seller_secret': '1234567890abcdef',
Expand Down Expand Up @@ -205,7 +205,7 @@ PayPal
Example::

# use sandbox
PAYMENT_VARIANTS = {
PAYMENT_VARIANTS_API = {
'paypal': ('payments.paypal.PaypalProvider', {
'client_id': '[email protected]',
'secret': 'iseedeadpeople',
Expand All @@ -220,7 +220,7 @@ Example::

Example::

PAYMENT_VARIANTS = {
PAYMENT_VARIANTS_API = {
'paypal': ('payments.paypal.PaypalCardProvider', {
'client_id': '[email protected]',
'secret': 'iseedeadpeople'})}
Expand All @@ -245,7 +245,7 @@ Sage Pay
Example::

# use simulator
PAYMENT_VARIANTS = {
PAYMENT_VARIANTS_API = {
'sage': ('payments.sagepay.SagepayProvider', {
'vendor': 'example',
'encryption_key': '1234567890abcdef',
Expand All @@ -268,7 +268,7 @@ Sofort.com

Example::

PAYMENT_VARIANTS = {
PAYMENT_VARIANTS_API = {
'sage': ('payments.sofort.SofortProvider', {
'id': '123456',
'key': '1234567890abcdef',
Expand All @@ -294,7 +294,7 @@ Stripe
Example::

# use sandbox
PAYMENT_VARIANTS = {
PAYMENT_VARIANTS_API = {
'stripe': ('payments.stripe.StripeProvider', {
'secret_key': 'sk_test_123456',
'public_key': 'pk_test_123456'})}
Expand Down
2 changes: 1 addition & 1 deletion doc/preauth.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Authorization and capture
Some gateways offer a two-step payment method known as Authorization & Capture, which allows you to collect the payment manually after the buyer has authorized it. To enable this payment type, you have to set the ``capture`` parameter to ``False`` in the configuration of payment backend::

# settings.py
PAYMENT_VARIANTS = {
PAYMENT_VARIANTS_API = {
'default': ('payments.dummy.DummyProvider', {'capture': False})}


Expand Down
2 changes: 1 addition & 1 deletion doc/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Making a payment

Payment = get_payment_model()
payment = Payment.objects.create(
variant='default', # this is the variant from PAYMENT_VARIANTS
variant='default', # this is the variant from PAYMENT_VARIANTS_API
description='Book purchase',
total=Decimal(120),
tax=Decimal(20),
Expand Down
8 changes: 4 additions & 4 deletions payments/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from django.core.exceptions import ImproperlyConfigured


PAYMENT_VARIANTS = {
PAYMENT_VARIANTS_API = {
'default': ('payments.dummy.DummyProvider', {})}

PAYMENT_HOST = getattr(settings, 'PAYMENT_HOST', None)
Expand All @@ -26,8 +26,8 @@ def get_base_url():
"""
Returns host url according to project settings. Protocol is chosen by
checking PAYMENT_USES_SSL variable.
If PAYMENT_HOST is not specified, gets domain from Sites.
Otherwise checks if it's callable and returns it's result. If it's not a
If PAYMENT_HOST is not specified, gets domain from Sites.
Otherwise checks if it's callable and returns it's result. If it's not a
callable treats it as domain.
"""
protocol = 'https' if PAYMENT_USES_SSL else 'http'
Expand Down Expand Up @@ -109,7 +109,7 @@ def provider_factory(variant):
'''
Return the provider instance based on variant
'''
variants = getattr(settings, 'PAYMENT_VARIANTS', PAYMENT_VARIANTS)
variants = getattr(settings, 'PAYMENT_VARIANTS_API', PAYMENT_VARIANTS_API)
handler, config = variants.get(variant, (None, None))
if not handler:
raise ValueError('Payment variant does not exist: %s' %
Expand Down