|
9 | 9 |
|
10 | 10 | //author @krgupta |
11 | 11 | public class GetUnsettledTransactionList{ |
12 | | - |
13 | | - public static ANetApiResponse run(String apiLoginId, String transactionKey) { |
14 | | - ApiOperationBase.setEnvironment(Environment.SANDBOX); |
| 12 | + public static ANetApiResponse run(String apiLoginId, String transactionKey) { |
| 13 | + ApiOperationBase.setEnvironment(Environment.SANDBOX); |
15 | 14 |
|
16 | | - MerchantAuthenticationType merchantAuthenticationType = new MerchantAuthenticationType() ; |
17 | | - merchantAuthenticationType.setName(apiLoginId); |
18 | | - merchantAuthenticationType.setTransactionKey(transactionKey); |
19 | | - ApiOperationBase.setMerchantAuthentication(merchantAuthenticationType); |
| 15 | + MerchantAuthenticationType merchantAuthenticationType = new MerchantAuthenticationType() ; |
| 16 | + merchantAuthenticationType.setName(apiLoginId); |
| 17 | + merchantAuthenticationType.setTransactionKey(transactionKey); |
| 18 | + ApiOperationBase.setMerchantAuthentication(merchantAuthenticationType); |
20 | 19 |
|
21 | | - GetUnsettledTransactionListRequest getRequest = new GetUnsettledTransactionListRequest(); |
22 | | - getRequest.setMerchantAuthentication(merchantAuthenticationType); |
23 | | - getRequest.setStatus(TransactionGroupStatusEnum.ANY); |
| 20 | + GetUnsettledTransactionListRequest getRequest = new GetUnsettledTransactionListRequest(); |
| 21 | + getRequest.setMerchantAuthentication(merchantAuthenticationType); |
| 22 | + getRequest.setStatus(TransactionGroupStatusEnum.ANY); |
24 | 23 |
|
25 | | - Paging paging = new Paging(); |
26 | | - paging.setLimit(100); |
27 | | - paging.setOffset(1); |
| 24 | + Paging paging = new Paging(); |
| 25 | + paging.setLimit(100); |
| 26 | + paging.setOffset(1); |
28 | 27 |
|
29 | | - getRequest.setPaging(paging); |
| 28 | + getRequest.setPaging(paging); |
30 | 29 |
|
31 | | - TransactionListSorting sorting = new TransactionListSorting(); |
32 | | - sorting.setOrderBy(TransactionListOrderFieldEnum.ID); |
33 | | - sorting.setOrderDescending(true); |
| 30 | + TransactionListSorting sorting = new TransactionListSorting(); |
| 31 | + sorting.setOrderBy(TransactionListOrderFieldEnum.ID); |
| 32 | + sorting.setOrderDescending(true); |
34 | 33 |
|
35 | | - getRequest.setSorting(sorting); |
36 | | - |
37 | | - GetUnsettledTransactionListController controller = new GetUnsettledTransactionListController(getRequest); |
38 | | - controller.execute(); |
39 | | - GetUnsettledTransactionListResponse getResponse = controller.getApiResponse(); |
40 | | - |
41 | | - if (getResponse!=null) { |
42 | | - |
43 | | - if (getResponse.getMessages().getResultCode() == MessageTypeEnum.OK) { |
44 | | - |
45 | | - System.out.println(getResponse.getMessages().getMessage().get(0).getCode()); |
46 | | - System.out.println(getResponse.getMessages().getMessage().get(0).getText()); |
47 | | - } |
48 | | - else |
49 | | - { |
50 | | - System.out.println("Failed to get unsettled transaction list: " + getResponse.getMessages().getResultCode()); |
51 | | - } |
52 | | - } |
53 | | - return getResponse; |
54 | | - |
55 | | - } |
| 34 | + getRequest.setSorting(sorting); |
| 35 | + |
| 36 | + GetUnsettledTransactionListController controller = new GetUnsettledTransactionListController(getRequest); |
| 37 | + controller.execute(); |
| 38 | + GetUnsettledTransactionListResponse getResponse = controller.getApiResponse(); |
| 39 | + |
| 40 | + if (getResponse!=null) { |
| 41 | + if (getResponse.getMessages().getResultCode() == MessageTypeEnum.OK) { |
| 42 | + System.out.println(getResponse.getMessages().getMessage().get(0).getCode()); |
| 43 | + System.out.println(getResponse.getMessages().getMessage().get(0).getText()); |
| 44 | + } |
| 45 | + else |
| 46 | + { |
| 47 | + System.out.println("Failed to get unsettled transaction list: " + getResponse.getMessages().getResultCode()); |
| 48 | + } |
| 49 | + } |
| 50 | + return getResponse; |
| 51 | + |
| 52 | + } |
56 | 53 | } |
0 commit comments