Skip to content

Commit 039b180

Browse files
committed
Merge pull request AuthorizeNet#4 from abansalm/master
Added sample codes for createCustomerShippingAddress, deleteCustomerS…
2 parents 0555d36 + 9fc8820 commit 039b180

File tree

4 files changed

+137
-0
lines changed

4 files changed

+137
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Gives error if an address is already present for the given customer Id
2+
from authorizenet import apicontractsv1
3+
from authorizenet.apicontrollers import *
4+
5+
# Give merchant details
6+
merchantAuth = apicontractsv1.merchantAuthenticationType()
7+
merchantAuth.name = '5KP3u95bQpv'
8+
merchantAuth.transactionKey = '4Ktq966gC55GAX7S'
9+
10+
# Give address details
11+
officeAddress = apicontractsv1.customerAddressType();
12+
officeAddress.firstName = "John"
13+
officeAddress.lastName = "Doe"
14+
officeAddress.address = "123 Main St."
15+
officeAddress.city = "Bellevue"
16+
officeAddress.state = "WA"
17+
officeAddress.zip = "98004"
18+
officeAddress.country = "USA"
19+
officeAddress.phoneNumber = "000-000-0000"
20+
21+
# Create shipping address request
22+
shippingAddressRequest = apicontractsv1.createCustomerShippingAddressRequest();
23+
shippingAddressRequest.address = officeAddress
24+
shippingAddressRequest.customerProfileId = "36152165"
25+
shippingAddressRequest.merchantAuthentication = merchantAuth
26+
27+
# Make an API call
28+
createCustomerShippingAddressController= createCustomerShippingAddressController(shippingAddressRequest)
29+
createCustomerShippingAddressController.execute()
30+
response = createCustomerShippingAddressController.getresponse();
31+
32+
if response.messages.resultCode == "Ok":
33+
print "SUCCESS"
34+
print "Transaction ID : %s " % response.messages.message[0].text
35+
print "Customer address id : %s" % response.customerAddressId
36+
else:
37+
print "ERROR"
38+
print "Message code : %s " % response.messages.message[0].code
39+
print "Message text : %s " % response.messages.message[0].text
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from authorizenet import apicontractsv1
2+
from authorizenet.apicontrollers import *
3+
4+
# Give merchant details
5+
merchantAuth = apicontractsv1.merchantAuthenticationType()
6+
merchantAuth.name = '5KP3u95bQpv'
7+
merchantAuth.transactionKey = '4Ktq966gC55GAX7S'
8+
9+
# create delete request
10+
deleteShippingAddress = apicontractsv1.deleteCustomerShippingAddressRequest()
11+
deleteShippingAddress.merchantAuthentication = merchantAuth
12+
deleteShippingAddress.customerProfileId = "36152165"
13+
deleteShippingAddress.customerAddressId = "36413544"
14+
15+
# Make the API call
16+
deleteShippingAddressController = deleteCustomerShippingAddressController(deleteShippingAddress)
17+
deleteShippingAddressController.execute()
18+
response = deleteShippingAddressController.getresponse()
19+
20+
if response.messages.resultCode == "Ok":
21+
print "SUCCESS"
22+
print "Message code : %s " % response.messages.message[0].code
23+
print "Message text : %s " % response.messages.message[0].text
24+
else:
25+
print "ERROR"
26+
print "Message code : %s " % response.messages.message[0].code
27+
print "Message text : %s " % response.messages.message[0].text
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
from authorizenet import apicontractsv1
2+
from authorizenet.apicontrollers import *
3+
4+
# Give merchant details
5+
merchantAuth = apicontractsv1.merchantAuthenticationType()
6+
merchantAuth.name = '5KP3u95bQpv'
7+
merchantAuth.transactionKey = '4Ktq966gC55GAX7S'
8+
9+
# create get shipping address request
10+
getShippingAddress = apicontractsv1.getCustomerShippingAddressRequest()
11+
getShippingAddress.merchantAuthentication = merchantAuth
12+
getShippingAddress.customerProfileId = "36152165"
13+
getShippingAddress.customerAddressId = "36413544"
14+
15+
# Make the API call
16+
getShippingAddressController = getCustomerShippingAddressController(getShippingAddress)
17+
getShippingAddressController.execute()
18+
response = getShippingAddressController.getresponse()
19+
20+
if response.messages.resultCode == "Ok":
21+
print "SUCCESS"
22+
print "The address is"
23+
print response.address.firstName +" " + response.address.lastName
24+
print response.address.address
25+
print response.address.city
26+
print response.address.state
27+
print response.address.zip
28+
print response.address.country
29+
else:
30+
print "ERROR"
31+
print "Message code : %s " % response.messages.message[0].code
32+
print "Message text : %s " % response.messages.message[0].text
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
from authorizenet import apicontractsv1
2+
from authorizenet.apicontrollers import *
3+
4+
# Give merchant details
5+
merchantAuth = apicontractsv1.merchantAuthenticationType()
6+
merchantAuth.name = '5KP3u95bQpv'
7+
merchantAuth.transactionKey = '4Ktq966gC55GAX7S'
8+
9+
# Give updated address details
10+
officeAddress = apicontractsv1.customerAddressExType()
11+
officeAddress.firstName = "Sherlock"
12+
officeAddress.lastName = "Holmes"
13+
officeAddress.address = "221B Baker Street"
14+
officeAddress.city = "London"
15+
officeAddress.state = "WA"
16+
officeAddress.zip = "98004"
17+
officeAddress.country = "UK"
18+
officeAddress.phoneNumber = "000-000-0000"
19+
officeAddress.customerAddressId = "36413544"
20+
21+
# Create update shipping address request
22+
updateShippingAddressRequest = apicontractsv1.updateCustomerShippingAddressRequest()
23+
updateShippingAddressRequest.address = officeAddress
24+
updateShippingAddressRequest.customerProfileId = "36152165"
25+
updateShippingAddressRequest.merchantAuthentication = merchantAuth
26+
27+
# Make the API call
28+
updateShippingAddressController = updateCustomerShippingAddressController(updateShippingAddressRequest)
29+
updateShippingAddressController.execute()
30+
response = updateShippingAddressController.getresponse()
31+
32+
if response.messages.resultCode == "Ok":
33+
print "SUCCESS"
34+
print "Message code : %s " % response.messages.message[0].code
35+
print "Message text : %s " % response.messages.message[0].text
36+
else:
37+
print "ERROR"
38+
print "Message code : %s " % response.messages.message[0].code
39+
print "Message text : %s " % response.messages.message[0].text

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy