Skip to content

Commit ca80ee0

Browse files
author
srathod
committed
- Merged PR AuthorizeNet#20.
- Made python 3.5 related updates.
1 parent f01955a commit ca80ee0

51 files changed

Lines changed: 383 additions & 375 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@ def create_an_apple_pay_transaction():
3535
response = controller.getresponse()
3636

3737
if (response.messages.resultCode=="Ok"):
38-
print "SUCCESS"
39-
print "Message Code : %s" % response.messages.message[0].code
40-
print "Message text : %s" % response.messages.message[0].text
41-
print "AUTH Code : %s" % response.authCode
42-
print "Transaction ID : %s" % response.transId
38+
print("SUCCESS")
39+
print("Message Code : %s" % response.messages.message[0]['code'].text)
40+
print("Message text : %s" % response.messages.message[0]['text'].text)
41+
print("AUTH Code : %s" % response.authCode)
42+
print("Transaction ID : %s" % response.transId)
4343
else:
44-
print "ERROR"
45-
print "Message Code : %s" % response.messages.message[0].code
46-
print "Message text : %s" % response.messages.message[0].text
44+
print("ERROR")
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

50-
if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]):
50+
if(os.path.basename(__file__) == os.path.basename(sys.argv[0])):
5151
create_an_apple_pay_transaction()

CustomerProfiles/create-customer-payment-profile.py

Lines changed: 6 additions & 6 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
@@ -37,11 +37,11 @@ def create_customer_payment_profile(customerProfileId):
3737
response = controller.getresponse()
3838

3939
if (response.messages.resultCode=="Ok"):
40-
print "Successfully created a customer payment profile with id: %s" % response.customerPaymentProfileId
40+
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

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

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,21 @@ 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

3030
response = controller.getresponse()
3131

3232
if (response.messages.resultCode=="Ok"):
33-
print "Successfully created a customer profile with id: %s from transaction id: %s" % (response.customerProfileId, createCustomerProfileFromTransaction.transId)
33+
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

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

CustomerProfiles/create-customer-profile.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ def create_customer_profile():
2323
response = controller.getresponse()
2424

2525
if (response.messages.resultCode=="Ok"):
26-
print "Successfully created a customer profile with id: %s" % response.customerProfileId
26+
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

32-
if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]):
32+
if(os.path.basename(__file__) == os.path.basename(sys.argv[0])):
3333
create_customer_profile()

CustomerProfiles/create-customer-shipping-address.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ def create_customer_shipping_address(customerProfileId):
3535
response = controller.getresponse();
3636

3737
if response.messages.resultCode == "Ok":
38-
print "SUCCESS"
39-
print "Transaction ID : %s " % response.messages.message[0].text
40-
print "Customer address id : %s" % response.customerAddressId
38+
print("SUCCESS")
39+
print("Transaction ID : %s " % response.messages.message[0]['text'].text)
40+
print("Customer address id : %s" % response.customerAddressId)
4141
else:
42-
print "ERROR"
43-
print "Message code : %s " % response.messages.message[0].code
44-
print "Message text : %s " % response.messages.message[0].text
42+
print("ERROR")
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

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

CustomerProfiles/delete-customer-payment-profile.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ def delete_customer_payment_profile(customerProfileId, customerPaymentProfileId)
2121
response = controller.getresponse()
2222

2323
if (response.messages.resultCode=="Ok"):
24-
print "Successfully deleted customer payment profile with customer profile id %s" % deleteCustomerPaymentProfile.customerProfileId
24+
print("Successfully deleted customer payment profile with customer profile id %s" % deleteCustomerPaymentProfile.customerProfileId)
2525
else:
26-
print response.messages.message[0].text
27-
print "Failed to delete customer paymnet profile with customer profile id %s" % deleteCustomerPaymentProfile.customerProfileId
26+
print(response.messages.message[0]['text'].text)
27+
print("Failed to delete customer paymnet profile with customer profile id %s" % deleteCustomerPaymentProfile.customerProfileId)
2828

2929
return response
3030

31-
if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]):
31+
if(os.path.basename(__file__) == os.path.basename(sys.argv[0])):
3232
delete_customer_payment_profile(constants.customerProfileId, constants.customerPaymentProfileId)

CustomerProfiles/delete-customer-profile.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ def delete_customer_profile(customerProfileId):
2020
response = controller.getresponse()
2121

2222
if (response.messages.resultCode=="Ok"):
23-
print "Successfully deleted customer with customer profile id %s" % deleteCustomerProfile.customerProfileId
23+
print("Successfully deleted customer with customer profile id %s" % deleteCustomerProfile.customerProfileId)
2424
else:
25-
print response.messages.message[0].text
26-
print "Failed to delete customer profile with customer profile id %s" % deleteCustomerProfile.customerProfileId
25+
print(response.messages.message[0]['text'].text)
26+
print("Failed to delete customer profile with customer profile id %s" % deleteCustomerProfile.customerProfileId)
2727

2828
return response
2929

30-
if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]):
30+
if(os.path.basename(__file__) == os.path.basename(sys.argv[0])):
3131
delete_customer_profile(constants.customerProfileId)

CustomerProfiles/delete-customer-shipping-address.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ def delete_customer_shipping_address(customerProfileId, customerProfileShippingI
2424
response = deleteShippingAddressController.getresponse()
2525

2626
if response.messages.resultCode == "Ok":
27-
print "SUCCESS"
28-
print "Message code : %s " % response.messages.message[0].code
29-
print "Message text : %s " % response.messages.message[0].text
27+
print("SUCCESS")
28+
print("Message code : %s " % response.messages.message[0]['code'].text)
29+
print("Message text : %s " % response.messages.message[0]['text'].text)
3030
else:
31-
print "ERROR"
32-
print "Message code : %s " % response.messages.message[0].code
33-
print "Message text : %s " % response.messages.message[0].text
31+
print("ERROR")
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

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

CustomerProfiles/get-customer-payment-profile.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@ def get_customer_payment_profile(customerProfileId, customerPaymentProfileId):
2222
response = controller.getresponse()
2323

2424
if (response.messages.resultCode=="Ok"):
25-
print "Successfully retrieved a payment profile with profile id %s and customer id %s" % (getCustomerPaymentProfile.customerProfileId, getCustomerPaymentProfile.customerProfileId)
25+
print("Successfully retrieved a payment profile with profile id %s and customer id %s" % (getCustomerPaymentProfile.customerProfileId, getCustomerPaymentProfile.customerProfileId))
2626
if hasattr(response, 'paymentProfile') == True:
2727
if hasattr(response.paymentProfile, 'subscriptionIds') == True:
2828
if hasattr(response.paymentProfile.subscriptionIds, 'subscriptionId') == True:
29-
print "list of subscriptionid:"
29+
print("list of subscriptionid:")
3030
for subscriptionid in response.paymentProfile.subscriptionIds.subscriptionId:
31-
print subscriptionid
31+
print(subscriptionid)
3232
else:
33-
print "response code: %s" % response.messages.resultCode
34-
print "Failed to get payment profile information with id %s" % getCustomerPaymentProfile.customerPaymentProfileId
33+
print("response code: %s" % response.messages.resultCode)
34+
print("Failed to get payment profile information with id %s" % getCustomerPaymentProfile.customerPaymentProfileId)
3535

3636
return response
3737

38-
if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]):
38+
if(os.path.basename(__file__) == os.path.basename(sys.argv[0])):
3939
get_customer_payment_profile(constants.customerProfileId, constants.customerPaymentProfileId)

CustomerProfiles/get-customer-profile-ids.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ def get_customer_profile_ids():
1919
response = controller.getresponse()
2020

2121
if (response.messages.resultCode=="Ok"):
22-
print "Successfully retrieved customer ids:"
22+
print("Successfully retrieved customer ids:")
2323
for identity in response.ids.numericString:
24-
print identity
24+
print(identity)
2525
else:
26-
print "response code: %s" % response.messages.resultCode
26+
print("response code: %s" % response.messages.resultCode)
2727

2828
return response
2929

30-
if(os.path.basename(__file__) == sys.argv[0].split('/')[-1]):
30+
if(os.path.basename(__file__) == os.path.basename(sys.argv[0])):
3131
get_customer_profile_ids()

0 commit comments

Comments
 (0)