Skip to content

Commit 918c133

Browse files
Update response messages to use indexes and not properties.
1 parent bf52c26 commit 918c133

39 files changed

Lines changed: 157 additions & 157 deletions

ApplePayTransactions/create-an-apple-pay-transaction.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ def create_an_apple_pay_transaction():
3636

3737
if (response.messages.resultCode=="Ok"):
3838
print "SUCCESS"
39-
print "Message Code : %s" % response.messages.message[0].code
40-
print "Message text : %s" % response.messages.message[0].text
39+
print "Message Code : %s" % response.messages.message[0]['code'].text
40+
print "Message text : %s" % response.messages.message[0]['text'].text
4141
print "AUTH Code : %s" % response.authCode
4242
print "Transaction ID : %s" % response.transId
4343
else:
4444
print "ERROR"
45-
print "Message Code : %s" % response.messages.message[0].code
46-
print "Message text : %s" % response.messages.message[0].text
45+
print "Message Code : %s" % response.messages.message[0]['code'].text
46+
print "Message text : %s" % response.messages.message[0]['text'].text
4747

4848
return response
4949

CustomerProfiles/create-customer-payment-profile.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ def create_customer_payment_profile(customerProfileId):
2020
billTo = apicontractsv1.customerAddressType()
2121
billTo.firstName = "John"
2222
billTo.lastName = "Snow"
23-
23+
2424
profile = apicontractsv1.customerPaymentProfileType()
2525
profile.payment = payment
2626
profile.billTo = billTo
27-
27+
2828
createCustomerPaymentProfile = apicontractsv1.createCustomerPaymentProfileRequest()
2929
createCustomerPaymentProfile.merchantAuthentication = merchantAuth
3030
createCustomerPaymentProfile.paymentProfile = profile
@@ -39,9 +39,9 @@ def create_customer_payment_profile(customerProfileId):
3939
if (response.messages.resultCode=="Ok"):
4040
print "Successfully created a customer payment profile with id: %s" % response.customerPaymentProfileId
4141
else:
42-
print "Failed to create customer payment profile %s" % response.messages.message[0].text
42+
print "Failed to create customer payment profile %s" % response.messages.message[0]['text'].text
4343

4444
return response
4545

4646
if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]):
47-
create_customer_payment_profile(constants.customerProfileId)
47+
create_customer_payment_profile(constants.customerProfileId)

CustomerProfiles/create-customer-profile-from-transaction.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ def create_customer_profile_from_transaction(transactionId):
2020
createCustomerProfileFromTransaction.transId = transactionId
2121
#You can either specify the customer information in form of customerProfileBaseType object
2222
createCustomerProfileFromTransaction.customer = profile
23-
# OR
23+
# OR
2424
# You can just provide the customer Profile ID
25-
# createCustomerProfileFromTransaction.customerProfileId = "123343"
26-
25+
# createCustomerProfileFromTransaction.customerProfileId = "123343"
26+
2727
controller = createCustomerProfileFromTransactionController(createCustomerProfileFromTransaction)
2828
controller.execute()
2929

@@ -32,9 +32,9 @@ def create_customer_profile_from_transaction(transactionId):
3232
if (response.messages.resultCode=="Ok"):
3333
print "Successfully created a customer profile with id: %s from transaction id: %s" % (response.customerProfileId, createCustomerProfileFromTransaction.transId)
3434
else:
35-
print "Failed to create customer payment profile from transaction %s" % response.messages.message[0].text
35+
print "Failed to create customer payment profile from transaction %s" % response.messages.message[0]['text'].text
3636

3737
return response
3838

3939
if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]):
40-
create_customer_profile_from_transaction(constants.transactionId)
40+
create_customer_profile_from_transaction(constants.transactionId)

CustomerProfiles/create-customer-profile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def create_customer_profile():
2525
if (response.messages.resultCode=="Ok"):
2626
print "Successfully created a customer profile with id: %s" % response.customerProfileId
2727
else:
28-
print "Failed to create customer payment profile %s" % response.messages.message[0].text
28+
print "Failed to create customer payment profile %s" % response.messages.message[0]['text'].text
2929

3030
return response
3131

CustomerProfiles/create-customer-shipping-address.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ def create_customer_shipping_address(customerProfileId):
3636

3737
if response.messages.resultCode == "Ok":
3838
print "SUCCESS"
39-
print "Transaction ID : %s " % response.messages.message[0].text
39+
print "Transaction ID : %s " % response.messages.message[0]['text'].text
4040
print "Customer address id : %s" % response.customerAddressId
4141
else:
4242
print "ERROR"
43-
print "Message code : %s " % response.messages.message[0].code
44-
print "Message text : %s " % response.messages.message[0].text
43+
print "Message code : %s " % response.messages.message[0]['code'].text
44+
print "Message text : %s " % response.messages.message[0]['text'].text
4545

4646
return response
4747

4848
if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]):
49-
create_customer_shipping_address(constants.customerProfileId)
49+
create_customer_shipping_address(constants.customerProfileId)

CustomerProfiles/delete-customer-payment-profile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def delete_customer_payment_profile(customerProfileId, customerPaymentProfileId)
2323
if (response.messages.resultCode=="Ok"):
2424
print "Successfully deleted customer payment profile with customer profile id %s" % deleteCustomerPaymentProfile.customerProfileId
2525
else:
26-
print response.messages.message[0].text
26+
print response.messages.message[0]['text'].text
2727
print "Failed to delete customer paymnet profile with customer profile id %s" % deleteCustomerPaymentProfile.customerProfileId
2828

2929
return response

CustomerProfiles/delete-customer-profile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def delete_customer_profile(customerProfileId):
2222
if (response.messages.resultCode=="Ok"):
2323
print "Successfully deleted customer with customer profile id %s" % deleteCustomerProfile.customerProfileId
2424
else:
25-
print response.messages.message[0].text
25+
print response.messages.message[0]['text'].text
2626
print "Failed to delete customer profile with customer profile id %s" % deleteCustomerProfile.customerProfileId
2727

2828
return response

CustomerProfiles/delete-customer-shipping-address.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ def delete_customer_shipping_address(customerProfileId, customerProfileShippingI
2525

2626
if response.messages.resultCode == "Ok":
2727
print "SUCCESS"
28-
print "Message code : %s " % response.messages.message[0].code
29-
print "Message text : %s " % response.messages.message[0].text
28+
print "Message code : %s " % response.messages.message[0]['code'].text
29+
print "Message text : %s " % response.messages.message[0]['text'].text
3030
else:
3131
print "ERROR"
32-
print "Message code : %s " % response.messages.message[0].code
33-
print "Message text : %s " % response.messages.message[0].text
32+
print "Message code : %s " % response.messages.message[0]['code'].text
33+
print "Message text : %s " % response.messages.message[0]['text'].text
3434

3535
return response
3636

CustomerProfiles/get-customer-shipping-address.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,18 @@ def get_customer_shipping_address(customerProfileId, customerAddressId):
3434
print response.address.country
3535
if not hasattr(response, 'subscriptionIds'):
3636
print ("no subscriptionIds attr in response")
37-
else:
37+
else:
3838
if hasattr(response, 'subscriptionIds') == True:
3939
if hasattr(response.subscriptionIds, 'subscriptionId') == True:
4040
print "list of subscriptionid:"
4141
for subscriptionid in (response.subscriptionIds.subscriptionId):
4242
print subscriptionid
4343
else:
4444
print "ERROR"
45-
print "Message code : %s " % response.messages.message[0].code
46-
print "Message text : %s " % response.messages.message[0].text
45+
print "Message code : %s " % response.messages.message[0]['code'].text
46+
print "Message text : %s " % response.messages.message[0]['text'].text
4747

4848
return response
4949

5050
if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]):
51-
get_customer_shipping_address(constants.customerProfileId, constants.customerProfileShippingId)
51+
get_customer_shipping_address(constants.customerProfileId, constants.customerProfileShippingId)

CustomerProfiles/get-hosted-profile-page.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ def get_hosted_profile_page(customerProfileId):
3636
print('Token : %s' % profilePageResponse.token)
3737

3838
if profilePageResponse.messages:
39-
print('Message Code : %s' % profilePageResponse.messages.message[0].code)
40-
print('Message Text : %s' % profilePageResponse.messages.message[0].text)
39+
print('Message Code : %s' % profilePageResponse.messages.message[0]['code'].text)
40+
print('Message Text : %s' % profilePageResponse.messages.message[0]['text'].text)
4141
else:
4242
if profilePageResponse.messages:
43-
print('Failed to get batch statistics.\nCode:%s \nText:%s' % (profilePageResponse.messages.message[0].code,profilePageResponse.messages.message[0].text))
43+
print('Failed to get batch statistics.\nCode:%s \nText:%s' % (profilePageResponse.messages.message[0]['code'].text,profilePageResponse.messages.message[0]['text'].text))
4444

4545
return profilePageResponse
4646

4747
if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]):
48-
get_hosted_profile_page(constants.customerProfileId)
48+
get_hosted_profile_page(constants.customerProfileId)

0 commit comments

Comments
 (0)