|
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) |
0 commit comments