From 918c133b2e0d2c3ef5fb7c3e6696b446e2cb0dbf Mon Sep 17 00:00:00 2001 From: danielatdattrixdotcom Date: Mon, 18 Jul 2016 12:33:56 -0700 Subject: [PATCH] Update response messages to use indexes and not properties. --- .../create-an-apple-pay-transaction.py | 8 ++++---- .../create-customer-payment-profile.py | 8 ++++---- ...create-customer-profile-from-transaction.py | 10 +++++----- CustomerProfiles/create-customer-profile.py | 2 +- .../create-customer-shipping-address.py | 8 ++++---- .../delete-customer-payment-profile.py | 2 +- CustomerProfiles/delete-customer-profile.py | 2 +- .../delete-customer-shipping-address.py | 8 ++++---- .../get-customer-shipping-address.py | 8 ++++---- CustomerProfiles/get-hosted-profile-page.py | 8 ++++---- .../update-customer-payment-profile.py | 4 ++-- CustomerProfiles/update-customer-profile.py | 4 ++-- .../update-customer-shipping-address.py | 10 +++++----- .../validate-customer-payment-profile.py | 6 +++--- .../charge-tokenized-credit-card.py | 10 +++++----- PaymentTransactions/credit-bank-account.py | 4 ++-- PaymentTransactions/refund-transaction.py | 6 +++--- .../update-split-tender-group.py | 6 +++--- .../authorization-and-capture-continue.py | 8 ++++---- .../authorization-and-capture.py | 8 ++++---- .../authorization-only-continued.py | 10 +++++----- PaypalExpressCheckout/authorization-only.py | 8 ++++---- PaypalExpressCheckout/credit.py | 10 +++++----- PaypalExpressCheckout/get-details.py | 10 +++++----- .../prior-authorization-capture.py | 10 +++++----- PaypalExpressCheckout/void.py | 10 +++++----- RecurringBilling/cancel-subscription.py | 10 +++++----- ...reate-subscription-from-customer-profile.py | 18 +++++++++--------- RecurringBilling/create-subscription.py | 10 +++++----- RecurringBilling/get-list-of-subscription.py | 10 +++++----- RecurringBilling/get-subscription-status.py | 12 ++++++------ RecurringBilling/update-subscription.py | 10 +++++----- TransactionReporting/get-batch-statistics.py | 6 +++--- TransactionReporting/get-settled-batch-list.py | 12 ++++++------ .../get-transaction-details.py | 8 ++++---- TransactionReporting/get-transaction-list.py | 8 ++++---- .../get-unsettled-transaction-list.py | 8 ++++---- .../create-visa-checkout-transaction.py | 4 ++-- VisaCheckout/decrypt-visa-checkout-data.py | 10 +++++----- 39 files changed, 157 insertions(+), 157 deletions(-) diff --git a/ApplePayTransactions/create-an-apple-pay-transaction.py b/ApplePayTransactions/create-an-apple-pay-transaction.py index 09211a4..4dade0e 100644 --- a/ApplePayTransactions/create-an-apple-pay-transaction.py +++ b/ApplePayTransactions/create-an-apple-pay-transaction.py @@ -36,14 +36,14 @@ def create_an_apple_pay_transaction(): if (response.messages.resultCode=="Ok"): print "SUCCESS" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text print "AUTH Code : %s" % response.authCode print "Transaction ID : %s" % response.transId else: print "ERROR" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text return response diff --git a/CustomerProfiles/create-customer-payment-profile.py b/CustomerProfiles/create-customer-payment-profile.py index 06e2f29..a7e9352 100644 --- a/CustomerProfiles/create-customer-payment-profile.py +++ b/CustomerProfiles/create-customer-payment-profile.py @@ -20,11 +20,11 @@ def create_customer_payment_profile(customerProfileId): billTo = apicontractsv1.customerAddressType() billTo.firstName = "John" billTo.lastName = "Snow" - + profile = apicontractsv1.customerPaymentProfileType() profile.payment = payment profile.billTo = billTo - + createCustomerPaymentProfile = apicontractsv1.createCustomerPaymentProfileRequest() createCustomerPaymentProfile.merchantAuthentication = merchantAuth createCustomerPaymentProfile.paymentProfile = profile @@ -39,9 +39,9 @@ def create_customer_payment_profile(customerProfileId): if (response.messages.resultCode=="Ok"): print "Successfully created a customer payment profile with id: %s" % response.customerPaymentProfileId else: - print "Failed to create customer payment profile %s" % response.messages.message[0].text + print "Failed to create customer payment profile %s" % response.messages.message[0]['text'].text return response if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]): - create_customer_payment_profile(constants.customerProfileId) \ No newline at end of file + create_customer_payment_profile(constants.customerProfileId) diff --git a/CustomerProfiles/create-customer-profile-from-transaction.py b/CustomerProfiles/create-customer-profile-from-transaction.py index cda85ea..a1442e3 100644 --- a/CustomerProfiles/create-customer-profile-from-transaction.py +++ b/CustomerProfiles/create-customer-profile-from-transaction.py @@ -20,10 +20,10 @@ def create_customer_profile_from_transaction(transactionId): createCustomerProfileFromTransaction.transId = transactionId #You can either specify the customer information in form of customerProfileBaseType object createCustomerProfileFromTransaction.customer = profile - # OR + # OR # You can just provide the customer Profile ID - # createCustomerProfileFromTransaction.customerProfileId = "123343" - + # createCustomerProfileFromTransaction.customerProfileId = "123343" + controller = createCustomerProfileFromTransactionController(createCustomerProfileFromTransaction) controller.execute() @@ -32,9 +32,9 @@ def create_customer_profile_from_transaction(transactionId): if (response.messages.resultCode=="Ok"): print "Successfully created a customer profile with id: %s from transaction id: %s" % (response.customerProfileId, createCustomerProfileFromTransaction.transId) else: - print "Failed to create customer payment profile from transaction %s" % response.messages.message[0].text + print "Failed to create customer payment profile from transaction %s" % response.messages.message[0]['text'].text return response if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]): - create_customer_profile_from_transaction(constants.transactionId) \ No newline at end of file + create_customer_profile_from_transaction(constants.transactionId) diff --git a/CustomerProfiles/create-customer-profile.py b/CustomerProfiles/create-customer-profile.py index a573747..c7d3d22 100644 --- a/CustomerProfiles/create-customer-profile.py +++ b/CustomerProfiles/create-customer-profile.py @@ -25,7 +25,7 @@ def create_customer_profile(): if (response.messages.resultCode=="Ok"): print "Successfully created a customer profile with id: %s" % response.customerProfileId else: - print "Failed to create customer payment profile %s" % response.messages.message[0].text + print "Failed to create customer payment profile %s" % response.messages.message[0]['text'].text return response diff --git a/CustomerProfiles/create-customer-shipping-address.py b/CustomerProfiles/create-customer-shipping-address.py index 0b3d52c..68698d9 100644 --- a/CustomerProfiles/create-customer-shipping-address.py +++ b/CustomerProfiles/create-customer-shipping-address.py @@ -36,14 +36,14 @@ def create_customer_shipping_address(customerProfileId): if response.messages.resultCode == "Ok": print "SUCCESS" - print "Transaction ID : %s " % response.messages.message[0].text + print "Transaction ID : %s " % response.messages.message[0]['text'].text print "Customer address id : %s" % response.customerAddressId else: print "ERROR" - print "Message code : %s " % response.messages.message[0].code - print "Message text : %s " % response.messages.message[0].text + print "Message code : %s " % response.messages.message[0]['code'].text + print "Message text : %s " % response.messages.message[0]['text'].text return response if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]): - create_customer_shipping_address(constants.customerProfileId) \ No newline at end of file + create_customer_shipping_address(constants.customerProfileId) diff --git a/CustomerProfiles/delete-customer-payment-profile.py b/CustomerProfiles/delete-customer-payment-profile.py index 30d26ae..3b63a5b 100644 --- a/CustomerProfiles/delete-customer-payment-profile.py +++ b/CustomerProfiles/delete-customer-payment-profile.py @@ -23,7 +23,7 @@ def delete_customer_payment_profile(customerProfileId, customerPaymentProfileId) if (response.messages.resultCode=="Ok"): print "Successfully deleted customer payment profile with customer profile id %s" % deleteCustomerPaymentProfile.customerProfileId else: - print response.messages.message[0].text + print response.messages.message[0]['text'].text print "Failed to delete customer paymnet profile with customer profile id %s" % deleteCustomerPaymentProfile.customerProfileId return response diff --git a/CustomerProfiles/delete-customer-profile.py b/CustomerProfiles/delete-customer-profile.py index 0e5aa07..858bcae 100644 --- a/CustomerProfiles/delete-customer-profile.py +++ b/CustomerProfiles/delete-customer-profile.py @@ -22,7 +22,7 @@ def delete_customer_profile(customerProfileId): if (response.messages.resultCode=="Ok"): print "Successfully deleted customer with customer profile id %s" % deleteCustomerProfile.customerProfileId else: - print response.messages.message[0].text + print response.messages.message[0]['text'].text print "Failed to delete customer profile with customer profile id %s" % deleteCustomerProfile.customerProfileId return response diff --git a/CustomerProfiles/delete-customer-shipping-address.py b/CustomerProfiles/delete-customer-shipping-address.py index 1684934..22e4bd5 100644 --- a/CustomerProfiles/delete-customer-shipping-address.py +++ b/CustomerProfiles/delete-customer-shipping-address.py @@ -25,12 +25,12 @@ def delete_customer_shipping_address(customerProfileId, customerProfileShippingI if response.messages.resultCode == "Ok": print "SUCCESS" - print "Message code : %s " % response.messages.message[0].code - print "Message text : %s " % response.messages.message[0].text + print "Message code : %s " % response.messages.message[0]['code'].text + print "Message text : %s " % response.messages.message[0]['text'].text else: print "ERROR" - print "Message code : %s " % response.messages.message[0].code - print "Message text : %s " % response.messages.message[0].text + print "Message code : %s " % response.messages.message[0]['code'].text + print "Message text : %s " % response.messages.message[0]['text'].text return response diff --git a/CustomerProfiles/get-customer-shipping-address.py b/CustomerProfiles/get-customer-shipping-address.py index 785ade3..01f55bd 100644 --- a/CustomerProfiles/get-customer-shipping-address.py +++ b/CustomerProfiles/get-customer-shipping-address.py @@ -34,7 +34,7 @@ def get_customer_shipping_address(customerProfileId, customerAddressId): print response.address.country if not hasattr(response, 'subscriptionIds'): print ("no subscriptionIds attr in response") - else: + else: if hasattr(response, 'subscriptionIds') == True: if hasattr(response.subscriptionIds, 'subscriptionId') == True: print "list of subscriptionid:" @@ -42,10 +42,10 @@ def get_customer_shipping_address(customerProfileId, customerAddressId): print subscriptionid else: print "ERROR" - print "Message code : %s " % response.messages.message[0].code - print "Message text : %s " % response.messages.message[0].text + print "Message code : %s " % response.messages.message[0]['code'].text + print "Message text : %s " % response.messages.message[0]['text'].text return response if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]): - get_customer_shipping_address(constants.customerProfileId, constants.customerProfileShippingId) \ No newline at end of file + get_customer_shipping_address(constants.customerProfileId, constants.customerProfileShippingId) diff --git a/CustomerProfiles/get-hosted-profile-page.py b/CustomerProfiles/get-hosted-profile-page.py index 5236c2d..36ace82 100644 --- a/CustomerProfiles/get-hosted-profile-page.py +++ b/CustomerProfiles/get-hosted-profile-page.py @@ -36,13 +36,13 @@ def get_hosted_profile_page(customerProfileId): print('Token : %s' % profilePageResponse.token) if profilePageResponse.messages: - print('Message Code : %s' % profilePageResponse.messages.message[0].code) - print('Message Text : %s' % profilePageResponse.messages.message[0].text) + print('Message Code : %s' % profilePageResponse.messages.message[0]['code'].text) + print('Message Text : %s' % profilePageResponse.messages.message[0]['text'].text) else: if profilePageResponse.messages: - print('Failed to get batch statistics.\nCode:%s \nText:%s' % (profilePageResponse.messages.message[0].code,profilePageResponse.messages.message[0].text)) + print('Failed to get batch statistics.\nCode:%s \nText:%s' % (profilePageResponse.messages.message[0]['code'].text,profilePageResponse.messages.message[0]['text'].text)) return profilePageResponse if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]): - get_hosted_profile_page(constants.customerProfileId) \ No newline at end of file + get_hosted_profile_page(constants.customerProfileId) diff --git a/CustomerProfiles/update-customer-payment-profile.py b/CustomerProfiles/update-customer-payment-profile.py index ac38e82..a0fbcbe 100644 --- a/CustomerProfiles/update-customer-payment-profile.py +++ b/CustomerProfiles/update-customer-payment-profile.py @@ -44,10 +44,10 @@ def update_customer_payment_profile(customerProfileId, customerPaymentProfileId) if (response.messages.resultCode=="Ok"): print "Successfully updated customer payment profile with id %s" % updateCustomerPaymentProfile.paymentProfile.customerPaymentProfileId else: - print response.messages.message[0].text + print response.messages.message[0]['text'].text print "Failed to update customer with customer payment profile id %s" % updateCustomerPaymentProfile.paymentProfile.customerPaymentProfileId return response if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]): - update_customer_payment_profile(constants.customerProfileId, constants.customerPaymentProfileId) \ No newline at end of file + update_customer_payment_profile(constants.customerProfileId, constants.customerPaymentProfileId) diff --git a/CustomerProfiles/update-customer-profile.py b/CustomerProfiles/update-customer-profile.py index 4946406..ee78f9f 100644 --- a/CustomerProfiles/update-customer-profile.py +++ b/CustomerProfiles/update-customer-profile.py @@ -27,10 +27,10 @@ def update_customer_profile(customerProfileId): if (response.messages.resultCode=="Ok"): print "Successfully updated customer with customer profile id %s" % updateCustomerProfile.profile.customerProfileId else: - print response.messages.message[0].text + print response.messages.message[0]['text'].text print "Failed to update customer profile with customer profile id %s" % updateCustomerProfile.profile.customerProfileId return response if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]): - update_customer_profile(constants.customerProfileId) \ No newline at end of file + update_customer_profile(constants.customerProfileId) diff --git a/CustomerProfiles/update-customer-shipping-address.py b/CustomerProfiles/update-customer-shipping-address.py index 6627117..db2446c 100644 --- a/CustomerProfiles/update-customer-shipping-address.py +++ b/CustomerProfiles/update-customer-shipping-address.py @@ -36,14 +36,14 @@ def update_customer_shipping_address(customerProfileId, customerAddressId): if response.messages.resultCode == "Ok": print "SUCCESS" - print "Message code : %s " % response.messages.message[0].code - print "Message text : %s " % response.messages.message[0].text + print "Message code : %s " % response.messages.message[0]['code'].text + print "Message text : %s " % response.messages.message[0]['text'].text else: print "ERROR" - print "Message code : %s " % response.messages.message[0].code - print "Message text : %s " % response.messages.message[0].text + print "Message code : %s " % response.messages.message[0]['code'].text + print "Message text : %s " % response.messages.message[0]['text'].text return response if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]): - update_customer_shipping_address(constants.customerProfileId, constants.customerProfileShippingId) \ No newline at end of file + update_customer_shipping_address(constants.customerProfileId, constants.customerProfileShippingId) diff --git a/CustomerProfiles/validate-customer-payment-profile.py b/CustomerProfiles/validate-customer-payment-profile.py index 25a9eb2..5f29f97 100644 --- a/CustomerProfiles/validate-customer-payment-profile.py +++ b/CustomerProfiles/validate-customer-payment-profile.py @@ -22,12 +22,12 @@ def validate_customer_payment_profile(customerProfileId, customerPaymentProfileI response = validateCustomerPaymentProfileCntrlr.getresponse() if (response.messages.resultCode=="Ok"): - print response.messages.message[0].text + print response.messages.message[0]['text'].text else: print "ERROR : Validate Customer Payment Profile: Invalid response" - print "response code: %s %s" % {response.messages.message[0].code, response.messages.message[0].text} + print "response code: %s %s" % {response.messages.message[0]['code'].text, response.messages.message[0]['text'].text} return response if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]): - validate_customer_payment_profile(constants.customerProfileId, constants.customerPaymentProfileId) \ No newline at end of file + validate_customer_payment_profile(constants.customerProfileId, constants.customerPaymentProfileId) diff --git a/PaymentTransactions/charge-tokenized-credit-card.py b/PaymentTransactions/charge-tokenized-credit-card.py index b68b63c..a3ece7a 100644 --- a/PaymentTransactions/charge-tokenized-credit-card.py +++ b/PaymentTransactions/charge-tokenized-credit-card.py @@ -36,15 +36,15 @@ def charge_tokenized_credit_card(): if (response.messages.resultCode=="Ok"): print "SUCCESS" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text print "Transaction ID : %s" % response.transactionResponse.transId else: print "ERROR" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text return response if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]): - charge_tokenized_credit_card() \ No newline at end of file + charge_tokenized_credit_card() diff --git a/PaymentTransactions/credit-bank-account.py b/PaymentTransactions/credit-bank-account.py index 93e3607..b6922da 100644 --- a/PaymentTransactions/credit-bank-account.py +++ b/PaymentTransactions/credit-bank-account.py @@ -44,9 +44,9 @@ def credit_bank_account(): print response.transactionResponse.messages.message[0].description else: print "response code: %s" % response.messages.resultCode - print response.messages.message[0].text + print response.messages.message[0]['text'].text return response if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]): - credit_bank_account() \ No newline at end of file + credit_bank_account() diff --git a/PaymentTransactions/refund-transaction.py b/PaymentTransactions/refund-transaction.py index b95b79f..e2f7c89 100644 --- a/PaymentTransactions/refund-transaction.py +++ b/PaymentTransactions/refund-transaction.py @@ -40,12 +40,12 @@ def refund_transaction(refTransId): print "Transaction ID : %s" % response.transactionResponse.transId else: print "response code: %s" % response.messages.resultCode - print "Message code: %s" % response.messages.message[0].code - print "Message text: %s" % response.messages.message[0].text + print "Message code: %s" % response.messages.message[0]['code'].text + print "Message text: %s" % response.messages.message[0]['text'].text print "Transaction Error Code: %s" % response.transactionResponse.errors.error[0].errorCode print "Transaction Error Text: %s" % response.transactionResponse.errors.error[0].errorText return response if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]): - refund_transaction(constants.transactionId) \ No newline at end of file + refund_transaction(constants.transactionId) diff --git a/PaymentTransactions/update-split-tender-group.py b/PaymentTransactions/update-split-tender-group.py index 66de357..0efaf38 100644 --- a/PaymentTransactions/update-split-tender-group.py +++ b/PaymentTransactions/update-split-tender-group.py @@ -26,12 +26,12 @@ def update_split_tender_group(): if (response.messages.resultCode=="Ok"): - print response.messages.message[0].text + print response.messages.message[0]['text'].text else: print "response code: %s" % response.messages.resultCode - print response.messages.message[0].text + print response.messages.message[0]['text'].text return response if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]): - update_split_tender_group() \ No newline at end of file + update_split_tender_group() diff --git a/PaypalExpressCheckout/authorization-and-capture-continue.py b/PaypalExpressCheckout/authorization-and-capture-continue.py index 4a041d1..e1a4d98 100644 --- a/PaypalExpressCheckout/authorization-and-capture-continue.py +++ b/PaypalExpressCheckout/authorization-and-capture-continue.py @@ -34,16 +34,16 @@ def authorization_and_capture_continue(refTransId, payerID): if (response.messages.resultCode=="Ok"): print "SUCCESS" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text if (response.transactionResponse.responseCode == "1" ): print "Description : %s " % response.transactionResponse.messages.message[0].description print "Payer Id : %s " % response.transactionResponse.secureAcceptance.PayerID print "Transaction ID : %s " % response.transactionResponse.transId else: print "ERROR" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text return response diff --git a/PaypalExpressCheckout/authorization-and-capture.py b/PaypalExpressCheckout/authorization-and-capture.py index 4995671..a60ad7f 100644 --- a/PaypalExpressCheckout/authorization-and-capture.py +++ b/PaypalExpressCheckout/authorization-and-capture.py @@ -35,14 +35,14 @@ def authorization_and_capture(amount): if (response.messages.resultCode=="Ok"): print "SUCCESS" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text print "Secure acceptance URL : %s " % response.transactionResponse.secureAcceptance.SecureAcceptanceUrl print "Transaction ID : %s " % response.transactionResponse.transId else: print "ERROR" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text return response diff --git a/PaypalExpressCheckout/authorization-only-continued.py b/PaypalExpressCheckout/authorization-only-continued.py index ac712b5..0bfdafd 100644 --- a/PaypalExpressCheckout/authorization-only-continued.py +++ b/PaypalExpressCheckout/authorization-only-continued.py @@ -36,18 +36,18 @@ def authorization_only_continued(): if (response.messages.resultCode=="Ok"): print "SUCCESS" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text if (response.transactionResponse.responseCode == "1" ): print "Description : %s " % response.transactionResponse.messages.message[0].description print "Payer Id : %s " % response.transactionResponse.secureAcceptance.PayerID print "Transaction ID : %s " % response.transactionResponse.transId else: print "ERROR" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text return response if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]): - authorization_only_continued() \ No newline at end of file + authorization_only_continued() diff --git a/PaypalExpressCheckout/authorization-only.py b/PaypalExpressCheckout/authorization-only.py index d62a614..158d5db 100644 --- a/PaypalExpressCheckout/authorization-only.py +++ b/PaypalExpressCheckout/authorization-only.py @@ -35,14 +35,14 @@ def authorization_only(): if (response.messages.resultCode=="Ok"): print "SUCCESS" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text print "Secure acceptance URL : %s " % response.transactionResponse.secureAcceptance.SecureAcceptanceUrl print "Transaction ID : %s " % response.transactionResponse.transId else: print "ERROR" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text return response diff --git a/PaypalExpressCheckout/credit.py b/PaypalExpressCheckout/credit.py index bc30dfc..864d861 100644 --- a/PaypalExpressCheckout/credit.py +++ b/PaypalExpressCheckout/credit.py @@ -33,17 +33,17 @@ def credit(): if (response.messages.resultCode=="Ok"): print "SUCCESS" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text if (response.transactionResponse.responseCode == "1" ): print "Transaction ID : %s " % response.transactionResponse.transId print "Description : %s " % response.transactionResponse.messages.message[0].description else: print "ERROR" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text return response if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]): - credit() \ No newline at end of file + credit() diff --git a/PaypalExpressCheckout/get-details.py b/PaypalExpressCheckout/get-details.py index 2a95757..7ad9b8f 100644 --- a/PaypalExpressCheckout/get-details.py +++ b/PaypalExpressCheckout/get-details.py @@ -27,17 +27,17 @@ def get_details(refTransId): if (response.messages.resultCode=="Ok"): print "SUCCESS" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text if (response.transactionResponse.responseCode == "1" ): print "Payer Id : %s " % response.transactionResponse.secureAcceptance.PayerID print "Transaction ID : %s " % response.transactionResponse.transId else: print "ERROR" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text return response if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]): - get_details(constants.transactionId) \ No newline at end of file + get_details(constants.transactionId) diff --git a/PaypalExpressCheckout/prior-authorization-capture.py b/PaypalExpressCheckout/prior-authorization-capture.py index e685211..1fc0e0f 100644 --- a/PaypalExpressCheckout/prior-authorization-capture.py +++ b/PaypalExpressCheckout/prior-authorization-capture.py @@ -36,18 +36,18 @@ def prior_authorization_capture(refTransId): if (response.messages.resultCode=="Ok"): print "SUCCESS" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text print "Auth code : %s " % response.transactionResponse.authCode if (response.transactionResponse.responseCode == "1" ): print "Description : %s " % response.transactionResponse.messages.message[0].description print "Transaction ID : %s " % response.transactionResponse.transId else: print "ERROR" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text return response if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]): - prior_authorization_capture(constants.transactionId) \ No newline at end of file + prior_authorization_capture(constants.transactionId) diff --git a/PaypalExpressCheckout/void.py b/PaypalExpressCheckout/void.py index 56f9de8..3e52f90 100644 --- a/PaypalExpressCheckout/void.py +++ b/PaypalExpressCheckout/void.py @@ -33,17 +33,17 @@ def void(refTransId): if (response.messages.resultCode=="Ok"): print "SUCCESS" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text if (response.transactionResponse.responseCode == "1" ): print "Transaction ID : %s " % response.transactionResponse.transId print "Description : %s " % response.transactionResponse.messages.message[0].description else: print "ERROR" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text return response if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]): - void(constants.transactionId) \ No newline at end of file + void(constants.transactionId) diff --git a/RecurringBilling/cancel-subscription.py b/RecurringBilling/cancel-subscription.py index 7f77fda..4858be8 100644 --- a/RecurringBilling/cancel-subscription.py +++ b/RecurringBilling/cancel-subscription.py @@ -22,14 +22,14 @@ def cancel_subscription(subscriptionId): if (response.messages.resultCode=="Ok"): print "SUCCESS" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text else: print "ERROR" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text return response if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]): - cancel_subscription(constants.subscriptionId) \ No newline at end of file + cancel_subscription(constants.subscriptionId) diff --git a/RecurringBilling/create-subscription-from-customer-profile.py b/RecurringBilling/create-subscription-from-customer-profile.py index 90819da..412d399 100644 --- a/RecurringBilling/create-subscription-from-customer-profile.py +++ b/RecurringBilling/create-subscription-from-customer-profile.py @@ -21,13 +21,13 @@ def create_subscription_from_customer_profile(amount, days, profileId, paymentPr paymentschedule.startDate = datetime(2020, 8, 30) paymentschedule.totalOccurrences = 12 paymentschedule.trialOccurrences = 1 - + #setting the customer profile details profile = apicontractsv1.customerProfileIdType() profile.customerProfileId = profileId profile.customerPaymentProfileId = paymentProfileId profile.customerAddressId = customerAddressId - + # Setting subscription details subscription = apicontractsv1.ARBSubscriptionType() subscription.name = "Sample Subscription" @@ -35,12 +35,12 @@ def create_subscription_from_customer_profile(amount, days, profileId, paymentPr subscription.amount = amount subscription.trialAmount = Decimal('0.00') subscription.profile = profile - + # Creating the request request = apicontractsv1.ARBCreateSubscriptionRequest() request.merchantAuthentication = merchantAuth request.subscription = subscription - + # Creating and executing the controller controller = ARBCreateSubscriptionController(request) controller.execute() @@ -49,13 +49,13 @@ def create_subscription_from_customer_profile(amount, days, profileId, paymentPr if (response.messages.resultCode=="Ok"): print "SUCCESS:" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text print "Subscription ID : %s" % response.subscriptionId else: - print "ERROR:" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "ERROR:" + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text return response diff --git a/RecurringBilling/create-subscription.py b/RecurringBilling/create-subscription.py index e849807..4f62164 100644 --- a/RecurringBilling/create-subscription.py +++ b/RecurringBilling/create-subscription.py @@ -51,13 +51,13 @@ def create_subscription(amount, days): if (response.messages.resultCode=="Ok"): print "SUCCESS:" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % str(response.messages.message[0].text) + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % str(response.messages.message[0]['text'].text) print "Subscription ID : %s" % response.subscriptionId else: - print "ERROR:" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "ERROR:" + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text return response diff --git a/RecurringBilling/get-list-of-subscription.py b/RecurringBilling/get-list-of-subscription.py index bd0846c..28db74c 100644 --- a/RecurringBilling/get-list-of-subscription.py +++ b/RecurringBilling/get-list-of-subscription.py @@ -32,15 +32,15 @@ def get_list_of_subscription(): if (response.messages.resultCode=="Ok"): print "SUCCESS" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text print "Total Number In Results : %s" % response.totalNumInResultSet else: print "ERROR" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text return response if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]): - get_list_of_subscription() \ No newline at end of file + get_list_of_subscription() diff --git a/RecurringBilling/get-subscription-status.py b/RecurringBilling/get-subscription-status.py index 01a6a2c..3638493 100644 --- a/RecurringBilling/get-subscription-status.py +++ b/RecurringBilling/get-subscription-status.py @@ -24,15 +24,15 @@ def get_subscription_status(subscriptionId): if (response.messages.resultCode=="Ok"): print "SUCCESS:" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text print "Subscription Status : %s" % response.status else: - print "ERROR:" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "ERROR:" + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text return response if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]): - get_subscription_status(constants.subscriptionId) \ No newline at end of file + get_subscription_status(constants.subscriptionId) diff --git a/RecurringBilling/update-subscription.py b/RecurringBilling/update-subscription.py index 7a8eee0..0a9de4d 100644 --- a/RecurringBilling/update-subscription.py +++ b/RecurringBilling/update-subscription.py @@ -22,7 +22,7 @@ def update_subscription(subscriptionId): profile.customerProfileId = "121212"; profile.customerPaymentProfileId = "131313"; profile.customerAddressId = "141414"; - + subscription = apicontractsv1.ARBSubscriptionType() subscription.payment = payment #to update customer profile information @@ -41,12 +41,12 @@ def update_subscription(subscriptionId): if (response.messages.resultCode=="Ok"): print "SUCCESS" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text else: print "ERROR" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text return response diff --git a/TransactionReporting/get-batch-statistics.py b/TransactionReporting/get-batch-statistics.py index 79f1e05..f74cd58 100644 --- a/TransactionReporting/get-batch-statistics.py +++ b/TransactionReporting/get-batch-statistics.py @@ -37,11 +37,11 @@ def get_batch_statistics(): print('Decline Count : %s' % statistic.declineCount) if batchStatisticsResponse.messages: - print('Message Code : %s' % batchStatisticsResponse.messages.message[0].code) - print('Message Text : %s' % batchStatisticsResponse.messages.message[0].text) + print('Message Code : %s' % batchStatisticsResponse.messages.message[0]['code'].text) + print('Message Text : %s' % batchStatisticsResponse.messages.message[0]['text'].text) else: if batchStatisticsResponse.messages: - print('Failed to get batch statistics.\nCode:%s \nText:%s' % (batchStatisticsResponse.messages.message[0].code,batchStatisticsResponse.messages.message[0].text)) + print('Failed to get batch statistics.\nCode:%s \nText:%s' % (batchStatisticsResponse.messages.message[0]['code'].text,batchStatisticsResponse.messages.message[0]['text'].text)) return batchStatisticsResponse diff --git a/TransactionReporting/get-settled-batch-list.py b/TransactionReporting/get-settled-batch-list.py index 8f7e5fb..b066217 100644 --- a/TransactionReporting/get-settled-batch-list.py +++ b/TransactionReporting/get-settled-batch-list.py @@ -26,7 +26,7 @@ def get_settled_batch_list(): if settledBatchListResponse is not None: if settledBatchListResponse.messages.resultCode == apicontractsv1.messageTypeEnum.Ok: print('Successfully got settled batch list!') - + #if hasattr(response, 'batch') == True: #mylist = settledBatchListResponse.batchList.batch @@ -40,19 +40,19 @@ def get_settled_batch_list(): if hasattr(settledBatchListResponse.batchList.batch, 'statistics') == True: if hasattr(settledBatchListResponse.batchList.batch.statistics, 'statistic') == True: # if batchItem.statistics: - for statistic in batchItem.statistics.statistic: + for statistic in batchItem.statistics.statistic: print('Account Type : %s' % statistic.accountType) print('Charge Amount : %s' % statistic.chargeAmount) print('Refund Amount : %s' % statistic.refundAmount) print('Decline Count : %s' % statistic.declineCount) if settledBatchListResponse.messages: - print('Message Code : %s' % settledBatchListResponse.messages.message[0].code) - print('Message Text : %s' % settledBatchListResponse.messages.message[0].text) + print('Message Code : %s' % settledBatchListResponse.messages.message[0]['code'].text) + print('Message Text : %s' % settledBatchListResponse.messages.message[0]['text'].text) else: if settledBatchListResponse.messages: - print('Failed to get settled batch list.\nCode:%s \nText:%s' % (settledBatchListResponse.messages.message[0].code,settledBatchListResponse.messages.message[0].text)) + print('Failed to get settled batch list.\nCode:%s \nText:%s' % (settledBatchListResponse.messages.message[0]['code'].text,settledBatchListResponse.messages.message[0]['text'].text)) return settledBatchListResponse if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]): - get_settled_batch_list() \ No newline at end of file + get_settled_batch_list() diff --git a/TransactionReporting/get-transaction-details.py b/TransactionReporting/get-transaction-details.py index cd36d12..068d3b9 100644 --- a/TransactionReporting/get-transaction-details.py +++ b/TransactionReporting/get-transaction-details.py @@ -34,13 +34,13 @@ def get_transaction_details(transId): print('Tax : %s' % transactionDetailsResponse.transaction.tax.amount) if transactionDetailsResponse.messages: - print('Message Code : %s' % transactionDetailsResponse.messages.message[0].code) - print('Message Text : %s' % transactionDetailsResponse.messages.message[0].text) + print('Message Code : %s' % transactionDetailsResponse.messages.message[0]['code'].text) + print('Message Text : %s' % transactionDetailsResponse.messages.message[0]['text'].text) else: if transactionDetailsResponse.messages: - print('Failed to get transaction details.\nCode:%s \nText:%s' % (transactionDetailsResponse.messages.message[0].code,transactionDetailsResponse.messages.message[0].text)) + print('Failed to get transaction details.\nCode:%s \nText:%s' % (transactionDetailsResponse.messages.message[0]['code'].text,transactionDetailsResponse.messages.message[0]['text'].text)) return transactionDetailsResponse if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]): - get_transaction_details(constants.transactionId) \ No newline at end of file + get_transaction_details(constants.transactionId) diff --git a/TransactionReporting/get-transaction-list.py b/TransactionReporting/get-transaction-list.py index 63b537d..376e25b 100644 --- a/TransactionReporting/get-transaction-list.py +++ b/TransactionReporting/get-transaction-list.py @@ -32,13 +32,13 @@ def get_transaction_list(): print('Settle Amount : %s' % transaction.settleAmount) if transactionListResponse.messages: - print('Message Code : %s' % transactionListResponse.messages.message[0].code) - print('Message Text : %s' % transactionListResponse.messages.message[0].text) + print('Message Code : %s' % transactionListResponse.messages.message[0]['code'].text) + print('Message Text : %s' % transactionListResponse.messages.message[0]['text'].text) else: if transactionListResponse.messages: - print('Failed to get transaction list.\nCode:%s \nText:%s' % (transactionListResponse.messages.message[0].code,transactionListResponse.messages.message[0].text)) + print('Failed to get transaction list.\nCode:%s \nText:%s' % (transactionListResponse.messages.message[0]['code'].text,transactionListResponse.messages.message[0]['text'].text)) return transactionListResponse if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]): - get_transaction_list() \ No newline at end of file + get_transaction_list() diff --git a/TransactionReporting/get-unsettled-transaction-list.py b/TransactionReporting/get-unsettled-transaction-list.py index d29859e..98cdb4b 100644 --- a/TransactionReporting/get-unsettled-transaction-list.py +++ b/TransactionReporting/get-unsettled-transaction-list.py @@ -31,13 +31,13 @@ def get_unsettled_transaction_list(): print('Settle Amount : %s' % transaction.settleAmount) if unsettledTransactionListResponse.messages: - print('Message Code : %s' % unsettledTransactionListResponse.messages.message[0].code) - print('Message Text : %s' % unsettledTransactionListResponse.messages.message[0].text) + print('Message Code : %s' % unsettledTransactionListResponse.messages.message[0]['code'].text) + print('Message Text : %s' % unsettledTransactionListResponse.messages.message[0]['text'].text) else: if unsettledTransactionListResponse.messages: - print('Failed to get unsettled transaction list.\nCode:%s \nText:%s' % (unsettledTransactionListResponse.messages.message[0].code,unsettledTransactionListResponse.messages.message[0].text)) + print('Failed to get unsettled transaction list.\nCode:%s \nText:%s' % (unsettledTransactionListResponse.messages.message[0]['code'].text,unsettledTransactionListResponse.messages.message[0]['text'].text)) return unsettledTransactionListResponse if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]): - get_unsettled_transaction_list() \ No newline at end of file + get_unsettled_transaction_list() diff --git a/VisaCheckout/create-visa-checkout-transaction.py b/VisaCheckout/create-visa-checkout-transaction.py index 5b1f308..d456ad3 100644 --- a/VisaCheckout/create-visa-checkout-transaction.py +++ b/VisaCheckout/create-visa-checkout-transaction.py @@ -39,8 +39,8 @@ def create_visa_checkout_transaction(): print "Auth code : %s " % response.authCode else: print "ERROR" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text return response diff --git a/VisaCheckout/decrypt-visa-checkout-data.py b/VisaCheckout/decrypt-visa-checkout-data.py index f219dc9..cc1f4e2 100644 --- a/VisaCheckout/decrypt-visa-checkout-data.py +++ b/VisaCheckout/decrypt-visa-checkout-data.py @@ -26,16 +26,16 @@ def decrypt_visa_checkout_data(): if (response.messages.resultCode=="Ok"): print "SUCCESS" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text print "Card number : %s" % response.cardInfo.cardNumber print "Amount : %s" % response.paymentDetails.amount else: print "ERROR" - print "Message Code : %s" % response.messages.message[0].code - print "Message text : %s" % response.messages.message[0].text + print "Message Code : %s" % response.messages.message[0]['code'].text + print "Message text : %s" % response.messages.message[0]['text'].text return response if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]): - decrypt_visa_checkout_data() \ No newline at end of file + decrypt_visa_checkout_data()