diff --git a/doc/install.rst b/doc/install.rst index 0a45d25f1..3128f5b74 100644 --- a/doc/install.rst +++ b/doc/install.rst @@ -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. diff --git a/doc/modules.rst b/doc/modules.rst index 745a7bc11..50c72e441 100644 --- a/doc/modules.rst +++ b/doc/modules.rst @@ -11,7 +11,7 @@ Dummy Example:: - PAYMENT_VARIANTS = { + PAYMENT_VARIANTS_API = { 'dummy': ('payments.dummy.DummyProvider', {})} @@ -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', @@ -52,7 +52,7 @@ Braintree Example:: # use sandbox - PAYMENT_VARIANTS = { + PAYMENT_VARIANTS_API = { 'braintree': ('payments.braintree.BraintreeProvider', { 'merchant_id': '112233445566', 'public_key': '1234567890abcdef', @@ -77,7 +77,7 @@ Coinbase Example:: # use sandbox - PAYMENT_VARIANTS = { + PAYMENT_VARIANTS_API = { 'coinbase': ('payments.coinbase.CoinbaseProvider', { 'key': '123abcd', 'secret': 'abcd1234', @@ -103,7 +103,7 @@ Cybersource Example:: # use sandbox - PAYMENT_VARIANTS = { + PAYMENT_VARIANTS_API = { 'cybersource': ('payments.cybersource.CyberSourceProvider', { 'merchant_id': 'example', 'password': '1234567890abcdef', @@ -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', @@ -164,7 +164,7 @@ Google Wallet Example:: # use sandbox - PAYMENT_VARIANTS = { + PAYMENT_VARIANTS_API = { 'wallet': ('payments.wallet.GoogleWalletProvider', { 'seller_id': '112233445566', 'seller_secret': '1234567890abcdef', @@ -205,7 +205,7 @@ PayPal Example:: # use sandbox - PAYMENT_VARIANTS = { + PAYMENT_VARIANTS_API = { 'paypal': ('payments.paypal.PaypalProvider', { 'client_id': 'user@example.com', 'secret': 'iseedeadpeople', @@ -220,7 +220,7 @@ Example:: Example:: - PAYMENT_VARIANTS = { + PAYMENT_VARIANTS_API = { 'paypal': ('payments.paypal.PaypalCardProvider', { 'client_id': 'user@example.com', 'secret': 'iseedeadpeople'})} @@ -245,7 +245,7 @@ Sage Pay Example:: # use simulator - PAYMENT_VARIANTS = { + PAYMENT_VARIANTS_API = { 'sage': ('payments.sagepay.SagepayProvider', { 'vendor': 'example', 'encryption_key': '1234567890abcdef', @@ -268,7 +268,7 @@ Sofort.com Example:: - PAYMENT_VARIANTS = { + PAYMENT_VARIANTS_API = { 'sage': ('payments.sofort.SofortProvider', { 'id': '123456', 'key': '1234567890abcdef', @@ -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'})} diff --git a/doc/preauth.rst b/doc/preauth.rst index 668ff3812..f7201a6f3 100644 --- a/doc/preauth.rst +++ b/doc/preauth.rst @@ -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})} diff --git a/doc/usage.rst b/doc/usage.rst index af903c9fd..fae508037 100644 --- a/doc/usage.rst +++ b/doc/usage.rst @@ -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), diff --git a/payments/core.py b/payments/core.py index e81bfab6e..f2d46e680 100644 --- a/payments/core.py +++ b/payments/core.py @@ -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) @@ -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' @@ -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' %