Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,48 +9,45 @@

//author @krgupta
public class GetUnsettledTransactionList{

public static ANetApiResponse run(String apiLoginId, String transactionKey) {
ApiOperationBase.setEnvironment(Environment.SANDBOX);
public static ANetApiResponse run(String apiLoginId, String transactionKey) {
ApiOperationBase.setEnvironment(Environment.SANDBOX);

MerchantAuthenticationType merchantAuthenticationType = new MerchantAuthenticationType() ;
merchantAuthenticationType.setName(apiLoginId);
merchantAuthenticationType.setTransactionKey(transactionKey);
ApiOperationBase.setMerchantAuthentication(merchantAuthenticationType);
MerchantAuthenticationType merchantAuthenticationType = new MerchantAuthenticationType() ;
merchantAuthenticationType.setName(apiLoginId);
merchantAuthenticationType.setTransactionKey(transactionKey);
ApiOperationBase.setMerchantAuthentication(merchantAuthenticationType);

GetUnsettledTransactionListRequest getRequest = new GetUnsettledTransactionListRequest();
getRequest.setMerchantAuthentication(merchantAuthenticationType);
getRequest.setStatus(TransactionGroupStatusEnum.ANY);
GetUnsettledTransactionListRequest getRequest = new GetUnsettledTransactionListRequest();
getRequest.setMerchantAuthentication(merchantAuthenticationType);
getRequest.setStatus(TransactionGroupStatusEnum.ANY);

Paging paging = new Paging();
paging.setLimit(100);
paging.setOffset(1);
Paging paging = new Paging();
paging.setLimit(100);
paging.setOffset(1);

getRequest.setPaging(paging);
getRequest.setPaging(paging);

TransactionListSorting sorting = new TransactionListSorting();
sorting.setOrderBy(TransactionListOrderFieldEnum.ID);
sorting.setOrderDescending(true);
TransactionListSorting sorting = new TransactionListSorting();
sorting.setOrderBy(TransactionListOrderFieldEnum.ID);
sorting.setOrderDescending(true);

getRequest.setSorting(sorting);

GetUnsettledTransactionListController controller = new GetUnsettledTransactionListController(getRequest);
controller.execute();
GetUnsettledTransactionListResponse getResponse = controller.getApiResponse();

if (getResponse!=null) {

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 unsettled transaction list: " + getResponse.getMessages().getResultCode());
}
}
return getResponse;

}
getRequest.setSorting(sorting);

GetUnsettledTransactionListController controller = new GetUnsettledTransactionListController(getRequest);
controller.execute();
GetUnsettledTransactionListResponse getResponse = controller.getApiResponse();

if (getResponse!=null) {
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 unsettled transaction list: " + getResponse.getMessages().getResultCode());
}
}
return getResponse;

}
}