| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,42 +6,42 @@ | |||
| 6 | 6 | constants = imp.load_source('modulename', 'constants.py') | |
| 7 | 7 | ||
| 8 | 8 | def create_customer_payment_profile(customerProfileId): | |
| 9 | - merchantAuth = apicontractsv1.merchantAuthenticationType() | ||
| 10 | - merchantAuth.name = constants.apiLoginId | ||
| 11 | - merchantAuth.transactionKey = constants.transactionKey | ||
| 9 | + merchantAuth = apicontractsv1.merchantAuthenticationType() | ||
| 10 | + merchantAuth.name = constants.apiLoginId | ||
| 11 | + merchantAuth.transactionKey = constants.transactionKey | ||
| 12 | 12 | ||
| 13 | - creditCard = apicontractsv1.creditCardType() | ||
| 14 | - creditCard.cardNumber = "4111111111111111" | ||
| 15 | - creditCard.expirationDate = "2020-12" | ||
| 13 | + creditCard = apicontractsv1.creditCardType() | ||
| 14 | + creditCard.cardNumber = "4111111111111111" | ||
| 15 | + creditCard.expirationDate = "2020-12" | ||
| 16 | 16 | ||
| 17 | - payment = apicontractsv1.paymentType() | ||
| 18 | - payment.creditCard = creditCard | ||
| 17 | + payment = apicontractsv1.paymentType() | ||
| 18 | + payment.creditCard = creditCard | ||
| 19 | 19 | ||
| 20 | - billTo = apicontractsv1.customerAddressType() | ||
| 21 | - billTo.firstName = "John" | ||
| 22 | - billTo.lastName = "Snow" | ||
| 20 | + billTo = apicontractsv1.customerAddressType() | ||
| 21 | + billTo.firstName = "John" | ||
| 22 | + billTo.lastName = "Snow" | ||
| 23 | 23 | ||
| 24 | - profile = apicontractsv1.customerPaymentProfileType() | ||
| 25 | - profile.payment = payment | ||
| 26 | - profile.billTo = billTo | ||
| 24 | + profile = apicontractsv1.customerPaymentProfileType() | ||
| 25 | + profile.payment = payment | ||
| 26 | + profile.billTo = billTo | ||
| 27 | 27 | ||
| 28 | - createCustomerPaymentProfile = apicontractsv1.createCustomerPaymentProfileRequest() | ||
| 29 | - createCustomerPaymentProfile.merchantAuthentication = merchantAuth | ||
| 30 | - createCustomerPaymentProfile.paymentProfile = profile | ||
| 31 | - print("customerProfileId in create_customer_payment_profile. customerProfileId = %s" %customerProfileId) | ||
| 32 | - createCustomerPaymentProfile.customerProfileId = str(customerProfileId) | ||
| 28 | + createCustomerPaymentProfile = apicontractsv1.createCustomerPaymentProfileRequest() | ||
| 29 | + createCustomerPaymentProfile.merchantAuthentication = merchantAuth | ||
| 30 | + createCustomerPaymentProfile.paymentProfile = profile | ||
| 31 | + print("customerProfileId in create_customer_payment_profile. customerProfileId = %s" %customerProfileId) | ||
| 32 | + createCustomerPaymentProfile.customerProfileId = str(customerProfileId) | ||
| 33 | 33 | ||
| 34 | - controller = createCustomerPaymentProfileController(createCustomerPaymentProfile) | ||
| 35 | - controller.execute() | ||
| 34 | + controller = createCustomerPaymentProfileController(createCustomerPaymentProfile) | ||
| 35 | + controller.execute() | ||
| 36 | 36 | ||
| 37 | - response = controller.getresponse() | ||
| 37 | + response = controller.getresponse() | ||
| 38 | 38 | ||
| 39 | - if (response.messages.resultCode=="Ok"): | ||
| 40 | - print("Successfully created a customer payment profile with id: %s" % response.customerPaymentProfileId) | ||
| 41 | - else: | ||
| 42 | - print("Failed to create customer payment profile %s" % response.messages.message[0]['text'].text) | ||
| 39 | + if (response.messages.resultCode=="Ok"): | ||
| 40 | + print("Successfully created a customer payment profile with id: %s" % response.customerPaymentProfileId) | ||
| 41 | + else: | ||
| 42 | + print("Failed to create customer payment profile %s" % response.messages.message[0]['text'].text) | ||
| 43 | 43 | ||
| 44 | - return response | ||
| 44 | + return response | ||
| 45 | 45 | ||
| 46 | 46 | if(os.path.basename(__file__) == os.path.basename(sys.argv[0])): | |
| 47 | - create_customer_payment_profile(constants.customerProfileId) | ||
| 47 | + create_customer_payment_profile(constants.customerProfileId) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,35 +6,35 @@ | |||
| 6 | 6 | constants = imp.load_source('modulename', 'constants.py') | |
| 7 | 7 | ||
| 8 | 8 | def create_customer_profile_from_transaction(transactionId): | |
| 9 | - merchantAuth = apicontractsv1.merchantAuthenticationType() | ||
| 10 | - merchantAuth.name = constants.apiLoginId | ||
| 11 | - merchantAuth.transactionKey = constants.transactionKey | ||
| 9 | + merchantAuth = apicontractsv1.merchantAuthenticationType() | ||
| 10 | + merchantAuth.name = constants.apiLoginId | ||
| 11 | + merchantAuth.transactionKey = constants.transactionKey | ||
| 12 | 12 | ||
| 13 | - profile = apicontractsv1.customerProfileBaseType() | ||
| 14 | - profile.merchantCustomerId = "12332" | ||
| 15 | - profile.description = "This is a sample profile" | ||
| 16 | - profile.email = "john@castleblack.com" | ||
| 13 | + profile = apicontractsv1.customerProfileBaseType() | ||
| 14 | + profile.merchantCustomerId = "12332" | ||
| 15 | + profile.description = "This is a sample profile" | ||
| 16 | + profile.email = "john@castleblack.com" | ||
| 17 | 17 | ||
| 18 | - createCustomerProfileFromTransaction = apicontractsv1.createCustomerProfileFromTransactionRequest() | ||
| 19 | - createCustomerProfileFromTransaction.merchantAuthentication = merchantAuth | ||
| 20 | - createCustomerProfileFromTransaction.transId = transactionId | ||
| 21 | - #You can either specify the customer information in form of customerProfileBaseType object | ||
| 22 | - createCustomerProfileFromTransaction.customer = profile | ||
| 23 | - # OR | ||
| 24 | - # You can just provide the customer Profile ID | ||
| 25 | - # createCustomerProfileFromTransaction.customerProfileId = "123343" | ||
| 18 | + createCustomerProfileFromTransaction = apicontractsv1.createCustomerProfileFromTransactionRequest() | ||
| 19 | + createCustomerProfileFromTransaction.merchantAuthentication = merchantAuth | ||
| 20 | + createCustomerProfileFromTransaction.transId = transactionId | ||
| 21 | + #You can either specify the customer information in form of customerProfileBaseType object | ||
| 22 | + createCustomerProfileFromTransaction.customer = profile | ||
| 23 | + # OR | ||
| 24 | + # You can just provide the customer Profile ID | ||
| 25 | + # createCustomerProfileFromTransaction.customerProfileId = "123343" | ||
| 26 | 26 | ||
| 27 | - controller = createCustomerProfileFromTransactionController(createCustomerProfileFromTransaction) | ||
| 28 | - controller.execute() | ||
| 27 | + controller = createCustomerProfileFromTransactionController(createCustomerProfileFromTransaction) | ||
| 28 | + controller.execute() | ||
| 29 | 29 | ||
| 30 | - response = controller.getresponse() | ||
| 30 | + response = controller.getresponse() | ||
| 31 | 31 | ||
| 32 | - if (response.messages.resultCode=="Ok"): | ||
| 33 | - print("Successfully created a customer profile with id: %s from transaction id: %s" % (response.customerProfileId, createCustomerProfileFromTransaction.transId)) | ||
| 34 | - else: | ||
| 35 | - print("Failed to create customer payment profile from transaction %s" % response.messages.message[0]['text'].text) | ||
| 32 | + if (response.messages.resultCode=="Ok"): | ||
| 33 | + print("Successfully created a customer profile with id: %s from transaction id: %s" % (response.customerProfileId, createCustomerProfileFromTransaction.transId)) | ||
| 34 | + else: | ||
| 35 | + print("Failed to create customer payment profile from transaction %s" % response.messages.message[0]['text'].text) | ||
| 36 | 36 | ||
| 37 | - return response | ||
| 37 | + return response | ||
| 38 | 38 | ||
| 39 | 39 | if(os.path.basename(__file__) == os.path.basename(sys.argv[0])): | |
| 40 | - create_customer_profile_from_transaction(constants.transactionId) | ||
| 40 | + create_customer_profile_from_transaction(constants.transactionId) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,26 +8,26 @@ | |||
| 8 | 8 | ||
| 9 | 9 | def create_customer_profile(): | |
| 10 | 10 | ||
| 11 | - merchantAuth = apicontractsv1.merchantAuthenticationType() | ||
| 12 | - merchantAuth.name = constants.apiLoginId | ||
| 13 | - merchantAuth.transactionKey = constants.transactionKey | ||
| 11 | + merchantAuth = apicontractsv1.merchantAuthenticationType() | ||
| 12 | + merchantAuth.name = constants.apiLoginId | ||
| 13 | + merchantAuth.transactionKey = constants.transactionKey | ||
| 14 | 14 | ||
| 15 | 15 | ||
| 16 | - createCustomerProfile = apicontractsv1.createCustomerProfileRequest() | ||
| 17 | - createCustomerProfile.merchantAuthentication = merchantAuth | ||
| 18 | - createCustomerProfile.profile = apicontractsv1.customerProfileType('jdoe' + str(random.randint(0, 10000)), 'John2 Doe', 'jdoe@mail.com') | ||
| 16 | + createCustomerProfile = apicontractsv1.createCustomerProfileRequest() | ||
| 17 | + createCustomerProfile.merchantAuthentication = merchantAuth | ||
| 18 | + createCustomerProfile.profile = apicontractsv1.customerProfileType('jdoe' + str(random.randint(0, 10000)), 'John2 Doe', 'jdoe@mail.com') | ||
| 19 | 19 | ||
| 20 | - controller = createCustomerProfileController(createCustomerProfile) | ||
| 21 | - controller.execute() | ||
| 20 | + controller = createCustomerProfileController(createCustomerProfile) | ||
| 21 | + controller.execute() | ||
| 22 | 22 | ||
| 23 | - response = controller.getresponse() | ||
| 23 | + response = controller.getresponse() | ||
| 24 | 24 | ||
| 25 | - if (response.messages.resultCode=="Ok"): | ||
| 26 | - print("Successfully created a customer profile with id: %s" % response.customerProfileId) | ||
| 27 | - else: | ||
| 28 | - print("Failed to create customer payment profile %s" % response.messages.message[0]['text'].text) | ||
| 25 | + if (response.messages.resultCode=="Ok"): | ||
| 26 | + print("Successfully created a customer profile with id: %s" % response.customerProfileId) | ||
| 27 | + else: | ||
| 28 | + print("Failed to create customer payment profile %s" % response.messages.message[0]['text'].text) | ||
| 29 | 29 | ||
| 30 | - return response | ||
| 30 | + return response | ||
| 31 | 31 | ||
| 32 | 32 | if(os.path.basename(__file__) == os.path.basename(sys.argv[0])): | |
| 33 | - create_customer_profile() | ||
| 33 | + create_customer_profile() | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,43 +7,43 @@ | |||
| 7 | 7 | constants = imp.load_source('modulename', 'constants.py') | |
| 8 | 8 | ||
| 9 | 9 | def create_customer_shipping_address(customerProfileId): | |
| 10 | - # Give merchant details | ||
| 11 | - merchantAuth = apicontractsv1.merchantAuthenticationType() | ||
| 12 | - merchantAuth.name = constants.apiLoginId | ||
| 13 | - merchantAuth.transactionKey = constants.transactionKey | ||
| 14 | - | ||
| 15 | - # Give address details | ||
| 16 | - officeAddress = apicontractsv1.customerAddressType(); | ||
| 17 | - officeAddress.firstName = "John" | ||
| 18 | - officeAddress.lastName = "Doe" | ||
| 19 | - officeAddress.address = "123 Main St." | ||
| 20 | - officeAddress.city = "Bellevue" | ||
| 21 | - officeAddress.state = "WA" | ||
| 22 | - officeAddress.zip = "98004" | ||
| 23 | - officeAddress.country = "USA" | ||
| 24 | - officeAddress.phoneNumber = "000-000-0000" | ||
| 25 | - | ||
| 26 | - # Create shipping address request | ||
| 27 | - shippingAddressRequest = apicontractsv1.createCustomerShippingAddressRequest(); | ||
| 28 | - shippingAddressRequest.address = officeAddress | ||
| 29 | - shippingAddressRequest.customerProfileId = customerProfileId | ||
| 30 | - shippingAddressRequest.merchantAuthentication = merchantAuth | ||
| 31 | - | ||
| 32 | - # Make an API call | ||
| 33 | - controller = createCustomerShippingAddressController(shippingAddressRequest) | ||
| 34 | - controller.execute() | ||
| 35 | - response = controller.getresponse(); | ||
| 36 | - | ||
| 37 | - if response.messages.resultCode == "Ok": | ||
| 38 | - print("SUCCESS") | ||
| 39 | - print("Transaction ID : %s " % response.messages.message[0]['text'].text) | ||
| 40 | - print("Customer address id : %s" % response.customerAddressId) | ||
| 41 | - else: | ||
| 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) | ||
| 45 | - | ||
| 46 | - return response | ||
| 10 | + # Give merchant details | ||
| 11 | + merchantAuth = apicontractsv1.merchantAuthenticationType() | ||
| 12 | + merchantAuth.name = constants.apiLoginId | ||
| 13 | + merchantAuth.transactionKey = constants.transactionKey | ||
| 14 | + | ||
| 15 | + # Give address details | ||
| 16 | + officeAddress = apicontractsv1.customerAddressType() | ||
| 17 | + officeAddress.firstName = "John" | ||
| 18 | + officeAddress.lastName = "Doe" | ||
| 19 | + officeAddress.address = "123 Main St." | ||
| 20 | + officeAddress.city = "Bellevue" | ||
| 21 | + officeAddress.state = "WA" | ||
| 22 | + officeAddress.zip = "98004" | ||
| 23 | + officeAddress.country = "USA" | ||
| 24 | + officeAddress.phoneNumber = "000-000-0000" | ||
| 25 | + | ||
| 26 | + # Create shipping address request | ||
| 27 | + shippingAddressRequest = apicontractsv1.createCustomerShippingAddressRequest() | ||
| 28 | + shippingAddressRequest.address = officeAddress | ||
| 29 | + shippingAddressRequest.customerProfileId = customerProfileId | ||
| 30 | + shippingAddressRequest.merchantAuthentication = merchantAuth | ||
| 31 | + | ||
| 32 | + # Make an API call | ||
| 33 | + controller = createCustomerShippingAddressController(shippingAddressRequest) | ||
| 34 | + controller.execute() | ||
| 35 | + response = controller.getresponse() | ||
| 36 | + | ||
| 37 | + if response.messages.resultCode == "Ok": | ||
| 38 | + print("SUCCESS") | ||
| 39 | + print("Transaction ID : %s " % response.messages.message[0]['text'].text) | ||
| 40 | + print("Customer address id : %s" % response.customerAddressId) | ||
| 41 | + else: | ||
| 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) | ||
| 45 | + | ||
| 46 | + return response | ||
| 47 | 47 | ||
| 48 | 48 | if(os.path.basename(__file__) == os.path.basename(sys.argv[0])): | |
| 49 | - create_customer_shipping_address(constants.customerProfileId) | ||
| 49 | + create_customer_shipping_address(constants.customerProfileId) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,27 +6,27 @@ | |||
| 6 | 6 | constants = imp.load_source('modulename', 'constants.py') | |
| 7 | 7 | ||
| 8 | 8 | def delete_customer_payment_profile(customerProfileId, customerPaymentProfileId): | |
| 9 | - merchantAuth = apicontractsv1.merchantAuthenticationType() | ||
| 10 | - merchantAuth.name = constants.apiLoginId | ||
| 11 | - merchantAuth.transactionKey = constants.transactionKey | ||
| 9 | + merchantAuth = apicontractsv1.merchantAuthenticationType() | ||
| 10 | + merchantAuth.name = constants.apiLoginId | ||
| 11 | + merchantAuth.transactionKey = constants.transactionKey | ||
| 12 | 12 | ||
| 13 | - deleteCustomerPaymentProfile = apicontractsv1.deleteCustomerPaymentProfileRequest() | ||
| 14 | - deleteCustomerPaymentProfile.merchantAuthentication = merchantAuth | ||
| 15 | - deleteCustomerPaymentProfile.customerProfileId = customerProfileId | ||
| 16 | - deleteCustomerPaymentProfile.customerPaymentProfileId = customerPaymentProfileId | ||
| 13 | + deleteCustomerPaymentProfile = apicontractsv1.deleteCustomerPaymentProfileRequest() | ||
| 14 | + deleteCustomerPaymentProfile.merchantAuthentication = merchantAuth | ||
| 15 | + deleteCustomerPaymentProfile.customerProfileId = customerProfileId | ||
| 16 | + deleteCustomerPaymentProfile.customerPaymentProfileId = customerPaymentProfileId | ||
| 17 | 17 | ||
| 18 | - controller = deleteCustomerPaymentProfileController(deleteCustomerPaymentProfile) | ||
| 19 | - controller.execute() | ||
| 18 | + controller = deleteCustomerPaymentProfileController(deleteCustomerPaymentProfile) | ||
| 19 | + controller.execute() | ||
| 20 | 20 | ||
| 21 | - response = controller.getresponse() | ||
| 21 | + response = controller.getresponse() | ||
| 22 | 22 | ||
| 23 | - if (response.messages.resultCode=="Ok"): | ||
| 24 | - print("Successfully deleted customer payment profile with customer profile id %s" % deleteCustomerPaymentProfile.customerProfileId) | ||
| 25 | - else: | ||
| 26 | - print(response.messages.message[0]['text'].text) | ||
| 27 | - print("Failed to delete customer paymnet profile with customer profile id %s" % deleteCustomerPaymentProfile.customerProfileId) | ||
| 23 | + if (response.messages.resultCode=="Ok"): | ||
| 24 | + print("Successfully deleted customer payment profile with customer profile id %s" % deleteCustomerPaymentProfile.customerProfileId) | ||
| 25 | + else: | ||
| 26 | + print(response.messages.message[0]['text'].text) | ||
| 27 | + print("Failed to delete customer paymnet profile with customer profile id %s" % deleteCustomerPaymentProfile.customerProfileId) | ||
| 28 | 28 | ||
| 29 | - return response | ||
| 29 | + return response | ||
| 30 | 30 | ||
| 31 | 31 | if(os.path.basename(__file__) == os.path.basename(sys.argv[0])): | |
| 32 | - delete_customer_payment_profile(constants.customerProfileId, constants.customerPaymentProfileId) | ||
| 32 | + delete_customer_payment_profile(constants.customerProfileId, constants.customerPaymentProfileId) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,26 +6,26 @@ | |||
| 6 | 6 | constants = imp.load_source('modulename', 'constants.py') | |
| 7 | 7 | ||
| 8 | 8 | def delete_customer_profile(customerProfileId): | |
| 9 | - merchantAuth = apicontractsv1.merchantAuthenticationType() | ||
| 10 | - merchantAuth.name = constants.apiLoginId | ||
| 11 | - merchantAuth.transactionKey = constants.transactionKey | ||
| 9 | + merchantAuth = apicontractsv1.merchantAuthenticationType() | ||
| 10 | + merchantAuth.name = constants.apiLoginId | ||
| 11 | + merchantAuth.transactionKey = constants.transactionKey | ||
| 12 | 12 | ||
| 13 | - deleteCustomerProfile = apicontractsv1.deleteCustomerProfileRequest() | ||
| 14 | - deleteCustomerProfile.merchantAuthentication = merchantAuth | ||
| 15 | - deleteCustomerProfile.customerProfileId = customerProfileId | ||
| 13 | + deleteCustomerProfile = apicontractsv1.deleteCustomerProfileRequest() | ||
| 14 | + deleteCustomerProfile.merchantAuthentication = merchantAuth | ||
| 15 | + deleteCustomerProfile.customerProfileId = customerProfileId | ||
| 16 | 16 | ||
| 17 | - controller = deleteCustomerProfileController(deleteCustomerProfile) | ||
| 18 | - controller.execute() | ||
| 17 | + controller = deleteCustomerProfileController(deleteCustomerProfile) | ||
| 18 | + controller.execute() | ||
| 19 | 19 | ||
| 20 | - response = controller.getresponse() | ||
| 20 | + response = controller.getresponse() | ||
| 21 | 21 | ||
| 22 | - if (response.messages.resultCode=="Ok"): | ||
| 23 | - print("Successfully deleted customer with customer profile id %s" % deleteCustomerProfile.customerProfileId) | ||
| 24 | - else: | ||
| 25 | - print(response.messages.message[0]['text'].text) | ||
| 26 | - print("Failed to delete customer profile with customer profile id %s" % deleteCustomerProfile.customerProfileId) | ||
| 22 | + if (response.messages.resultCode=="Ok"): | ||
| 23 | + print("Successfully deleted customer with customer profile id %s" % deleteCustomerProfile.customerProfileId) | ||
| 24 | + else: | ||
| 25 | + print(response.messages.message[0]['text'].text) | ||
| 26 | + print("Failed to delete customer profile with customer profile id %s" % deleteCustomerProfile.customerProfileId) | ||
| 27 | 27 | ||
| 28 | - return response | ||
| 28 | + return response | ||
| 29 | 29 | ||
| 30 | 30 | if(os.path.basename(__file__) == os.path.basename(sys.argv[0])): | |
| 31 | - delete_customer_profile(constants.customerProfileId) | ||
| 31 | + delete_customer_profile(constants.customerProfileId) | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments