コード例 #1
0
 def from_dictionary(self, dictionary):
     super(CompletePaymentCardPaymentMethodSpecificInput,
           self).from_dictionary(dictionary)
     if 'card' in dictionary:
         if not isinstance(dictionary['card'], dict):
             raise TypeError('value \'{}\' is not a dictionary'.format(
                 dictionary['card']))
         value = CardWithoutCvv()
         self.card = value.from_dictionary(dictionary['card'])
     return self
コード例 #2
0
 def from_dictionary(self, dictionary):
     super(TokenCardData, self).from_dictionary(dictionary)
     if 'cardWithoutCvv' in dictionary:
         if not isinstance(dictionary['cardWithoutCvv'], dict):
             raise TypeError('value \'{}\' is not a dictionary'.format(
                 dictionary['cardWithoutCvv']))
         value = CardWithoutCvv()
         self.card_without_cvv = value.from_dictionary(
             dictionary['cardWithoutCvv'])
     if 'firstTransactionDate' in dictionary:
         self.first_transaction_date = dictionary['firstTransactionDate']
     if 'providerReference' in dictionary:
         self.provider_reference = dictionary['providerReference']
     return self
    def example(self):
        with self.__get_client() as client:
            card = CardWithoutCvv()
            card.card_number = "67030000000000003"
            card.cardholder_name = "Wile E. Coyote"
            card.expiry_date = "1299"

            card_payment_method_specific_input = CompletePaymentCardPaymentMethodSpecificInput(
            )
            card_payment_method_specific_input.card = card

            body = CompletePaymentRequest()
            body.card_payment_method_specific_input = card_payment_method_specific_input

            response = client.merchant("merchantId").payments().complete(
                "paymentId", body)
コード例 #4
0
    def test_token(self):
        billing_address = Address()
        billing_address.country_code = "NL"
        customer = CustomerToken()
        customer.billing_address = billing_address
        card_without_ccv = CardWithoutCvv()
        card_without_ccv.cardholder_name = "Jan"
        card_without_ccv.issue_number = "12"
        card_without_ccv.card_number = "4567350000427977"
        card_without_ccv.expiry_date = "0820"
        card_data = TokenCardData()
        card_data.card_without_cvv = card_without_ccv
        card = TokenCard()
        card.customer = customer
        card.data = card_data
        create_token_request = CreateTokenRequest()
        create_token_request.payment_product_id = 1
        create_token_request.card = card

        with init_utils.create_client() as client:
            token_response = client.merchant(MERCHANT_ID).tokens().create(
                create_token_request)

            self.assertIsNotNone(token_response.token)

            client.merchant(MERCHANT_ID).tokens().delete(
                token_response.token, DeleteTokenParams())
コード例 #5
0
    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)