コード例 #1
0
    def __init__(self, gateway, attributes):
        if "refund_id" in attributes.keys():
            self._refund_id = attributes["refund_id"]
            del(attributes["refund_id"])
        else:
            self._refund_id = None

        Resource.__init__(self, gateway, attributes)

        self.amount = Decimal(self.amount)
        if self.tax_amount:
            self.tax_amount = Decimal(self.tax_amount)
        if "billing" in attributes:
            self.billing_details = Address(gateway, attributes.pop("billing"))
        if "credit_card" in attributes:
            self.credit_card_details = CreditCard(gateway, attributes.pop("credit_card"))
        if "customer" in attributes:
            self.customer_details = Customer(gateway, attributes.pop("customer"))
        if "shipping" in attributes:
            self.shipping_details = Address(gateway, attributes.pop("shipping"))
        if "add_ons" in attributes:
            self.add_ons = [AddOn(gateway, add_on) for add_on in self.add_ons]
        if "discounts" in attributes:
            self.discounts = [Discount(gateway, discount) for discount in self.discounts]
        if "status_history" in attributes:
            self.status_history = [StatusEvent(gateway, status_event) for status_event in self.status_history]
        if "descriptor" in attributes:
            self.descriptor = Descriptor(gateway, attributes.pop("descriptor"))
コード例 #2
0
    def signature(type):
        options = [
            "fail_on_duplicate_payment_method",
            "make_default",
            "us_bank_account_verification_method",
            "verification_merchant_account_id",
            "verify_card",
            "verification_amount",
            "verification_account_type",
            {
                "adyen": ["overwrite_brand", "selected_brand"]
            },
            {
                "paypal": [
                    "payee_email", "order_id", "custom_field", "description",
                    "amount", {
                        "shipping": Address.create_signature()
                    }
                ],
            },
        ]

        signature = [
            "billing_address_id", "cardholder_name", "customer_id", "cvv",
            "device_data", "device_session_id", "expiration_date",
            "expiration_month", "expiration_year", "number",
            "payment_method_nonce", "paypal_refresh_token",
            "paypal_vault_without_upgrade", "token", {
                "billing_address": Address.create_signature()
            }, {
                "options": options
            }
        ]
        return signature
コード例 #3
0
 def update(self, customer_id, address_id, params={}):
     Resource.verify_keys(params, Address.update_signature())
     response = self.config.http().put(
         "/customers/" + customer_id + "/addresses/" + address_id,
         {"address": params}
     )
     if "address" in response:
         return SuccessfulResult({"address": Address(self.gateway, response["address"])})
     elif "api_error_response" in response:
         return ErrorResult(self.gateway, response["api_error_response"])
コード例 #4
0
    def __init__(self, gateway, attributes):
        if "refund_id" in attributes:
            self._refund_id = attributes["refund_id"]
            del(attributes["refund_id"])
        else:
            self._refund_id = None

        Resource.__init__(self, gateway, attributes)

        self.amount = Decimal(self.amount)
        if self.tax_amount:
            self.tax_amount = Decimal(self.tax_amount)
        if "billing" in attributes:
            self.billing_details = Address(gateway, attributes.pop("billing"))
        if "credit_card" in attributes:
            self.credit_card_details = CreditCard(gateway, attributes.pop("credit_card"))
        if "paypal" in attributes:
            self.paypal_details = PayPalAccount(gateway, attributes.pop("paypal"))
        if "europe_bank_account" in attributes:
            self.europe_bank_account_details = EuropeBankAccount(gateway, attributes.pop("europe_bank_account"))
        if "apple_pay" in attributes:
            self.apple_pay_details = ApplePayCard(gateway, attributes.pop("apple_pay"))
        if "coinbase_account" in attributes:
            self.coinbase_details = CoinbaseAccount(gateway, attributes.pop("coinbase_account"))
        if "android_pay_card" in attributes:
            self.android_pay_card_details = AndroidPayCard(gateway, attributes.pop("android_pay_card"))
        if "customer" in attributes:
            self.customer_details = Customer(gateway, attributes.pop("customer"))
        if "shipping" in attributes:
            self.shipping_details = Address(gateway, attributes.pop("shipping"))
        if "add_ons" in attributes:
            self.add_ons = [AddOn(gateway, add_on) for add_on in self.add_ons]
        if "discounts" in attributes:
            self.discounts = [Discount(gateway, discount) for discount in self.discounts]
        if "status_history" in attributes:
            self.status_history = [StatusEvent(gateway, status_event) for status_event in self.status_history]
        if "subscription" in attributes:
            self.subscription_details = SubscriptionDetails(attributes.pop("subscription"))
        if "descriptor" in attributes:
            self.descriptor = Descriptor(gateway, attributes.pop("descriptor"))
        if "disbursement_details" in attributes:
            self.disbursement_details = DisbursementDetail(attributes.pop("disbursement_details"))
        if "disputes" in attributes:
            self.disputes = [Dispute(dispute) for dispute in self.disputes]
        if "payment_instrument_type" in attributes:
            self.payment_instrument_type = attributes["payment_instrument_type"]

        if "risk_data" in attributes:
            self.risk_data = RiskData(attributes["risk_data"])
        else:
            self.risk_data = None
        if "three_d_secure_info" in attributes and not attributes["three_d_secure_info"] == None:
            self.three_d_secure_info = ThreeDSecureInfo(attributes["three_d_secure_info"])
        else:
            self.three_d_secure_info = None
コード例 #5
0
    def __init__(self, gateway, attributes):
        if "refund_id" in attributes:
            self._refund_id = attributes["refund_id"]
            del (attributes["refund_id"])
        else:
            self._refund_id = None

        Resource.__init__(self, gateway, attributes)

        self.amount = Decimal(self.amount)
        if self.tax_amount:
            self.tax_amount = Decimal(self.tax_amount)
        if "billing" in attributes:
            self.billing_details = Address(gateway, attributes.pop("billing"))
        if "credit_card" in attributes:
            self.credit_card_details = CreditCard(
                gateway, attributes.pop("credit_card"))
        if "paypal" in attributes:
            self.paypal_details = PayPalAccount(gateway,
                                                attributes.pop("paypal"))
        if "sepa_bank_account" in attributes:
            self.sepa_bank_account_details = SEPABankAccount(
                gateway, attributes.pop("sepa_bank_account"))
        if "customer" in attributes:
            self.customer_details = Customer(gateway,
                                             attributes.pop("customer"))
        if "shipping" in attributes:
            self.shipping_details = Address(gateway,
                                            attributes.pop("shipping"))
        if "add_ons" in attributes:
            self.add_ons = [AddOn(gateway, add_on) for add_on in self.add_ons]
        if "discounts" in attributes:
            self.discounts = [
                Discount(gateway, discount) for discount in self.discounts
            ]
        if "status_history" in attributes:
            self.status_history = [
                StatusEvent(gateway, status_event)
                for status_event in self.status_history
            ]
        if "subscription" in attributes:
            self.subscription_details = SubscriptionDetails(
                attributes.pop("subscription"))
        if "descriptor" in attributes:
            self.descriptor = Descriptor(gateway, attributes.pop("descriptor"))
        if "disbursement_details" in attributes:
            self.disbursement_details = DisbursementDetail(
                attributes.pop("disbursement_details"))
        if "disputes" in attributes:
            self.disputes = [Dispute(dispute) for dispute in self.disputes]
        if "payment_instrument_type" in attributes:
            self.payment_instrument_type = attributes[
                "payment_instrument_type"]
コード例 #6
0
    def create(self, params={}):
        Resource.verify_keys(params, Address.create_signature())
        if not "customer_id" in params:
            raise KeyError("customer_id must be provided")
        if not re.search("\A[0-9A-Za-z_-]+\Z", params["customer_id"]):
            raise KeyError("customer_id contains invalid characters")

        response = self.config.http().post("/customers/" + params.pop("customer_id") + "/addresses", {"address": params})
        if "address" in response:
            return SuccessfulResult({"address": Address(self.gateway, response["address"])})
        elif "api_error_response" in response:
            return ErrorResult(self.gateway, response["api_error_response"])
コード例 #7
0
    def signature(type):
        options = [
            "fail_on_duplicate_payment_method",
            "make_default",
            "us_bank_account_verification_method",
            "verification_merchant_account_id",
            "verify_card",
            "verification_amount",
            "verification_account_type",
            {
                "adyen": [
                    "overwrite_brand",
                    "selected_brand"
                ]
            },
            {
                "paypal": [
                    "payee_email",
                    "order_id",
                    "custom_field",
                    "description",
                    "amount",
                    { "shipping": Address.create_signature() }
                ],
            },
        ]

        signature = [
            "billing_address_id",
            "cardholder_name",
            "customer_id",
            "cvv",
            "device_data",
            "device_session_id",
            "expiration_date",
            "expiration_month",
            "expiration_year",
            "number",
            "payment_method_nonce",
            "paypal_refresh_token",
            "paypal_vault_without_upgrade",
            "token",
            {
                "billing_address": Address.create_signature()
            },
            {
                "options": options
            }
        ]
        return signature
コード例 #8
0
 def __init__(self, attributes):
     Resource.__init__(self, attributes)
     self.is_expired = self.expired
     if "billing_address" in attributes:
         self.billing_address = Address(self.billing_address)
     if "subscriptions" in attributes:
         self.subscriptions = [braintree.subscription.Subscription(subscription) for subscription in self.subscriptions]
コード例 #9
0
ファイル: customer.py プロジェクト: smbpgroup/upibo
 def update_signature():
     return [
         "company",
         "email",
         "fax",
         "first_name",
         "id",
         "last_name",
         "phone",
         "website",
         "device_data",
         "device_session_id",
         "fraud_merchant_id",
         "payment_method_nonce",
         "default_payment_method_token",
         {
             "credit_card": CreditCard.signature("update_via_customer")
         },
         {
             "custom_fields": ["__any_key__"]
         },
         {
             "options": [{
                 "paypal": [
                     "payee_email", "order_id", "custom_field",
                     "description", "amount", {
                         "shipping": Address.create_signature()
                     }
                 ]
             }]
         },
     ]
コード例 #10
0
 def update_signature():
     signature = [
         "billing_address_id",
         "cardholder_name",
         "cvv",
         "device_session_id",
         "expiration_date",
         "expiration_month",
         "expiration_year",
         "number",
         "token",
         "venmo_sdk_payment_method_code",
         "device_data",
         "fraud_merchant_id",
         "payment_method_nonce",
         {"options": [
             "make_default",
             "verify_card",
             "verification_merchant_account_id",
             "venmo_sdk_session"
             ]
         },
         {"billing_address" :
             Address.update_signature() +
             [{"options": ["update_existing"]}]
         }
     ]
     return signature
コード例 #11
0
 def update_signature():
     signature = [
         "billing_address_id",
         "cardholder_name",
         "cvv",
         "device_session_id",
         "expiration_date",
         "expiration_month",
         "expiration_year",
         "number",
         "token",
         "venmo_sdk_payment_method_code",
         "device_data",
         "fraud_merchant_id",
         "payment_method_nonce",
         {
             "options": [
                 "make_default",
                 "verify_card",
                 "verification_merchant_account_id",
                 "venmo_sdk_session",
                 {
                     "adyen": [
                         "overwrite_brand",
                         "selected_brand"
                     ]
                 }
             ]
         },
         {
             "billing_address": Address.update_signature() + [{"options": ["update_existing"]}]
         }
     ]
     return signature
コード例 #12
0
    def __init__(self, gateway, attributes):
        Resource.__init__(self, gateway, attributes)
        self.payment_methods = []

        if "credit_cards" in attributes:
            self.credit_cards = [CreditCard(gateway, credit_card) for credit_card in self.credit_cards]
            self.payment_methods += self.credit_cards
        if "addresses" in attributes:
            self.addresses = [Address(gateway, address) for address in self.addresses]

        if "paypal_accounts" in attributes:
            self.paypal_accounts  = [PayPalAccount(gateway, paypal_account) for paypal_account in self.paypal_accounts]
            self.payment_methods += self.paypal_accounts

        if "apple_pay_cards" in attributes:
            self.apple_pay_cards  = [ApplePayCard(gateway, apple_pay_card) for apple_pay_card in self.apple_pay_cards]
            self.payment_methods += self.apple_pay_cards

        if "android_pay_cards" in attributes:
            self.android_pay_cards  = [AndroidPayCard(gateway, android_pay_card) for android_pay_card in self.android_pay_cards]
            self.payment_methods += self.android_pay_cards

        if "europe_bank_accounts" in attributes:
            self.europe_bank_accounts = [EuropeBankAccount(gateway, europe_bank_account) for europe_bank_account in self.europe_bank_accounts]
            self.payment_methods += self.europe_bank_accounts

        if "coinbase_accounts" in attributes:
            self.coinbase_accounts = [CoinbaseAccount(gateway, coinbase_account) for coinbase_account in self.coinbase_accounts]
            self.payment_methods += self.coinbase_accounts
コード例 #13
0
 def find(self, customer_id, address_id):
     try:
         if customer_id is None or customer_id.strip() == "" or address_id is None or address_id.strip() == "":
             raise NotFoundError()
         response = self.config.http().get("/customers/" + customer_id + "/addresses/" + address_id)
         return Address(self.gateway, response["address"])
     except NotFoundError:
         raise NotFoundError("address for customer " + customer_id + " with id " + address_id + " not found")
コード例 #14
0
 def update(self, customer_id, address_id, params={}):
     Resource.verify_keys(params, Address.update_signature())
     response = self.config.http().put(
         "/customers/" + customer_id + "/addresses/" + address_id,
         {"address": params}
     )
     if "address" in response:
         return SuccessfulResult({"address": Address(self.gateway, response["address"])})
     elif "api_error_response" in response:
         return ErrorResult(self.gateway, response["api_error_response"])
コード例 #15
0
 def __init__(self, gateway, attributes):
     Resource.__init__(self, gateway, attributes)
     if "credit_cards" in attributes:
         self.credit_cards = [
             CreditCard(gateway, credit_card)
             for credit_card in self.credit_cards
         ]
     if "addresses" in attributes:
         self.addresses = [
             Address(gateway, address) for address in self.addresses
         ]
コード例 #16
0
    def __init__(self, attributes):
        if "billing" in attributes:
            attributes["billing_details"] = Address(attributes.pop("billing"))
        if "credit_card" in attributes:
            attributes["credit_card_details"] = CreditCard(
                attributes.pop("credit_card"))
        if "customer" in attributes:
            attributes["customer_details"] = Customer(
                attributes.pop("customer"))
        if "shipping" in attributes:
            attributes["shipping_details"] = Address(
                attributes.pop("shipping"))

        Resource.__init__(self, attributes)

        self.amount = Decimal(self.amount)
        if "status_history" in attributes:
            self.status_history = [
                StatusEvent(status_event)
                for status_event in self.status_history
            ]
コード例 #17
0
    def create(self, params={}):
        Resource.verify_keys(params, Address.create_signature())
        if not "customer_id" in params:
            raise KeyError("customer_id must be provided")
        if not re.search("\A[0-9A-Za-z_-]+\Z", params["customer_id"]):
            raise KeyError("customer_id contains invalid characters")

        response = self.config.http().post("/customers/" + params.pop("customer_id") + "/addresses", {"address": params})
        if "address" in response:
            return SuccessfulResult({"address": Address(self.gateway, response["address"])})
        elif "api_error_response" in response:
            return ErrorResult(self.gateway, response["api_error_response"])
コード例 #18
0
    def __init__(self, gateway, attributes):
        Resource.__init__(self, gateway, attributes)

        if "billing_address" in attributes:
            self.billing_address = Address(gateway, self.billing_address)
        else:
            self.billing_address = None

        if "subscriptions" in attributes:
            self.subscriptions = [
                braintree.subscription.Subscription(gateway, subscription)
                for subscription in self.subscriptions
            ]
コード例 #19
0
 def update_signature():
     return [
         "company", "email", "fax", "first_name", "id", "last_name", "phone", "website", "device_data", "device_session_id", "fraud_merchant_id", "payment_method_nonce", "default_payment_method_token",
         {"credit_card": CreditCard.signature("update_via_customer")},
         {"custom_fields": ["__any_key__"]},
         {"options": [{"paypal": [
             "payee_email",
             "order_id",
             "custom_field",
             "description",
             "amount",
             { "shipping": Address.create_signature() }
         ]}]},
     ]
コード例 #20
0
ファイル: customer.py プロジェクト: Taimoor11/ecommercesite
    def __init__(self, gateway, attributes):
        Resource.__init__(self, gateway, attributes)
        self.payment_methods = []

        if "credit_cards" in attributes:
            self.credit_cards = [CreditCard(gateway, credit_card) for credit_card in self.credit_cards]
            self.payment_methods += self.credit_cards
        if "addresses" in attributes:
            self.addresses = [Address(gateway, address) for address in self.addresses]

        if "paypal_accounts" in attributes:
            self.paypal_accounts  = [PayPalAccount(gateway, paypal_account) for paypal_account in self.paypal_accounts]
            self.payment_methods += self.paypal_accounts

        if "apple_pay_cards" in attributes:
            self.apple_pay_cards  = [ApplePayCard(gateway, apple_pay_card) for apple_pay_card in self.apple_pay_cards]
            self.payment_methods += self.apple_pay_cards

        if "android_pay_cards" in attributes:
            self.android_pay_cards  = [AndroidPayCard(gateway, android_pay_card) for android_pay_card in self.android_pay_cards]
            self.payment_methods += self.android_pay_cards

        if "amex_express_checkout_cards" in attributes:
            self.amex_express_checkout_cards  = [AmexExpressCheckoutCard(gateway, amex_express_checkout_card) for amex_express_checkout_card in self.amex_express_checkout_cards]
            self.payment_methods += self.amex_express_checkout_cards

        if "europe_bank_accounts" in attributes:
            self.europe_bank_accounts = [EuropeBankAccount(gateway, europe_bank_account) for europe_bank_account in self.europe_bank_accounts]
            self.payment_methods += self.europe_bank_accounts

        if "coinbase_accounts" in attributes:
            self.coinbase_accounts = [CoinbaseAccount(gateway, coinbase_account) for coinbase_account in self.coinbase_accounts]
            self.payment_methods += self.coinbase_accounts

        if "venmo_accounts" in attributes:
            self.venmo_accounts = [VenmoAccount(gateway, venmo_account) for venmo_account in self.venmo_accounts]
            self.payment_methods += self.venmo_accounts

        if "us_bank_accounts" in attributes:
            self.us_bank_accounts = [UsBankAccount(gateway, us_bank_account) for us_bank_account in self.us_bank_accounts]
            self.payment_methods += self.us_bank_accounts

        if "visa_checkout_cards" in attributes:
            self.visa_checkout_cards = [VisaCheckoutCard(gateway, visa_checkout_card) for visa_checkout_card in self.visa_checkout_cards]
            self.payment_methods += self.visa_checkout_cards

        if "masterpass_cards" in attributes:
            self.masterpass_cards = [MasterpassCard(gateway, masterpass_card) for masterpass_card in self.masterpass_cards]
            self.payment_methods += self.masterpass_cards
コード例 #21
0
ファイル: credit_card.py プロジェクト: mussha/dev
    def __init__(self, gateway, attributes):
        Resource.__init__(self, gateway, attributes)
        self.is_expired = self.expired
        if "billing_address" in attributes:
            self.billing_address = Address(gateway, self.billing_address)
        else:
            self.billing_address = None

        if "subscriptions" in attributes:
            self.subscriptions = [braintree.subscription.Subscription(gateway, subscription) for subscription in self.subscriptions]

        if "verifications" in attributes:
            sorted_verifications = sorted(attributes["verifications"], key=lambda verification: verification["created_at"], reverse=True)
            if len(sorted_verifications) > 0:
                self.verification = CreditCardVerification(gateway, sorted_verifications[0])
コード例 #22
0
 def signature(type):
     signature = [
         "customer_id", "payment_method_nonce", "token",
         "billing_address_id", {
             "billing_address": Address.create_signature()
         }, {
             "options": [
                 "make_default",
                 "verify_card",
                 "fail_on_duplicate_payment_method",
                 "verification_merchant_account_id",
             ]
         }
     ]
     return signature
コード例 #23
0
    def update_signature():
        three_d_secure_pass_thru = [
            "cavv",
            "ds_transaction_id",
            "eci_flag",
            "three_d_secure_version",
            "xid"
        ]

        signature = [
            "billing_address_id",
            "cardholder_name",
            "cvv",
            "device_session_id",
            "expiration_date",
            "expiration_month",
            "expiration_year",
            "number",
            "token",
            "venmo_sdk_payment_method_code",
            "device_data",
            "fraud_merchant_id",
            "payment_method_nonce",
            {
                "options": [
                    "make_default",
                    "us_bank_account_verification_method",
                    "verify_card",
                    "verification_amount",
                    "verification_merchant_account_id",
                    "verification_account_type",
                    "venmo_sdk_session",
                    {
                        "adyen": [
                            "overwrite_brand",
                            "selected_brand"
                        ]
                    }
                ]
            },
            {
                "billing_address": Address.update_signature() + [{"options": ["update_existing"]}]
            },
            {
                "three_d_secure_pass_thru": three_d_secure_pass_thru
            }
        ]
        return signature
コード例 #24
0
 def signature(type):
     signature = [
         "customer_id",
         "payment_method_nonce",
         "token",
         "billing_address_id",
         {"billing_address": Address.create_signature()},
         {"options": [
             "make_default",
             "verify_card",
             "fail_on_duplicate_payment_method",
             "verification_merchant_account_id",
             ]
         }
     ]
     return signature
コード例 #25
0
 def create_signature():
     return [
         "company",
         "email",
         "fax",
         "first_name",
         "id",
         "last_name",
         "phone",
         "website",
         "device_data",
         "payment_method_nonce",
         "device_session_id",
         "fraud_merchant_id",  # NEXT_MAJOR_VERSION remove device_session_id and fraud_merchant_id
         {
             "risk_data": [
                 "customer_browser", "customer_device_id", "customer_ip",
                 "customer_location_zip", "customer_tenure"
             ]
         },
         {
             "credit_card": CreditCard.create_signature()
         },
         {
             "custom_fields": ["__any_key__"]
         },
         {
             "three_d_secure_pass_thru": [
                 "cavv",
                 "ds_transaction_id",
                 "eci_flag",
                 "three_d_secure_version",
                 "xid",
             ]
         },
         {
             "options": [{
                 "paypal": [
                     "payee_email", "order_id", "custom_field",
                     "description", "amount", {
                         "shipping": Address.create_signature()
                     }
                 ]
             }]
         },
     ]
コード例 #26
0
    def __init__(self, gateway, attributes):
        Resource.__init__(self, gateway, attributes)
        if "credit_cards" in attributes:
            self.credit_cards = [
                CreditCard(gateway, credit_card)
                for credit_card in self.credit_cards
            ]
        if "addresses" in attributes:
            self.addresses = [
                Address(gateway, address) for address in self.addresses
            ]

        if "paypal_accounts" in attributes:
            self.paypal_accounts = [
                PayPalAccount(gateway, paypal_account)
                for paypal_account in self.paypal_accounts
            ]
コード例 #27
0
ファイル: payment_method.py プロジェクト: dkumarlinux/saleor
    def signature(type):
        options = [
            "fail_on_duplicate_payment_method", "make_default",
            "verification_merchant_account_id", "verify_card",
            "verification_amount", {
                "adyen": ["overwrite_brand", "selected_brand"]
            }
        ]

        signature = [
            "billing_address_id", "cardholder_name", "customer_id", "cvv",
            "device_data", "device_session_id", "expiration_date",
            "expiration_month", "expiration_year", "number",
            "payment_method_nonce", "token", {
                "billing_address": Address.create_signature()
            }, {
                "options": options
            }
        ]
        return signature
コード例 #28
0
    def signature(type):
        options = [
            "fail_on_duplicate_payment_method",
            "make_default",
            "verification_merchant_account_id",
            "verify_card",
            "verification_amount",
            {
                "adyen": [
                    "overwrite_brand",
                    "selected_brand"
                ]
            }
        ]

        signature = [
            "billing_address_id",
            "cardholder_name",
            "customer_id",
            "cvv",
            "device_data",
            "device_session_id",
            "expiration_date",
            "expiration_month",
            "expiration_year",
            "number",
            "payment_method_nonce",
            "token",
            {
                "billing_address": Address.create_signature()
            },
            {
                "options": options
            }
        ]
        return signature
コード例 #29
0
    def __init__(self, gateway, attributes):
        Resource.__init__(self, gateway, attributes)

        self.amount = Decimal(self.amount)
        if "tax_amount" in attributes and getattr(self, "tax_amount", None):
            self.tax_amount = Decimal(self.tax_amount)
        if "discount_amount" in attributes and getattr(self, "discount_amount",
                                                       None):
            self.discount_amount = Decimal(self.discount_amount)
        if "shipping_amount" in attributes and getattr(self, "shipping_amount",
                                                       None):
            self.shipping_amount = Decimal(self.shipping_amount)
        if "billing" in attributes:
            self.billing_details = Address(gateway, attributes.pop("billing"))
        if "credit_card" in attributes:
            self.credit_card_details = CreditCard(
                gateway, attributes.pop("credit_card"))
        if "paypal" in attributes:
            self.paypal_details = PayPalAccount(gateway,
                                                attributes.pop("paypal"))
        if "paypal_here" in attributes:
            self.paypal_here_details = PayPalHere(
                gateway, attributes.pop("paypal_here"))
        if "local_payment" in attributes:
            self.local_payment_details = LocalPayment(
                gateway, attributes.pop("local_payment"))
        if "europe_bank_account" in attributes:
            self.europe_bank_account_details = EuropeBankAccount(
                gateway, attributes.pop("europe_bank_account"))
        if "us_bank_account" in attributes:
            self.us_bank_account = UsBankAccount(
                gateway, attributes.pop("us_bank_account"))
        if "apple_pay" in attributes:
            self.apple_pay_details = ApplePayCard(gateway,
                                                  attributes.pop("apple_pay"))
        # NEXT_MAJOR_VERSION rename to google_pay_card_details
        if "android_pay_card" in attributes:
            self.android_pay_card_details = AndroidPayCard(
                gateway, attributes.pop("android_pay_card"))
        # NEXT_MAJOR_VERSION remove amex express checkout
        if "amex_express_checkout_card" in attributes:
            self.amex_express_checkout_card_details = AmexExpressCheckoutCard(
                gateway, attributes.pop("amex_express_checkout_card"))
        if "venmo_account" in attributes:
            self.venmo_account_details = VenmoAccount(
                gateway, attributes.pop("venmo_account"))
        if "visa_checkout_card" in attributes:
            self.visa_checkout_card_details = VisaCheckoutCard(
                gateway, attributes.pop("visa_checkout_card"))
        # NEXt_MAJOR_VERSION remove masterpass
        if "masterpass_card" in attributes:
            self.masterpass_card_details = MasterpassCard(
                gateway, attributes.pop("masterpass_card"))
        if "samsung_pay_card" in attributes:
            self.samsung_pay_card_details = SamsungPayCard(
                gateway, attributes.pop("samsung_pay_card"))
        if "customer" in attributes:
            self.customer_details = Customer(gateway,
                                             attributes.pop("customer"))
        if "shipping" in attributes:
            self.shipping_details = Address(gateway,
                                            attributes.pop("shipping"))
        if "add_ons" in attributes:
            self.add_ons = [AddOn(gateway, add_on) for add_on in self.add_ons]
        if "discounts" in attributes:
            self.discounts = [
                Discount(gateway, discount) for discount in self.discounts
            ]
        if "status_history" in attributes:
            self.status_history = [
                StatusEvent(gateway, status_event)
                for status_event in self.status_history
            ]
        if "subscription" in attributes:
            self.subscription_details = SubscriptionDetails(
                attributes.pop("subscription"))
        if "descriptor" in attributes:
            self.descriptor = Descriptor(gateway, attributes.pop("descriptor"))
        if "disbursement_details" in attributes:
            self.disbursement_details = DisbursementDetail(
                attributes.pop("disbursement_details"))
        if "disputes" in attributes:
            self.disputes = [Dispute(dispute) for dispute in self.disputes]
        if "authorization_adjustments" in attributes:
            self.authorization_adjustments = [
                AuthorizationAdjustment(authorization_adjustment)
                for authorization_adjustment in self.authorization_adjustments
            ]
        if "payment_instrument_type" in attributes:
            self.payment_instrument_type = attributes[
                "payment_instrument_type"]

        if "risk_data" in attributes:
            self.risk_data = RiskData(attributes["risk_data"])
        else:
            self.risk_data = None
        if "three_d_secure_info" in attributes and not attributes[
                "three_d_secure_info"] is None:
            self.three_d_secure_info = ThreeDSecureInfo(
                attributes["three_d_secure_info"])
        else:
            self.three_d_secure_info = None
        if "facilitated_details" in attributes:
            self.facilitated_details = FacilitatedDetails(
                attributes.pop("facilitated_details"))
        if "facilitator_details" in attributes:
            self.facilitator_details = FacilitatorDetails(
                attributes.pop("facilitator_details"))
        if "network_transaction_id" in attributes:
            self.network_transaction_id = attributes["network_transaction_id"]
コード例 #30
0
    def __init__(self, gateway, attributes):
        if "refund_id" in attributes:
            self._refund_id = attributes["refund_id"]
            del (attributes["refund_id"])
        else:
            self._refund_id = None

        Resource.__init__(self, gateway, attributes)

        self.amount = Decimal(self.amount)
        if "tax_amount" in attributes and self.tax_amount:
            self.tax_amount = Decimal(self.tax_amount)
        if "discount_amount" in attributes and self.discount_amount:
            self.discount_amount = Decimal(self.discount_amount)
        if "shipping_amount" in attributes and self.shipping_amount:
            self.shipping_amount = Decimal(self.shipping_amount)
        if "billing" in attributes:
            self.billing_details = Address(gateway, attributes.pop("billing"))
        if "credit_card" in attributes:
            self.credit_card_details = CreditCard(
                gateway, attributes.pop("credit_card"))
        if "paypal" in attributes:
            self.paypal_details = PayPalAccount(gateway,
                                                attributes.pop("paypal"))
        if "paypal_here" in attributes:
            self.paypal_here_details = PayPalHere(
                gateway, attributes.pop("paypal_here"))
        if "local_payment" in attributes:
            self.local_payment_details = LocalPayment(
                gateway, attributes.pop("local_payment"))
        if "europe_bank_account" in attributes:
            self.europe_bank_account_details = EuropeBankAccount(
                gateway, attributes.pop("europe_bank_account"))
        if "us_bank_account" in attributes:
            self.us_bank_account = UsBankAccount(
                gateway, attributes.pop("us_bank_account"))
        # 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.
        if "ideal_payment" in attributes:
            self.ideal_payment_details = IdealPayment(
                gateway, attributes.pop("ideal_payment"))
        if "apple_pay" in attributes:
            self.apple_pay_details = ApplePayCard(gateway,
                                                  attributes.pop("apple_pay"))
        if "coinbase_account" in attributes:
            self.coinbase_details = CoinbaseAccount(
                gateway, attributes.pop("coinbase_account"))
        if "android_pay_card" in attributes:
            self.android_pay_card_details = AndroidPayCard(
                gateway, attributes.pop("android_pay_card"))
        if "amex_express_checkout_card" in attributes:
            self.amex_express_checkout_card_details = AmexExpressCheckoutCard(
                gateway, attributes.pop("amex_express_checkout_card"))
        if "venmo_account" in attributes:
            self.venmo_account_details = VenmoAccount(
                gateway, attributes.pop("venmo_account"))
        if "visa_checkout_card" in attributes:
            self.visa_checkout_card_details = VisaCheckoutCard(
                gateway, attributes.pop("visa_checkout_card"))
        if "masterpass_card" in attributes:
            self.masterpass_card_details = MasterpassCard(
                gateway, attributes.pop("masterpass_card"))
        if "samsung_pay_card" in attributes:
            self.samsung_pay_card_details = SamsungPayCard(
                gateway, attributes.pop("samsung_pay_card"))
        if "customer" in attributes:
            self.customer_details = Customer(gateway,
                                             attributes.pop("customer"))
        if "shipping" in attributes:
            self.shipping_details = Address(gateway,
                                            attributes.pop("shipping"))
        if "add_ons" in attributes:
            self.add_ons = [AddOn(gateway, add_on) for add_on in self.add_ons]
        if "discounts" in attributes:
            self.discounts = [
                Discount(gateway, discount) for discount in self.discounts
            ]
        if "status_history" in attributes:
            self.status_history = [
                StatusEvent(gateway, status_event)
                for status_event in self.status_history
            ]
        if "subscription" in attributes:
            self.subscription_details = SubscriptionDetails(
                attributes.pop("subscription"))
        if "descriptor" in attributes:
            self.descriptor = Descriptor(gateway, attributes.pop("descriptor"))
        if "disbursement_details" in attributes:
            self.disbursement_details = DisbursementDetail(
                attributes.pop("disbursement_details"))
        if "disputes" in attributes:
            self.disputes = [Dispute(dispute) for dispute in self.disputes]
        if "authorization_adjustments" in attributes:
            self.authorization_adjustments = [
                AuthorizationAdjustment(authorization_adjustment)
                for authorization_adjustment in self.authorization_adjustments
            ]
        if "payment_instrument_type" in attributes:
            self.payment_instrument_type = attributes[
                "payment_instrument_type"]

        if "risk_data" in attributes:
            self.risk_data = RiskData(attributes["risk_data"])
        else:
            self.risk_data = None
        if "three_d_secure_info" in attributes and not attributes[
                "three_d_secure_info"] is None:
            self.three_d_secure_info = ThreeDSecureInfo(
                attributes["three_d_secure_info"])
        else:
            self.three_d_secure_info = None
        if "facilitated_details" in attributes:
            self.facilitated_details = FacilitatedDetails(
                attributes.pop("facilitated_details"))
        if "facilitator_details" in attributes:
            self.facilitator_details = FacilitatorDetails(
                attributes.pop("facilitator_details"))
        if "network_transaction_id" in attributes:
            self.network_transaction_id = attributes["network_transaction_id"]
コード例 #31
0
    def vault_billing_address(self):
        """
        The vault billing address associated with this transaction
        """

        return Address.find(self.customer_details.id, self.billing_details.id)
コード例 #32
0
ファイル: payment_method.py プロジェクト: pkandel1/ASSIG3
    def signature(type):
        options = [
            "fail_on_duplicate_payment_method",
            "make_default",
            "us_bank_account_verification_method",
            "verification_merchant_account_id",
            "verify_card",
            "verification_amount",
            "verification_account_type",
            {
                "adyen": [
                    "overwrite_brand",
                    "selected_brand"
                ]
            },
            {
                "paypal": [
                    "payee_email",
                    "order_id",
                    "custom_field",
                    "description",
                    "amount",
                    { "shipping": Address.create_signature() }
                ],
            },
        ]

        three_d_secure_pass_thru = [
            "cavv",
            "ds_transaction_id",
            "eci_flag",
            "three_d_secure_version",
            "xid"
        ]

        signature = [
            "billing_address_id",
            "cardholder_name",
            "customer_id",
            "cvv",
            "device_data",
            "expiration_date",
            "expiration_month",
            "expiration_year",
            "number",
            "payment_method_nonce",
            "paypal_refresh_token",
            "token",
            "device_session_id", # NEXT_MAJOR_VERSION remove device_session_id
            {
                "billing_address": Address.create_signature()
            },
            {
                "options": options
            },
            {
                "three_d_secure_pass_thru": three_d_secure_pass_thru
            }

        ]
        return signature
コード例 #33
0
    def vault_billing_address(self):
        """
        The vault billing address associated with this transaction
        """

        return Address.find(self.customer_details.id, self.billing_details.id)
コード例 #34
0
    def __init__(self, gateway, attributes):
        if "refund_id" in attributes:
            self._refund_id = attributes["refund_id"]
            del(attributes["refund_id"])
        else:
            self._refund_id = None

        Resource.__init__(self, gateway, attributes)

        self.amount = Decimal(self.amount)
        if self.tax_amount:
            self.tax_amount = Decimal(self.tax_amount)
        if "discount_amount" in attributes and self.discount_amount:
            self.discount_amount = Decimal(self.discount_amount)
        if "shipping_amount" in attributes and self.shipping_amount:
            self.shipping_amount = Decimal(self.shipping_amount)
        if "billing" in attributes:
            self.billing_details = Address(gateway, attributes.pop("billing"))
        if "credit_card" in attributes:
            self.credit_card_details = CreditCard(gateway, attributes.pop("credit_card"))
        if "paypal" in attributes:
            self.paypal_details = PayPalAccount(gateway, attributes.pop("paypal"))
        if "europe_bank_account" in attributes:
            self.europe_bank_account_details = EuropeBankAccount(gateway, attributes.pop("europe_bank_account"))
        if "us_bank_account" in attributes:
            self.us_bank_account = UsBankAccount(gateway, attributes.pop("us_bank_account"))
        if "ideal_payment" in attributes:
            self.ideal_payment_details = IdealPayment(gateway, attributes.pop("ideal_payment"))
        if "apple_pay" in attributes:
            self.apple_pay_details = ApplePayCard(gateway, attributes.pop("apple_pay"))
        if "coinbase_account" in attributes:
            self.coinbase_details = CoinbaseAccount(gateway, attributes.pop("coinbase_account"))
        if "android_pay_card" in attributes:
            self.android_pay_card_details = AndroidPayCard(gateway, attributes.pop("android_pay_card"))
        if "amex_express_checkout_card" in attributes:
            self.amex_express_checkout_card_details = AmexExpressCheckoutCard(gateway, attributes.pop("amex_express_checkout_card"))
        if "venmo_account" in attributes:
            self.venmo_account_details = VenmoAccount(gateway, attributes.pop("venmo_account"))
        if "visa_checkout_card" in attributes:
            self.visa_checkout_card_details = VisaCheckoutCard(gateway, attributes.pop("visa_checkout_card"))
        if "masterpass_card" in attributes:
            self.masterpass_card_details = MasterpassCard(gateway, attributes.pop("masterpass_card"))
        if "customer" in attributes:
            self.customer_details = Customer(gateway, attributes.pop("customer"))
        if "shipping" in attributes:
            self.shipping_details = Address(gateway, attributes.pop("shipping"))
        if "add_ons" in attributes:
            self.add_ons = [AddOn(gateway, add_on) for add_on in self.add_ons]
        if "discounts" in attributes:
            self.discounts = [Discount(gateway, discount) for discount in self.discounts]
        if "status_history" in attributes:
            self.status_history = [StatusEvent(gateway, status_event) for status_event in self.status_history]
        if "subscription" in attributes:
            self.subscription_details = SubscriptionDetails(attributes.pop("subscription"))
        if "descriptor" in attributes:
            self.descriptor = Descriptor(gateway, attributes.pop("descriptor"))
        if "disbursement_details" in attributes:
            self.disbursement_details = DisbursementDetail(attributes.pop("disbursement_details"))
        if "disputes" in attributes:
            self.disputes = [Dispute(dispute) for dispute in self.disputes]
        if "authorization_adjustments" in attributes:
            self.authorization_adjustments = [AuthorizationAdjustment(authorization_adjustment) for authorization_adjustment in self.authorization_adjustments]
        if "payment_instrument_type" in attributes:
            self.payment_instrument_type = attributes["payment_instrument_type"]

        if "risk_data" in attributes:
            self.risk_data = RiskData(attributes["risk_data"])
        else:
            self.risk_data = None
        if "three_d_secure_info" in attributes and not attributes["three_d_secure_info"] is None:
            self.three_d_secure_info = ThreeDSecureInfo(attributes["three_d_secure_info"])
        else:
            self.three_d_secure_info = None
        if "facilitated_details" in attributes:
            self.facilitated_details = FacilitatedDetails(attributes.pop("facilitated_details"))
        if "facilitator_details" in attributes:
            self.facilitator_details = FacilitatorDetails(attributes.pop("facilitator_details"))