-
Notifications
You must be signed in to change notification settings - Fork 460
Expand file tree
/
Copy pathGetCustomerShippingAddress.java
More file actions
71 lines (56 loc) · 3.21 KB
/
GetCustomerShippingAddress.java
File metadata and controls
71 lines (56 loc) · 3.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package net.authorize.sample.CustomerProfiles;
import net.authorize.Environment;
import net.authorize.api.contract.v1.*;
import net.authorize.api.contract.v1.MerchantAuthenticationType;
import net.authorize.api.controller.base.ApiOperationBase;
import net.authorize.api.controller.GetCustomerShippingAddressController;
import net.authorize.api.controller.base.ApiOperationBase;
import net.authorize.sample.SampleCodeTest.*;
public class GetCustomerShippingAddress {
public static ANetApiResponse run(String apiLoginId, String transactionKey, String customerProfileId,
String customerAddressId) {
if ( null == ApiOperationBase.getEnvironment() )
{
ApiOperationBase.setEnvironment(Environment.SANDBOX);
}
MerchantAuthenticationType merchantAuthenticationType = new MerchantAuthenticationType() ;
merchantAuthenticationType.setName(apiLoginId);
merchantAuthenticationType.setTransactionKey(transactionKey);
ApiOperationBase.setMerchantAuthentication(merchantAuthenticationType);
GetCustomerShippingAddressRequest apiRequest = new GetCustomerShippingAddressRequest();
apiRequest.setCustomerProfileId(customerProfileId);
apiRequest.setCustomerAddressId(customerAddressId);
GetCustomerShippingAddressController controller = new GetCustomerShippingAddressController(apiRequest);
controller.execute();
GetCustomerShippingAddressResponse response = new GetCustomerShippingAddressResponse();
response = controller.getApiResponse();
if (response!=null) {
if (response.getMessages().getResultCode() == MessageTypeEnum.OK) {
System.out.println(response.getMessages().getMessage().get(0).getCode());
System.out.println(response.getMessages().getMessage().get(0).getText());
System.out.println(response.getAddress().getFirstName());
System.out.println(response.getAddress().getLastName());
System.out.println(response.getAddress().getCompany());
System.out.println(response.getAddress().getAddress());
System.out.println(response.getAddress().getCity());
System.out.println(response.getAddress().getState());
System.out.println(response.getAddress().getZip());
System.out.println(response.getAddress().getCountry());
System.out.println(response.getAddress().getPhoneNumber());
System.out.println(response.getAddress().getFaxNumber());
System.out.println(response.getAddress().getCustomerAddressId());
if((response.getSubscriptionIds() != null) && (response.getSubscriptionIds().getSubscriptionId() != null) &&
(!response.getSubscriptionIds().getSubscriptionId().isEmpty())){
System.out.println("List of subscriptions:");
for(String subscriptionid : response.getSubscriptionIds().getSubscriptionId())
System.out.println(subscriptionid);
}
}
else
{
System.out.println("Failed to get customer shipping address: " + response.getMessages().getResultCode());
}
}
return response;
}
}