Skip to content

Commit bc0b1fb

Browse files
author
Sunny Raj Rathod
authored
Merge pull request AuthorizeNet#63 from akashshah1203/master
Adding GetCustomerProfileTransactionList sample code
2 parents ecc6768 + fb4c0e7 commit bc0b1fb

File tree

3 files changed

+72
-0
lines changed

3 files changed

+72
-0
lines changed

src/main/java/net/authorize/sample/SampleCode.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ private static void ShowMethods()
112112
System.out.println(" GetCustomerPaymentProfileList");
113113
System.out.println(" GetCustomerProfile");
114114
System.out.println(" GetCustomerProfileIds");
115+
System.out.println(" GetCustomerProfileTransactionList");
115116
System.out.println(" GetCustomerShippingAddress");
116117
System.out.println(" GetAcceptCustomerProfilePage");
117118
System.out.println(" UpdateCustomerPaymentProfile");
@@ -271,6 +272,10 @@ private static void RunMethod(String methodName)
271272
case "GetCustomerProfileIds":
272273
GetCustomerProfileIds.run(apiLoginId, transactionKey);
273274
break;
275+
case "GetCustomerProfileTransactionList":
276+
customerProfileId = "1811474252";
277+
GetCustomerProfileTransactionList.run(apiLoginId, transactionKey, customerProfileId);
278+
break;
274279
case "GetCustomerShippingAddress":
275280
GetCustomerShippingAddress.run(apiLoginId, transactionKey, customerProfileId, customerAddressId);
276281
break;
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
package net.authorize.sample.TransactionReporting;
2+
3+
import java.util.List;
4+
5+
import net.authorize.Environment;
6+
import net.authorize.api.contract.v1.*;
7+
import net.authorize.api.controller.GetTransactionListForCustomerController;
8+
import net.authorize.api.controller.base.ApiOperationBase;
9+
10+
//author @akashah
11+
public class GetCustomerProfileTransactionList{
12+
13+
public static ANetApiResponse run(String apiLoginId, String transactionKey, String customerProfileId) {
14+
ApiOperationBase.setEnvironment(Environment.SANDBOX);
15+
16+
MerchantAuthenticationType merchantAuthenticationType = new MerchantAuthenticationType() ;
17+
merchantAuthenticationType.setName(apiLoginId);
18+
merchantAuthenticationType.setTransactionKey(transactionKey);
19+
ApiOperationBase.setMerchantAuthentication(merchantAuthenticationType);
20+
21+
22+
GetTransactionListForCustomerRequest getRequest = new GetTransactionListForCustomerRequest();
23+
getRequest.setMerchantAuthentication(merchantAuthenticationType);
24+
getRequest.setCustomerProfileId(customerProfileId);
25+
26+
Paging paging = new Paging();
27+
paging.setLimit(100);
28+
paging.setOffset(1);
29+
30+
getRequest.setPaging(paging);
31+
32+
TransactionListSorting sorting = new TransactionListSorting();
33+
sorting.setOrderBy(TransactionListOrderFieldEnum.ID);
34+
sorting.setOrderDescending(true);
35+
36+
getRequest.setSorting(sorting);
37+
38+
GetTransactionListForCustomerController controller = new GetTransactionListForCustomerController(getRequest);
39+
controller.execute();
40+
41+
GetTransactionListResponse getResponse = controller.getApiResponse();
42+
if (getResponse!=null) {
43+
ArrayOfTransactionSummaryType transactions = getResponse.getTransactions();
44+
List<TransactionSummaryType> list = transactions.getTransaction();
45+
46+
for(TransactionSummaryType summary : list)
47+
{
48+
System.out.println(summary.getFirstName());
49+
System.out.println(summary.getTransId());
50+
System.out.println(summary.getSettleAmount());
51+
System.out.println(summary.getSubmitTimeLocal());
52+
}
53+
54+
if (getResponse.getMessages().getResultCode() == MessageTypeEnum.OK) {
55+
System.out.println(getResponse.getMessages().getMessage().get(0).getCode());
56+
System.out.println(getResponse.getMessages().getMessage().get(0).getText());
57+
}
58+
else
59+
{
60+
System.out.println("Failed to get transaction list: " + getResponse.getMessages().getResultCode());
61+
}
62+
}
63+
return getResponse;
64+
65+
}
66+
}

src/test/java/net/authorize/sample/SampleCodeTest/SampleCodeList.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ PaymentTransactions.UpdateSplitTenderGroup 0 1
4545
PaymentTransactions.UpdateHeldTransation 0 0
4646
PaymentTransactions.GetAnAcceptPaymentPage 1 1
4747
TransactionReporting.GetTransactionList 0 1
48+
TransactionReporting.GetTransactionListForCustomer 1 1
4849
TransactionReporting.GetUnsettledTransactionList 0 1
4950
TransactionReporting.GetBatchStatistics 0 1
5051
TransactionReporting.GetSettledBatchList 0 1

0 commit comments

Comments
 (0)