-
Notifications
You must be signed in to change notification settings - Fork 460
Expand file tree
/
Copy pathGetAcceptCustomerProfilePage.java
More file actions
59 lines (44 loc) · 2.22 KB
/
GetAcceptCustomerProfilePage.java
File metadata and controls
59 lines (44 loc) · 2.22 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
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.GetHostedProfilePageController;
import net.authorize.api.controller.base.ApiOperationBase;
import net.authorize.sample.SampleCodeTest.*;
public class GetAcceptCustomerProfilePage {
public static ANetApiResponse run(String apiLoginId, String transactionKey, String customerProfileId) {
if ( null == ApiOperationBase.getEnvironment() )
{
ApiOperationBase.setEnvironment(Environment.SANDBOX);
}
MerchantAuthenticationType merchantAuthenticationType = new MerchantAuthenticationType() ;
merchantAuthenticationType.setName(apiLoginId);
merchantAuthenticationType.setTransactionKey(transactionKey);
ApiOperationBase.setMerchantAuthentication(merchantAuthenticationType);
SettingType setting = new SettingType();
setting.setSettingName("hostedProfileReturnUrl");
setting.setSettingValue("https://returnurl.com/return/");
ArrayOfSetting alist = new ArrayOfSetting();
alist.getSetting().add(setting);
GetHostedProfilePageRequest apiRequest = new GetHostedProfilePageRequest();
apiRequest.setCustomerProfileId(customerProfileId);
apiRequest.setHostedProfileSettings(alist);
GetHostedProfilePageController controller = new GetHostedProfilePageController(apiRequest);
controller.execute();
GetHostedProfilePageResponse response = new GetHostedProfilePageResponse();
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.getToken());
}
else
{
System.out.println("Failed to get hosted profile page: " + response.getMessages().getResultCode());
}
}
return response;
}
}