Python django.conf.settings.BRAINTREE_MERCHANT_ID Examples

The following are 1 code examples for showing how to use django.conf.settings.BRAINTREE_MERCHANT_ID(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module django.conf.settings , or try the search function .

Example 1
Project: wagtailinvoices   Author: SableWalnut   File: payments.py    License: BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def set_braintree_mode(mode):
    if mode.lower() == "production":
        print('Initalising production mode!')
        braintree.Configuration.configure(
            braintree.Environment.Production,
            settings.BRAINTREE_MERCHANT_ID,
            settings.BRAINTREE_PUBLIC_KEY,
            settings.BRAINTREE_PRIVATE_KEY,
        )

    elif mode.lower() == "sandbox":
        print('Initalising sandbox mode!')
        braintree.Configuration.configure(
            braintree.Environment.Sandbox,
            settings.BRAINTREE_MERCHANT_ID,
            settings.BRAINTREE_PUBLIC_KEY,
            settings.BRAINTREE_PRIVATE_KEY,
        )
    else:
        raise ValueError("BRAINTREE_MODE needs to be set to either 'production' or 'sandbox'")