コード例 #1
0
    def test_shared_vault_transaction_with_nonce(self):
        config = Configuration(
            merchant_id="integration_merchant_public_id",
            public_key="oauth_app_partner_user_public_key",
            private_key="oauth_app_partner_user_private_key",
            environment=Environment.Development)

        gateway = BraintreeGateway(config)
        customer = gateway.customer.create({"first_name": "Bob"}).customer
        address = gateway.address.create({
            "customer_id": customer.id,
            "first_name": "Joe",
        }).address

        credit_card = gateway.credit_card.create(
            params={
                "customer_id": customer.id,
                "number": "4111111111111111",
                "expiration_date": "05/2009",
            }).credit_card

        shared_nonce = gateway.payment_method_nonce.create(
            credit_card.token).payment_method_nonce.nonce

        oauth_app_gateway = BraintreeGateway(
            client_id="client_id$development$integration_client_id",
            client_secret="client_secret$development$integration_client_secret",
            environment=Environment.Development)
        code = TestHelper.create_grant(
            oauth_app_gateway, {
                "merchant_public_id": "integration_merchant_id",
                "scope": "grant_payment_method,shared_vault_transactions"
            })
        access_token = oauth_app_gateway.oauth.create_token_from_code({
            "code":
            code
        }).credentials.access_token

        recipient_gateway = BraintreeGateway(access_token=access_token)

        result = recipient_gateway.transaction.sale({
            "shared_payment_method_nonce":
            shared_nonce,
            "shared_customer_id":
            customer.id,
            "shared_shipping_address_id":
            address.id,
            "shared_billing_address_id":
            address.id,
            "amount":
            "100"
        })

        self.assertTrue(result.is_success)
        self.assertEqual(result.transaction.shipping_details.first_name,
                         address.first_name)
        self.assertEqual(result.transaction.billing_details.first_name,
                         address.first_name)
        self.assertEqual(result.transaction.customer_details.first_name,
                         customer.first_name)
コード例 #2
0
 def __init__(self, config=None, **kwargs):
     if isinstance(config, braintree.configuration.Configuration):
         self.config = config
     else:
         self.config = Configuration(
             client_id=kwargs.get("client_id"),
             client_secret=kwargs.get("client_secret"),
             access_token=kwargs.get("access_token"),
             http_strategy=kwargs.get("http_strategy")
         )
     self.add_on = AddOnGateway(self)
     self.address = AddressGateway(self)
     self.client_token = ClientTokenGateway(self)
     self.credit_card = CreditCardGateway(self)
     self.customer = CustomerGateway(self)
     self.discount = DiscountGateway(self)
     self.merchant_account = MerchantAccountGateway(self)
     self.merchant = MerchantGateway(self)
     self.oauth = OAuthGateway(self)
     self.plan = PlanGateway(self)
     self.settlement_batch_summary = SettlementBatchSummaryGateway(self)
     self.subscription = SubscriptionGateway(self)
     self.transaction = TransactionGateway(self)
     self.transparent_redirect = TransparentRedirectGateway(self)
     self.verification = CreditCardVerificationGateway(self)
     self.webhook_notification = WebhookNotificationGateway(self)
     self.webhook_testing = WebhookTestingGateway(self)
     self.payment_method = PaymentMethodGateway(self)
     self.payment_method_nonce = PaymentMethodNonceGateway(self)
     self.paypal_account = PayPalAccountGateway(self)
     self.testing = TestingGateway(self)
     self.us_bank_account = UsBankAccountGateway(self)
コード例 #3
0
 def setUp(self):
     config = Configuration(
         environment=Environment.Development,
         merchant_id="integration_merchant_id",
         public_key="integration_public_key",
         private_key="integration_private_key"
     )
     self.gateway = BraintreeGateway(config)
コード例 #4
0
 def get_configured_gateway(self):
     options = {
         'environment': '',
         'merchant_id': self.options.get('merchant_id'),
         'public_key': self.options.get('public_key'),
         'private_key': self.options.get('private_key'),
     }
     if self.gateway_mode != 'live':
         options['environment'] = braintree.Environment.Sandbox
     else:
         options['environment'] = braintree.Environment.Production
     braintree.Configuration.configure(**options)
     configuration = Configuration(**options)
     return BraintreeGateway(configuration)
コード例 #5
0
 def __init__(self, config=None, **kwargs):
     if isinstance(config, braintree.configuration.Configuration):
         self.config = config
     else:
         self.config = Configuration(
             client_id=kwargs.get("client_id"),
             client_secret=kwargs.get("client_secret"),
             access_token=kwargs.get("access_token"),
             http_strategy=kwargs.get("http_strategy")
         )
     self.graphql_client = self.config.graphql_client()
     self.add_on = AddOnGateway(self)
     self.address = AddressGateway(self)
     self.apple_pay = ApplePayGateway(self)
     self.client_token = ClientTokenGateway(self)
     self.credit_card = CreditCardGateway(self)
     self.customer = CustomerGateway(self)
     self.document_upload = DocumentUploadGateway(self)
     self.discount = DiscountGateway(self)
     self.dispute = DisputeGateway(self)
     self.merchant_account = MerchantAccountGateway(self)
     self.merchant = MerchantGateway(self)
     self.oauth = OAuthGateway(self)
     self.plan = PlanGateway(self)
     self.settlement_batch_summary = SettlementBatchSummaryGateway(self)
     self.subscription = SubscriptionGateway(self)
     self.transaction = TransactionGateway(self)
     self.transaction_line_item = TransactionLineItemGateway(self)
     self.transparent_redirect = TransparentRedirectGateway(self)
     self.verification = CreditCardVerificationGateway(self)
     self.webhook_notification = WebhookNotificationGateway(self)
     self.webhook_testing = WebhookTestingGateway(self)
     self.payment_method = PaymentMethodGateway(self)
     self.payment_method_nonce = PaymentMethodNonceGateway(self)
     self.paypal_account = PayPalAccountGateway(self)
     self.testing = TestingGateway(self)
     self.us_bank_account = UsBankAccountGateway(self)
     self.us_bank_account_verification = UsBankAccountVerificationGateway(self)
     # NEXT_MAJOR_VERSION Remove this class as legacy Ideal has been removed/disabled in the Braintree Gateway
     # DEPRECATED If you're looking to accept iDEAL as a payment method contact [email protected] for a solution.
     self.ideal_payment = IdealPaymentGateway(self)
コード例 #6
0
 def get_graphql_client(environment):
     config = Configuration(environment, "integration_merchant_id",
                            public_key="integration_public_key",
                            private_key="integration_private_key")
     return config.graphql_client()
コード例 #7
0
 def setUp(self):
     config = Configuration(braintree.Environment.Production, "merchant_id", "public_key", "private_key")
     braintree_gateway = BraintreeGateway(config)
     self.gateway = TestingGateway(braintree_gateway)
コード例 #8
0
 def get_gateway():
     config = Configuration("development",
                            "integration_merchant_id",
                            public_key="integration_public_key",
                            private_key="integration_private_key")
     return BraintreeGateway(config)
コード例 #9
0
 def setUp(self):
     config = Configuration(braintree.Environment.Production, "", "", "")
     braintree_gateway = BraintreeGateway(config)
     self.gateway = TestingGateway(braintree_gateway)