diff --git a/src/main/java/net/authorize/sample/SampleCode.java b/src/main/java/net/authorize/sample/SampleCode.java index 6510860d..4803d1f9 100644 --- a/src/main/java/net/authorize/sample/SampleCode.java +++ b/src/main/java/net/authorize/sample/SampleCode.java @@ -112,6 +112,7 @@ private static void ShowMethods() System.out.println(" GetCustomerPaymentProfileList"); System.out.println(" GetCustomerProfile"); System.out.println(" GetCustomerProfileIds"); + System.out.println(" GetCustomerProfileTransactionList"); System.out.println(" GetCustomerShippingAddress"); System.out.println(" GetAcceptCustomerProfilePage"); System.out.println(" UpdateCustomerPaymentProfile"); @@ -271,6 +272,10 @@ private static void RunMethod(String methodName) case "GetCustomerProfileIds": GetCustomerProfileIds.run(apiLoginId, transactionKey); break; + case "GetCustomerProfileTransactionList": + customerProfileId = "1811474252"; + GetCustomerProfileTransactionList.run(apiLoginId, transactionKey, customerProfileId); + break; case "GetCustomerShippingAddress": GetCustomerShippingAddress.run(apiLoginId, transactionKey, customerProfileId, customerAddressId); break; diff --git a/src/main/java/net/authorize/sample/TransactionReporting/GetCustomerProfileTransactionList.java b/src/main/java/net/authorize/sample/TransactionReporting/GetCustomerProfileTransactionList.java new file mode 100644 index 00000000..8f893091 --- /dev/null +++ b/src/main/java/net/authorize/sample/TransactionReporting/GetCustomerProfileTransactionList.java @@ -0,0 +1,66 @@ +package net.authorize.sample.TransactionReporting; + +import java.util.List; + +import net.authorize.Environment; +import net.authorize.api.contract.v1.*; +import net.authorize.api.controller.GetTransactionListForCustomerController; +import net.authorize.api.controller.base.ApiOperationBase; + +//author @akashah +public class GetCustomerProfileTransactionList{ + + public static ANetApiResponse run(String apiLoginId, String transactionKey, String customerProfileId) { + ApiOperationBase.setEnvironment(Environment.SANDBOX); + + MerchantAuthenticationType merchantAuthenticationType = new MerchantAuthenticationType() ; + merchantAuthenticationType.setName(apiLoginId); + merchantAuthenticationType.setTransactionKey(transactionKey); + ApiOperationBase.setMerchantAuthentication(merchantAuthenticationType); + + + GetTransactionListForCustomerRequest getRequest = new GetTransactionListForCustomerRequest(); + getRequest.setMerchantAuthentication(merchantAuthenticationType); + getRequest.setCustomerProfileId(customerProfileId); + + Paging paging = new Paging(); + paging.setLimit(100); + paging.setOffset(1); + + getRequest.setPaging(paging); + + TransactionListSorting sorting = new TransactionListSorting(); + sorting.setOrderBy(TransactionListOrderFieldEnum.ID); + sorting.setOrderDescending(true); + + getRequest.setSorting(sorting); + + GetTransactionListForCustomerController controller = new GetTransactionListForCustomerController(getRequest); + controller.execute(); + + GetTransactionListResponse getResponse = controller.getApiResponse(); + if (getResponse!=null) { + ArrayOfTransactionSummaryType transactions = getResponse.getTransactions(); + List list = transactions.getTransaction(); + + for(TransactionSummaryType summary : list) + { + System.out.println(summary.getFirstName()); + System.out.println(summary.getTransId()); + System.out.println(summary.getSettleAmount()); + System.out.println(summary.getSubmitTimeLocal()); + } + + if (getResponse.getMessages().getResultCode() == MessageTypeEnum.OK) { + System.out.println(getResponse.getMessages().getMessage().get(0).getCode()); + System.out.println(getResponse.getMessages().getMessage().get(0).getText()); + } + else + { + System.out.println("Failed to get transaction list: " + getResponse.getMessages().getResultCode()); + } + } + return getResponse; + + } +} diff --git a/src/test/java/net/authorize/sample/SampleCodeTest/SampleCodeList.txt b/src/test/java/net/authorize/sample/SampleCodeTest/SampleCodeList.txt index 153c6666..73dc212c 100644 --- a/src/test/java/net/authorize/sample/SampleCodeTest/SampleCodeList.txt +++ b/src/test/java/net/authorize/sample/SampleCodeTest/SampleCodeList.txt @@ -45,6 +45,7 @@ PaymentTransactions.UpdateSplitTenderGroup 0 1 PaymentTransactions.UpdateHeldTransation 0 0 PaymentTransactions.GetAnAcceptPaymentPage 1 1 TransactionReporting.GetTransactionList 0 1 +TransactionReporting.GetTransactionListForCustomer 1 1 TransactionReporting.GetUnsettledTransactionList 0 1 TransactionReporting.GetBatchStatistics 0 1 TransactionReporting.GetSettledBatchList 0 1