Skip to content

Commit 4a2f9b3

Browse files
committed
Sample code for get customer profile
Adds the sample for retrieving customer profile for a given customer profile id. Signed-off-by: Srijan Misra <[email protected]>
1 parent 3d1bd84 commit 4a2f9b3

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from authorizenet import apicontractsv1
2+
from authorizenet.apicontrollers import *
3+
4+
merchantAuth = apicontractsv1.merchantAuthenticationType()
5+
merchantAuth.name = '5KP3u95bQpv'
6+
merchantAuth.transactionKey = '4Ktq966gC55GAX7S'
7+
8+
getCustomerProfile = apicontractsv1.getCustomerProfileRequest()
9+
getCustomerProfile.merchantAuthentication = merchantAuth
10+
getCustomerProfile.customerProfileId = '36152115'
11+
12+
getCustomerProfileController = getCustomerProfileController(getCustomerProfile)
13+
getCustomerProfileController.execute()
14+
15+
response = getCustomerProfileController.getresponse()
16+
17+
if (response.messages.resultCode=="Ok"):
18+
print "Successfully retrieved a customer with profile id %s and customer id %s" % (getCustomerProfile.customerProfileId, response.profile.merchantCustomerId)
19+
for paymentProfile in response.profile.paymentProfiles:
20+
print "Payment Profile ID %s" % paymentProfile.customerPaymentProfileId
21+
for ship in response.profile.shipToList:
22+
print "Shipping Details:"
23+
print "First Name %s" % ship.firstName
24+
print "Last Name %s" % ship.lastName
25+
print "Address %s" % ship.address
26+
print "Customer Address ID %s" % ship.customerAddressId
27+
else:
28+
print "response code: %s" % response.messages.resultCode
29+
print "Failed to get customer profile information with id %s" % getCustomerProfile.customerProfileId

0 commit comments

Comments
 (0)