Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions CustomerProfiles/create-customer-shipping-address.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Gives error if an address is already present for the given customer Id
from authorizenet import apicontractsv1
from authorizenet.apicontrollers import *

# Give merchant details
merchantAuth = apicontractsv1.merchantAuthenticationType()
merchantAuth.name = '5KP3u95bQpv'
merchantAuth.transactionKey = '4Ktq966gC55GAX7S'

# Give address details
officeAddress = apicontractsv1.customerAddressType();
officeAddress.firstName = "John"
officeAddress.lastName = "Doe"
officeAddress.address = "123 Main St."
officeAddress.city = "Bellevue"
officeAddress.state = "WA"
officeAddress.zip = "98004"
officeAddress.country = "USA"
officeAddress.phoneNumber = "000-000-0000"

# Create shipping address request
shippingAddressRequest = apicontractsv1.createCustomerShippingAddressRequest();
shippingAddressRequest.address = officeAddress
shippingAddressRequest.customerProfileId = "36152165"
shippingAddressRequest.merchantAuthentication = merchantAuth

# Make an API call
createCustomerShippingAddressController= createCustomerShippingAddressController(shippingAddressRequest)
createCustomerShippingAddressController.execute()
response = createCustomerShippingAddressController.getresponse();

if response.messages.resultCode == "Ok":
print "SUCCESS"
print "Transaction ID : %s " % response.messages.message[0].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
27 changes: 27 additions & 0 deletions CustomerProfiles/delete-customer-shipping-address.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from authorizenet import apicontractsv1
from authorizenet.apicontrollers import *

# Give merchant details
merchantAuth = apicontractsv1.merchantAuthenticationType()
merchantAuth.name = '5KP3u95bQpv'
merchantAuth.transactionKey = '4Ktq966gC55GAX7S'

# create delete request
deleteShippingAddress = apicontractsv1.deleteCustomerShippingAddressRequest()
deleteShippingAddress.merchantAuthentication = merchantAuth
deleteShippingAddress.customerProfileId = "36152165"
deleteShippingAddress.customerAddressId = "36413544"

# Make the API call
deleteShippingAddressController = deleteCustomerShippingAddressController(deleteShippingAddress)
deleteShippingAddressController.execute()
response = deleteShippingAddressController.getresponse()

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
else:
print "ERROR"
print "Message code : %s " % response.messages.message[0].code
print "Message text : %s " % response.messages.message[0].text
32 changes: 32 additions & 0 deletions CustomerProfiles/get-customer-shipping-address.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from authorizenet import apicontractsv1
from authorizenet.apicontrollers import *

# Give merchant details
merchantAuth = apicontractsv1.merchantAuthenticationType()
merchantAuth.name = '5KP3u95bQpv'
merchantAuth.transactionKey = '4Ktq966gC55GAX7S'

# create get shipping address request
getShippingAddress = apicontractsv1.getCustomerShippingAddressRequest()
getShippingAddress.merchantAuthentication = merchantAuth
getShippingAddress.customerProfileId = "36152165"
getShippingAddress.customerAddressId = "36413544"

# Make the API call
getShippingAddressController = getCustomerShippingAddressController(getShippingAddress)
getShippingAddressController.execute()
response = getShippingAddressController.getresponse()

if response.messages.resultCode == "Ok":
print "SUCCESS"
print "The address is"
print response.address.firstName +" " + response.address.lastName
print response.address.address
print response.address.city
print response.address.state
print response.address.zip
print response.address.country
else:
print "ERROR"
print "Message code : %s " % response.messages.message[0].code
print "Message text : %s " % response.messages.message[0].text
39 changes: 39 additions & 0 deletions CustomerProfiles/update-customer-shipping-address.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
from authorizenet import apicontractsv1
from authorizenet.apicontrollers import *

# Give merchant details
merchantAuth = apicontractsv1.merchantAuthenticationType()
merchantAuth.name = '5KP3u95bQpv'
merchantAuth.transactionKey = '4Ktq966gC55GAX7S'

# Give updated address details
officeAddress = apicontractsv1.customerAddressExType()
officeAddress.firstName = "Sherlock"
officeAddress.lastName = "Holmes"
officeAddress.address = "221B Baker Street"
officeAddress.city = "London"
officeAddress.state = "WA"
officeAddress.zip = "98004"
officeAddress.country = "UK"
officeAddress.phoneNumber = "000-000-0000"
officeAddress.customerAddressId = "36413544"

# Create update shipping address request
updateShippingAddressRequest = apicontractsv1.updateCustomerShippingAddressRequest()
updateShippingAddressRequest.address = officeAddress
updateShippingAddressRequest.customerProfileId = "36152165"
updateShippingAddressRequest.merchantAuthentication = merchantAuth

# Make the API call
updateShippingAddressController = updateCustomerShippingAddressController(updateShippingAddressRequest)
updateShippingAddressController.execute()
response = updateShippingAddressController.getresponse()

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
else:
print "ERROR"
print "Message code : %s " % response.messages.message[0].code
print "Message text : %s " % response.messages.message[0].text