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)
def __init__(self, config): self.config = config self.add_on = AddOnGateway(self) self.address = AddressGateway(self) self.credit_card = CreditCardGateway(self) self.customer = CustomerGateway(self) self.discount = DiscountGateway(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.webhook_notification = WebhookNotificationGateway(self) self.webhook_testing = WebhookTestingGateway(self)
def braintree_verify(request): """ Process Braintree webhooks. This is a pretty simple endpoint that assumes the data has already been sanitised and cleaned by the solitude server. :bt_challenge string: the bt_challenge param sent by Braintree. :status 200: contains the string to pass back. Any other status is a failure to verify. """ data = request.GET.get('bt_challenge') res = WebhookNotificationGateway(BraintreeGateway()).verify(data) return HttpResponse(res)
def __init__(self, config): self.config = config 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.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.paypal_account = PayPalAccountGateway(self) self.testing = TestingGateway(self)
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)
def braintree_parse(request): """ Validate Braintree webhook data. This assumes that solitude has cleaned the data. It doesn't actually return any data :bt_payload string: the payload from braintree. :bt_signature string: the signature that needs to be verified. :status 204: the data is to be trusted. Contains no content. Any other status is a failure to verify and should not be trusted. """ data = (request.POST.get('bt_signature', ''), request.POST.get('bt_payload', '')) try: WebhookNotificationGateway(BraintreeGateway()).parse(*data) except: log.exception('Parse webhook failed') return HttpResponse(status=403) return HttpResponse(status=204)
def setUp(self): super(TestBraintree, self).setUp() # This is the verify string at test creation which we'll store so tests # can manipulate the inputs. self.verify_string = (WebhookNotificationGateway( BraintreeGateway()).verify(''))