def example(self):
        with self.__get_client() as client:
            amount_of_money = AmountOfMoney()
            amount_of_money.amount = 2345
            amount_of_money.currency_code = "EUR"

            bank_account_iban = BankAccountIban()
            bank_account_iban.account_holder_name = "Wile E. Coyote"
            bank_account_iban.iban = "IT60X0542811101000000123456"

            address = Address()
            address.city = "Burbank"
            address.country_code = "US"
            address.house_number = "411"
            address.state = "California"
            address.street = "N Hollywood Way"
            address.zip = "91505"

            company_information = CompanyInformation()
            company_information.name = "Acme Labs"

            contact_details = ContactDetailsBase()
            contact_details.email_address = "*****@*****.**"

            name = PersonalName()
            name.first_name = "Wile"
            name.surname = "Coyote"
            name.surname_prefix = "E."
            name.title = "Mr."

            customer = PayoutCustomer()
            customer.address = address
            customer.company_information = company_information
            customer.contact_details = contact_details
            customer.name = name

            bank_transfer_payout_method_specific_input = BankTransferPayoutMethodSpecificInput()
            bank_transfer_payout_method_specific_input.bank_account_iban = bank_account_iban
            bank_transfer_payout_method_specific_input.customer = customer
            bank_transfer_payout_method_specific_input.payout_date = "20150102"
            bank_transfer_payout_method_specific_input.payout_text = "Payout Acme"
            bank_transfer_payout_method_specific_input.swift_code = "swift"

            references = PayoutReferences()
            references.merchant_reference = "AcmeOrder001"

            body = CreatePayoutRequest()
            body.amount_of_money = amount_of_money
            body.bank_transfer_payout_method_specific_input = bank_transfer_payout_method_specific_input
            body.references = references

            try:
                response = client.merchant("merchantId").payouts().create(body)
            except DeclinedPayoutException as e:
                self.handle_declined_payout(e.payout_result)
            except ApiException as e:
                self.handle_api_errors(e.errors)
Ejemplo n.º 2
0
    def example(self):
        with self.__get_client() as client:
            billing_address = Address()
            billing_address.additional_info = "Suite II"
            billing_address.city = "Monument Valley"
            billing_address.country_code = "US"
            billing_address.house_number = "1"
            billing_address.state = "Utah"
            billing_address.street = "Desertroad"
            billing_address.zip = "84536"

            company_information = CompanyInformation()
            company_information.name = "Acme Labs"

            name = PersonalNameToken()
            name.first_name = "Wile"
            name.surname = "Coyote"
            name.surname_prefix = "E."

            personal_information = PersonalInformationToken()
            personal_information.name = name

            customer = CustomerToken()
            customer.billing_address = billing_address
            customer.company_information = company_information
            customer.merchant_customer_id = "1234"
            customer.personal_information = personal_information

            bank_account_bban = BankAccountBban()
            bank_account_bban.account_number = "000000123456"
            bank_account_bban.bank_code = "05428"
            bank_account_bban.branch_code = "11101"
            bank_account_bban.check_digit = "X"
            bank_account_bban.country_code = "IT"

            payment_product705_specific_data = TokenNonSepaDirectDebitPaymentProduct705SpecificData(
            )
            payment_product705_specific_data.authorisation_id = "123456"
            payment_product705_specific_data.bank_account_bban = bank_account_bban

            mandate = MandateNonSepaDirectDebit()
            mandate.payment_product705_specific_data = payment_product705_specific_data

            non_sepa_direct_debit = TokenNonSepaDirectDebit()
            non_sepa_direct_debit.customer = customer
            non_sepa_direct_debit.mandate = mandate

            body = CreateTokenRequest()
            body.non_sepa_direct_debit = non_sepa_direct_debit
            body.payment_product_id = 705

            response = client.merchant("merchantId").tokens().create(body)
Ejemplo n.º 3
0
 def from_dictionary(self, dictionary):
     super(CustomerBase, self).from_dictionary(dictionary)
     if 'companyInformation' in dictionary:
         if not isinstance(dictionary['companyInformation'], dict):
             raise TypeError('value \'{}\' is not a dictionary'.format(
                 dictionary['companyInformation']))
         value = CompanyInformation()
         self.company_information = value.from_dictionary(
             dictionary['companyInformation'])
     if 'merchantCustomerId' in dictionary:
         self.merchant_customer_id = dictionary['merchantCustomerId']
     if 'vatNumber' in dictionary:
         self.vat_number = dictionary['vatNumber']
     return self
Ejemplo n.º 4
0
 def from_dictionary(self, dictionary):
     super(PayoutCustomer, self).from_dictionary(dictionary)
     if 'address' in dictionary:
         if not isinstance(dictionary['address'], dict):
             raise TypeError('value \'{}\' is not a dictionary'.format(
                 dictionary['address']))
         value = Address()
         self.address = value.from_dictionary(dictionary['address'])
     if 'companyInformation' in dictionary:
         if not isinstance(dictionary['companyInformation'], dict):
             raise TypeError('value \'{}\' is not a dictionary'.format(
                 dictionary['companyInformation']))
         value = CompanyInformation()
         self.company_information = value.from_dictionary(
             dictionary['companyInformation'])
     if 'contactDetails' in dictionary:
         if not isinstance(dictionary['contactDetails'], dict):
             raise TypeError('value \'{}\' is not a dictionary'.format(
                 dictionary['contactDetails']))
         value = ContactDetailsBase()
         self.contact_details = value.from_dictionary(
             dictionary['contactDetails'])
     if 'merchantCustomerId' in dictionary:
         self.merchant_customer_id = dictionary['merchantCustomerId']
     if 'name' in dictionary:
         if not isinstance(dictionary['name'], dict):
             raise TypeError('value \'{}\' is not a dictionary'.format(
                 dictionary['name']))
         value = PersonalName()
         self.name = value.from_dictionary(dictionary['name'])
     return self
Ejemplo n.º 5
0
 def from_dictionary(self, dictionary):
     super(RefundCustomer, self).from_dictionary(dictionary)
     if 'address' in dictionary:
         if not isinstance(dictionary['address'], dict):
             raise TypeError('value \'{}\' is not a dictionary'.format(
                 dictionary['address']))
         value = AddressPersonal()
         self.address = value.from_dictionary(dictionary['address'])
     if 'companyInformation' in dictionary:
         if not isinstance(dictionary['companyInformation'], dict):
             raise TypeError('value \'{}\' is not a dictionary'.format(
                 dictionary['companyInformation']))
         value = CompanyInformation()
         self.company_information = value.from_dictionary(
             dictionary['companyInformation'])
     if 'contactDetails' in dictionary:
         if not isinstance(dictionary['contactDetails'], dict):
             raise TypeError('value \'{}\' is not a dictionary'.format(
                 dictionary['contactDetails']))
         value = ContactDetailsBase()
         self.contact_details = value.from_dictionary(
             dictionary['contactDetails'])
     if 'fiscalNumber' in dictionary:
         self.fiscal_number = dictionary['fiscalNumber']
     return self
    def example(self):
        with self.__get_client() as client:
            billing_address = Address()
            billing_address.additional_info = "b"
            billing_address.city = "Monument Valley"
            billing_address.country_code = "US"
            billing_address.house_number = "13"
            billing_address.state = "Utah"
            billing_address.street = "Desertroad"
            billing_address.zip = "84536"

            company_information = CompanyInformation()
            company_information.name = "Acme Labs"

            name = PersonalNameToken()
            name.first_name = "Wile"
            name.surname = "Coyote"
            name.surname_prefix = "E."

            personal_information = PersonalInformationToken()
            personal_information.name = name

            customer = CustomerToken()
            customer.billing_address = billing_address
            customer.company_information = company_information
            customer.merchant_customer_id = "1234"
            customer.personal_information = personal_information

            card_without_cvv = CardWithoutCvv()
            card_without_cvv.card_number = "4567350000427977"
            card_without_cvv.cardholder_name = "Wile E. Coyote"
            card_without_cvv.expiry_date = "1299"
            card_without_cvv.issue_number = "12"

            data = TokenCardData()
            data.card_without_cvv = card_without_cvv

            card = TokenCard()
            card.customer = customer
            card.data = data

            body = UpdateTokenRequest()
            body.card = card
            body.payment_product_id = 1

            client.merchant("merchantId").tokens().update("tokenId", body)
Ejemplo n.º 7
0
    def example(self):
        with self.__get_client() as client:
            card = Card()
            card.card_number = "4567350000427977"
            card.cardholder_name = "Wile E. Coyote"
            card.cvv = "123"
            card.expiry_date = "1299"

            authentication_amount = AmountOfMoney()
            authentication_amount.amount = 2980
            authentication_amount.currency_code = "EUR"

            redirection_data = RedirectionData()
            redirection_data.return_url = "https://hostname.myownwebsite.url"

            three_d_secure = ThreeDSecure()
            three_d_secure.authentication_amount = authentication_amount
            three_d_secure.authentication_flow = "browser"
            three_d_secure.challenge_canvas_size = "600x400"
            three_d_secure.challenge_indicator = "challenge-requested"
            three_d_secure.exemption_request = "none"
            three_d_secure.redirection_data = redirection_data
            three_d_secure.skip_authentication = False

            card_payment_method_specific_input = CardPaymentMethodSpecificInput(
            )
            card_payment_method_specific_input.card = card
            card_payment_method_specific_input.is_recurring = False
            card_payment_method_specific_input.merchant_initiated_reason_indicator = "delayedCharges"
            card_payment_method_specific_input.payment_product_id = 1
            card_payment_method_specific_input.three_d_secure = three_d_secure
            card_payment_method_specific_input.transaction_channel = "ECOMMERCE"

            amount_of_money = AmountOfMoney()
            amount_of_money.amount = 2980
            amount_of_money.currency_code = "EUR"

            billing_address = Address()
            billing_address.additional_info = "b"
            billing_address.city = "Monument Valley"
            billing_address.country_code = "US"
            billing_address.house_number = "13"
            billing_address.state = "Utah"
            billing_address.street = "Desertroad"
            billing_address.zip = "84536"

            company_information = CompanyInformation()
            company_information.name = "Acme Labs"
            company_information.vat_number = "1234AB5678CD"

            contact_details = ContactDetails()
            contact_details.email_address = "*****@*****.**"
            contact_details.fax_number = "+1234567891"
            contact_details.phone_number = "+1234567890"

            browser_data = BrowserData()
            browser_data.color_depth = 24
            browser_data.java_enabled = False
            browser_data.screen_height = "1200"
            browser_data.screen_width = "1920"

            device = CustomerDevice()
            device.accept_header = "texthtml,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
            device.browser_data = browser_data
            device.ip_address = "123.123.123.123"
            device.locale = "en-US"
            device.timezone_offset_utc_minutes = "420"
            device.user_agent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15"

            name = PersonalName()
            name.first_name = "Wile"
            name.surname = "Coyote"
            name.surname_prefix = "E."
            name.title = "Mr."

            personal_information = PersonalInformation()
            personal_information.date_of_birth = "19490917"
            personal_information.gender = "male"
            personal_information.name = name

            customer = Customer()
            customer.account_type = "none"
            customer.billing_address = billing_address
            customer.company_information = company_information
            customer.contact_details = contact_details
            customer.device = device
            customer.locale = "en_US"
            customer.merchant_customer_id = "1234"
            customer.personal_information = personal_information

            invoice_data = OrderInvoiceData()
            invoice_data.invoice_date = "20140306191500"
            invoice_data.invoice_number = "000000123"

            references = OrderReferences()
            references.descriptor = "Fast and Furry-ous"
            references.invoice_data = invoice_data
            references.merchant_order_id = 123456
            references.merchant_reference = "AcmeOrder0001"

            shipping_name = PersonalName()
            shipping_name.first_name = "Road"
            shipping_name.surname = "Runner"
            shipping_name.title = "Miss"

            address = AddressPersonal()
            address.additional_info = "Suite II"
            address.city = "Monument Valley"
            address.country_code = "US"
            address.house_number = "1"
            address.name = shipping_name
            address.state = "Utah"
            address.street = "Desertroad"
            address.zip = "84536"

            shipping = Shipping()
            shipping.address = address

            items = []

            item1_amount_of_money = AmountOfMoney()
            item1_amount_of_money.amount = 2500
            item1_amount_of_money.currency_code = "EUR"

            item1_invoice_data = LineItemInvoiceData()
            item1_invoice_data.description = "ACME Super Outfit"
            item1_invoice_data.nr_of_items = "1"
            item1_invoice_data.price_per_item = 2500

            item1 = LineItem()
            item1.amount_of_money = item1_amount_of_money
            item1.invoice_data = item1_invoice_data

            items.append(item1)

            item2_amount_of_money = AmountOfMoney()
            item2_amount_of_money.amount = 480
            item2_amount_of_money.currency_code = "EUR"

            item2_invoice_data = LineItemInvoiceData()
            item2_invoice_data.description = "Aspirin"
            item2_invoice_data.nr_of_items = "12"
            item2_invoice_data.price_per_item = 40

            item2 = LineItem()
            item2.amount_of_money = item2_amount_of_money
            item2.invoice_data = item2_invoice_data

            items.append(item2)

            shopping_cart = ShoppingCart()
            shopping_cart.items = items

            order = Order()
            order.amount_of_money = amount_of_money
            order.customer = customer
            order.references = references
            order.shipping = shipping
            order.shopping_cart = shopping_cart

            body = CreatePaymentRequest()
            body.card_payment_method_specific_input = card_payment_method_specific_input
            body.order = order

            try:
                response = client.merchant("merchantId").payments().create(
                    body)
            except DeclinedPaymentException as e:
                self.handle_declined_payment(e.create_payment_result)
            except ApiException as e:
                self.handle_api_errors(e.errors)