|
1 | | -package TransactionReporting; |
| 1 | +package net.authorize.sample.TransactionReporting; |
2 | 2 |
|
| 3 | +import net.authorize.Environment; |
| 4 | +import net.authorize.api.contract.v1.*; |
| 5 | +import net.authorize.api.controller.GetSettledBatchListController; |
| 6 | +import net.authorize.api.controller.base.ApiOperationBase; |
| 7 | + |
| 8 | +//author @krgupta |
3 | 9 | public class GetSettledBatchList { |
4 | 10 |
|
5 | | - public static void main(String apiLoginId, String transactionKey) { |
6 | | - // TODO Auto-generated method stub |
7 | | - System.out.println("Get Batch Statistics Sample"); |
8 | | - } |
| 11 | + public static void run(String apiLoginId, String transactionKey) { |
| 12 | + |
| 13 | + ApiOperationBase.setEnvironment(Environment.SANDBOX); |
| 14 | + |
| 15 | + MerchantAuthenticationType merchantAuthenticationType = new MerchantAuthenticationType() ; |
| 16 | + merchantAuthenticationType.setName(apiLoginId); |
| 17 | + merchantAuthenticationType.setTransactionKey(transactionKey); |
| 18 | + ApiOperationBase.setMerchantAuthentication(merchantAuthenticationType); |
| 19 | + |
| 20 | + GetSettledBatchListRequest getRequest = new GetSettledBatchListRequest(); |
| 21 | + getRequest.setMerchantAuthentication(merchantAuthenticationType); |
| 22 | + GetSettledBatchListController controller = new GetSettledBatchListController(getRequest); |
| 23 | + controller.execute(); |
| 24 | + GetSettledBatchListResponse getResponse = new GetSettledBatchListResponse(); |
| 25 | + if (getResponse!=null) { |
| 26 | + |
| 27 | + if (getResponse.getMessages().getResultCode() == MessageTypeEnum.OK) { |
9 | 28 |
|
| 29 | + System.out.println(getResponse.getMessages().getMessage().get(0).getCode()); |
| 30 | + System.out.println(getResponse.getMessages().getMessage().get(0).getText()); |
| 31 | + } |
| 32 | + else |
| 33 | + { |
| 34 | + System.out.println("Failed to get settled batch list: " + getResponse.getMessages().getResultCode()); |
| 35 | + } |
| 36 | + } |
10 | 37 | } |
| 38 | +} |
| 39 | + |
| 40 | + |
0 commit comments