|
| 1 | +from authorizenet import apicontractsv1 |
| 2 | +from authorizenet.apicontrollers import * |
| 3 | + |
| 4 | +merchantAuth = apicontractsv1.merchantAuthenticationType() |
| 5 | +merchantAuth.name = '5KP3u95bQpv' |
| 6 | +merchantAuth.transactionKey = '4Ktq966gC55GAX7S' |
| 7 | + |
| 8 | +creditCard = apicontractsv1.creditCardType() |
| 9 | +creditCard.cardNumber = "4111111111111111" |
| 10 | +creditCard.expirationDate = "2020-12" |
| 11 | + |
| 12 | +payment = apicontractsv1.paymentType() |
| 13 | +payment.creditCard = creditCard |
| 14 | + |
| 15 | +paymentProfile = apicontractsv1.customerPaymentProfileExType() |
| 16 | +paymentProfile.billTo = apicontractsv1.customerAddressType() |
| 17 | +paymentProfile.billTo.firstName = "John" |
| 18 | +paymentProfile.billTo.lastName = "Doe" |
| 19 | +paymentProfile.billTo.address = "123 Main St." |
| 20 | +paymentProfile.billTo.city = "Bellevue" |
| 21 | +paymentProfile.billTo.state = "WA" |
| 22 | +paymentProfile.billTo.zip = "98004" |
| 23 | +paymentProfile.billTo.country = "USA" |
| 24 | +paymentProfile.billTo.phoneNumber = "000-000-000" |
| 25 | +paymentProfile.payment = payment |
| 26 | +paymentProfile.customerPaymentProfileId = "34823065" |
| 27 | + |
| 28 | +updateCustomerPaymentProfile = apicontractsv1.updateCustomerPaymentProfileRequest() |
| 29 | +updateCustomerPaymentProfile.merchantAuthentication = merchantAuth |
| 30 | +updateCustomerPaymentProfile.paymentProfile = paymentProfile |
| 31 | +updateCustomerPaymentProfile.customerProfileId = "36731856" |
| 32 | +updateCustomerPaymentProfile.validationMode = apicontractsv1.validationModeEnum.liveMode |
| 33 | + |
| 34 | +updateCustomerPaymentProfileController = updateCustomerPaymentProfileController(updateCustomerPaymentProfile) |
| 35 | +updateCustomerPaymentProfileController.execute() |
| 36 | + |
| 37 | +response = updateCustomerPaymentProfileController.getresponse() |
| 38 | + |
| 39 | +if (response.messages.resultCode=="Ok"): |
| 40 | + print "Successfully updated customer payment profile with id %s" % updateCustomerPaymentProfile.paymentProfile.customerPaymentProfileId |
| 41 | +else: |
| 42 | + print response.messages.message[0].text |
| 43 | + print "Failed to update customer with customer payment profile id %s" % updateCustomerPaymentProfile.paymentProfile.customerPaymentProfileId |
0 commit comments