Skip to content

Commit eae640b

Browse files
author
krgupta
committed
Transaction Reporting Test
1 parent 0739c08 commit eae640b

5 files changed

Lines changed: 128 additions & 25 deletions

File tree

src/main/java/net/authorize/sample/Reporting/GetUnsettledTransactions.java

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,41 @@
1-
package TransactionReporting;
1+
package net.authorize.sample.TransactionReporting;
22

3+
import net.authorize.Environment;
4+
import net.authorize.api.contract.v1.*;
5+
import net.authorize.api.controller.GetBatchStatisticsController;
6+
import net.authorize.api.controller.base.ApiOperationBase;
7+
8+
//author @krgupta
39
public class GetBatchStatistics {
10+
11+
public static void run(String apiLoginId, String transactionKey) {
12+
ApiOperationBase.setEnvironment(Environment.SANDBOX);
13+
14+
MerchantAuthenticationType merchantAuthenticationType = new MerchantAuthenticationType() ;
15+
merchantAuthenticationType.setName(apiLoginId);
16+
merchantAuthenticationType.setTransactionKey(transactionKey);
17+
ApiOperationBase.setMerchantAuthentication(merchantAuthenticationType);
18+
19+
GetBatchStatisticsRequest getRequest = new GetBatchStatisticsRequest();
20+
getRequest.setMerchantAuthentication(merchantAuthenticationType);
21+
String batchId = "12345";
22+
getRequest.setBatchId(batchId);
23+
24+
GetBatchStatisticsController controller = new GetBatchStatisticsController(getRequest);
25+
controller.execute();
26+
GetBatchStatisticsResponse getResponse = controller.getApiResponse();
27+
28+
if (getResponse!=null) {
429

5-
public static void main(String apiLoginId, String transactionKey) {
6-
// TODO Auto-generated method stub
7-
System.out.println("Get Batch Statistics Sample");
8-
}
30+
if (getResponse.getMessages().getResultCode() == MessageTypeEnum.OK) {
931

10-
}
32+
System.out.println(getResponse.getMessages().getMessage().get(0).getCode());
33+
System.out.println(getResponse.getMessages().getMessage().get(0).getText());
34+
}
35+
else
36+
{
37+
System.out.println("Failed to cancel Subscription: " + getResponse.getMessages().getResultCode());
38+
}
39+
}
40+
}
41+
}

src/main/java/net/authorize/sample/TransactionReporting/GetTransactionDetails.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33

44
import net.authorize.Environment;
55
import net.authorize.api.contract.v1.*;
6-
import net.authorize.api.contract.v1.GetTransactionDetailsRequest;
7-
import net.authorize.api.contract.v1.GetTransactionDetailsResponse;
8-
import net.authorize.api.contract.v1.MerchantAuthenticationType;
9-
import net.authorize.api.contract.v1.TransactionDetailsType;
106
import net.authorize.api.controller.GetTransactionDetailsController;
117
import net.authorize.api.controller.base.ApiOperationBase;
128

@@ -33,8 +29,18 @@ public static void run(String apiLoginId, String transactionKey) {
3329
controller.execute();
3430
GetTransactionDetailsResponse getResponse = controller.getApiResponse();
3531

36-
System.out.println(" TransactionDetails : " + getResponse.getTransaction());
37-
32+
if (getResponse!=null) {
33+
34+
if (getResponse.getMessages().getResultCode() == MessageTypeEnum.OK) {
35+
36+
System.out.println(getResponse.getMessages().getMessage().get(0).getCode());
37+
System.out.println(getResponse.getMessages().getMessage().get(0).getText());
38+
}
39+
else
40+
{
41+
System.out.println("Failed to cancel Subscription: " + getResponse.getMessages().getResultCode());
42+
}
43+
}
3844
}
3945
}
4046

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,42 @@
1-
package TransactionReporting;
1+
package net.authorize.sample.TransactionReporting;
22

3-
public class GetTransactionList {
3+
import net.authorize.Environment;
4+
import net.authorize.api.contract.v1.*;
5+
import net.authorize.api.controller.GetTransactionListController;
6+
import net.authorize.api.controller.base.ApiOperationBase;
47

5-
public static void main(String apiLoginId, String transactionKey) {
6-
// TODO Auto-generated method stub
7-
System.out.println("Get Batch Statistics Sample");
8-
}
8+
//author @krgupta
9+
public class GetTransactionList{
10+
11+
public static void run(String apiLoginId, String transactionKey) {
12+
ApiOperationBase.setEnvironment(Environment.SANDBOX);
913

14+
MerchantAuthenticationType merchantAuthenticationType = new MerchantAuthenticationType() ;
15+
merchantAuthenticationType.setName(apiLoginId);
16+
merchantAuthenticationType.setTransactionKey(transactionKey);
17+
ApiOperationBase.setMerchantAuthentication(merchantAuthenticationType);
18+
19+
String batchId = "4594221";
20+
21+
GetTransactionListRequest getRequest = new GetTransactionListRequest();
22+
getRequest.setMerchantAuthentication(merchantAuthenticationType);
23+
getRequest.setBatchId(batchId);
24+
25+
GetTransactionListController controller = new GetTransactionListController(getRequest);
26+
controller.execute();
27+
28+
GetTransactionListResponse getResponse = controller.getApiResponse();
29+
if (getResponse!=null) {
30+
31+
if (getResponse.getMessages().getResultCode() == MessageTypeEnum.OK) {
32+
System.out.println(getResponse.getMessages().getMessage().get(0).getCode());
33+
System.out.println(getResponse.getMessages().getMessage().get(0).getText());
34+
}
35+
else
36+
{
37+
System.out.println("Failed to cancel Subscription: " + getResponse.getMessages().getResultCode());
38+
}
39+
}
40+
41+
}
1042
}
Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,45 @@
1-
package TransactionReporting;
1+
package net.authorize.sample.TransactionReporting;
22

3-
public class GetUnsettledTransactionList {
43

5-
public static void main(String apiLoginId, String transactionKey) {
6-
// TODO Auto-generated method stub
7-
System.out.println("Get Batch Statistics Sample");
8-
}
4+
import net.authorize.Environment;
5+
import net.authorize.api.contract.v1.*;
6+
7+
import net.authorize.api.controller.GetSettledBatchListController;
8+
import net.authorize.api.controller.GetUnsettledTransactionListController;
9+
import net.authorize.api.controller.base.ApiOperationBase;
10+
11+
//author @krgupta
12+
public class GetUnsettledTransactionList{
13+
14+
public static void run(String apiLoginId, String transactionKey) {
15+
ApiOperationBase.setEnvironment(Environment.SANDBOX);
16+
17+
MerchantAuthenticationType merchantAuthenticationType = new MerchantAuthenticationType() ;
18+
merchantAuthenticationType.setName(apiLoginId);
19+
merchantAuthenticationType.setTransactionKey(transactionKey);
20+
ApiOperationBase.setMerchantAuthentication(merchantAuthenticationType);
21+
22+
23+
GetUnsettledTransactionListRequest getRequest = new GetUnsettledTransactionListRequest();
24+
getRequest.setMerchantAuthentication(merchantAuthenticationType);
25+
926

27+
GetUnsettledTransactionListController controller = new GetUnsettledTransactionListController(getRequest);
28+
controller.execute();
29+
GetUnsettledTransactionListResponse getResponse = controller.getApiResponse();
30+
31+
if (getResponse!=null) {
32+
33+
if (getResponse.getMessages().getResultCode() == MessageTypeEnum.OK) {
34+
35+
System.out.println(getResponse.getMessages().getMessage().get(0).getCode());
36+
System.out.println(getResponse.getMessages().getMessage().get(0).getText());
37+
}
38+
else
39+
{
40+
System.out.println("Failed to cancel Subscription: " + getResponse.getMessages().getResultCode());
41+
}
42+
}
43+
44+
}
1045
}

0 commit comments

Comments
 (0)