def _parse_payment_method(self, response): if "paypal_account" in response: return PayPalAccount(self.gateway, response["paypal_account"]) elif "credit_card" in response: return CreditCard(self.gateway, response["credit_card"]) elif "europe_bank_account" in response: return EuropeBankAccount(self.gateway, response["europe_bank_account"]) elif "apple_pay_card" in response: return ApplePayCard(self.gateway, response["apple_pay_card"]) elif "android_pay_card" in response: return AndroidPayCard(self.gateway, response["android_pay_card"]) elif "amex_express_checkout_card" in response: return AmexExpressCheckoutCard(self.gateway, response["amex_express_checkout_card"]) elif "coinbase_account" in response: return CoinbaseAccount(self.gateway, response["coinbase_account"]) elif "venmo_account" in response: return VenmoAccount(self.gateway, response["venmo_account"]) elif "us_bank_account" in response: return UsBankAccount(self.gateway, response["us_bank_account"]) elif "visa_checkout_card" in response: return VisaCheckoutCard(self.gateway, response["visa_checkout_card"]) elif "masterpass_card" in response: return MasterpassCard(self.gateway, response["masterpass_card"]) elif "payment_method_nonce" in response: return PaymentMethodNonce(self.gateway, response["payment_method_nonce"]) elif "success" in response: return None else: name = list(response)[0] return UnknownPaymentMethod(self.gateway, response[name])
def _parse_payment_method_nonce(self, response): if "payment_method_nonce" in response: return PaymentMethodNonce(self.gateway, response["payment_method_nonce"]) raise ValueError("payment_method_nonce not present in response")
def _parse_payment_method_nonce(self, response): return PaymentMethodNonce(self.gateway, response["payment_method_nonce"])