Reply
Contributor
Posts: 14
Registered: ‎02-16-2012
Accepted Solution

why GetTransactionDetail or GetTransactionList is fail. looks my code

 I want  getTransactionDetail or GetTransactionList.

 

sample:

public static void GetAuthroizeMessage(String apiLogID, String transactionKey)
	{
		Merchant merchant = Merchant.createMerchant(Environment.SANDBOX, apiLogID, transactionKey);
		Transaction transaction = merchant.createReportingTransaction(TransactionType.GET_TRANSACTION_DETAILS);
		ReportingDetails reportingDetails = ReportingDetails.createReportingDetails();
		reportingDetails.setBatchIncludeStatistics(true);
		transaction.setReportingDetails(reportingDetails);
		Result<Transaction> result = (Result<Transaction>) merchant.postTransaction(transaction);
		
		System.out.println("Result Code:" + result.getResultCode() != null ? result.getResultCode() :" No result code");
		if(result.isOk()){
			for (TransactionDetails transactionDetail : result.getReportingDetails().getTransactionDetailList()) 
			{
				System.out.println("AccountNumber: "+transactionDetail.getAccountNumber());
				System.out.println("AuthCode: "+transactionDetail.getAuthCode());
				System.out.println("Firstname: "+transactionDetail.getFirstName());
				System.out.println("LastName : "+transactionDetail.getLastName());
				System.out.println("InvoiceNumber: "+transactionDetail.getInvoiceNumber());
				System.out.println("transID: "+transactionDetail.getTransId());
				System.out.println("BatchID: "+transactionDetail.getBatch().getBatchId());
				System.out.println(" AuthAmount: "+transactionDetail.getAuthAmount().doubleValue());
				System.out.println("Customer Email: "+transactionDetail.getCustomer().getEmail());
				System.out.println("Customer FaxNumber: "+transactionDetail.getCustomer().getFaxNumber());
				System.out.println("Customer BillTo: "+ transactionDetail.getCustomer().getBillTo());
				System.out.println("SettlementState: "+transactionDetail.getBatch().getSettlementState());
			}
		}
		
	}
	

 I want to this code getTransactionDetail. or GetTransactionList.

change

Transaction transaction = merchant.createReportingTransaction(TransactionType.GET_TRANSACTION_DETAILS);

but fail.

 

any idea! or give me some advice! thx!

 


Accepted Solutions
Solution
Accepted by topic author david-jiang
‎08-21-2015 01:58 AM
Contributor
Posts: 14
Registered: ‎02-16-2012

Re: why GetTransactionDetail or GetTransactionList is fail. looks my code

 

hi RaynorC1emen7

 Thanks you for you help!

 

 So I solve it.

 

 this is my think and success

 

 The first : get BatchId from use GET_SETTLED_BATCH_LIST call.

 The second: getTransactionList  use GET_TRANSACTION_LIST

 The third : getTransactionDetail  use GET_TRANSACTION_DETAILS

 

ok this is my java Code. if you want ,you can debug it.

public class Client {

	public static void main(String[] args) {
		String login = " ";
		String transactionKey = " ";
		getSettledBatchList(login, transactionKey);
	}

	public static void getSettledBatchList(String login,
			String transactionKey) {

		Merchant merchant = Merchant.createMerchant(Environment.SANDBOX,
				login, transactionKey);
		// batch list request
		net.authorize.reporting.Transaction transaction = merchant
				.createReportingTransaction(TransactionType.GET_SETTLED_BATCH_LIST);
		ReportingDetails reportingDetails = ReportingDetails
				.createReportingDetails();
		Calendar firstSettlementCal = Calendar.getInstance();
		firstSettlementCal.add(Calendar.DAY_OF_YEAR, -2);
		reportingDetails.setBatchFirstSettlementDate(firstSettlementCal
				.getTime());
		reportingDetails.setBatchLastSettlementDate(Calendar.getInstance()
				.getTime());
		reportingDetails.setBatchIncludeStatistics(true);
		transaction.setReportingDetails(reportingDetails);

		Result<Transaction> result = (Result<Transaction>) merchant
				.postTransaction(transaction);

		for (BatchDetails batchDetail : result.getReportingDetails()
				.getBatchDetailsList()) {

			getTransactionList(batchDetail.getBatchId(), login,transactionKey)
			
		}
	}

	
	public static void getTransactionList(String reportingBatchId,
			String login, String transactionKey) {
		System.out.println("GetTransactionList Start....");
		Merchant merchant = Merchant.createMerchant(Environment.SANDBOX,
				login, transactionKey);
		net.authorize.reporting.Transaction transaction = merchant
				.createReportingTransaction(TransactionType.GET_TRANSACTION_LIST);
		ReportingDetails reportingDetails = ReportingDetails
				.createReportingDetails();
		reportingDetails.setBatchId(reportingBatchId);
		transaction.setReportingDetails(reportingDetails);

		Result<Transaction> result = (Result<Transaction>) merchant
				.postTransaction(transaction);

		
		for (TransactionDetails transactionDetail : result
				.getReportingDetails().getTransactionDetailList()) {
		
			String reportingTransId = transactionDetail.getTransId();
			String type = transactionDetail.getAccountType().getValue();
			getTransactionDetailsRequestLive(reportingTransId, login,
					transactionKey);
			
		}

		System.out.println("GetTransctionList End....");
	}

	public static void getTransactionDetailsRequestLive(
			String reportingTransId, String login, String transactionKey) {
		System.out.println("GetTransactionDetails Start....");
		Merchant merchant = Merchant.createMerchant(Environment.SANDBOX,
				login, transactionKey);
		net.authorize.reporting.Transaction transaction = merchant
				.createReportingTransaction(TransactionType.GET_TRANSACTION_DETAILS);
		ReportingDetails reportingDetails = ReportingDetails
				.createReportingDetails();
		reportingDetails.setTransactionId(reportingTransId);
		transaction.setReportingDetails(reportingDetails);

		Result<Transaction> result = (Result<Transaction>) merchant
				.postTransaction(transaction);
		for (TransactionDetails transactionDetail : result
				.getReportingDetails().getTransactionDetailList()) 
			{

			
			if (transactionDetail.getOrder().getOrderItems().size() > 0)
				{
				
				for (OrderItem order : transactionDetail.getOrder()
						.getOrderItems()) {
					
				}
			}
		}

		System.out.println("GetTransactionDetails End....");
	}
}

 

 

View solution in original post


All Replies
Highlighted
Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: why GetTransactionDetail or GetTransactionList is fail. looks my code

Don't use java anymore but the documentation http://developer.authorize.net/api/transaction_details/

said GetTransactionDetail need a TransactionID and the GetTransactionList need a batchID.

So I don't think is just changing the TransactionType.GET_TRANSACTION_DETAILS.

And when you said fail, what error are you getting? compile error? authorize.net error?

Solution
Accepted by topic author david-jiang
‎08-21-2015 01:58 AM
Contributor
Posts: 14
Registered: ‎02-16-2012

Re: why GetTransactionDetail or GetTransactionList is fail. looks my code

 

hi RaynorC1emen7

 Thanks you for you help!

 

 So I solve it.

 

 this is my think and success

 

 The first : get BatchId from use GET_SETTLED_BATCH_LIST call.

 The second: getTransactionList  use GET_TRANSACTION_LIST

 The third : getTransactionDetail  use GET_TRANSACTION_DETAILS

 

ok this is my java Code. if you want ,you can debug it.

public class Client {

	public static void main(String[] args) {
		String login = " ";
		String transactionKey = " ";
		getSettledBatchList(login, transactionKey);
	}

	public static void getSettledBatchList(String login,
			String transactionKey) {

		Merchant merchant = Merchant.createMerchant(Environment.SANDBOX,
				login, transactionKey);
		// batch list request
		net.authorize.reporting.Transaction transaction = merchant
				.createReportingTransaction(TransactionType.GET_SETTLED_BATCH_LIST);
		ReportingDetails reportingDetails = ReportingDetails
				.createReportingDetails();
		Calendar firstSettlementCal = Calendar.getInstance();
		firstSettlementCal.add(Calendar.DAY_OF_YEAR, -2);
		reportingDetails.setBatchFirstSettlementDate(firstSettlementCal
				.getTime());
		reportingDetails.setBatchLastSettlementDate(Calendar.getInstance()
				.getTime());
		reportingDetails.setBatchIncludeStatistics(true);
		transaction.setReportingDetails(reportingDetails);

		Result<Transaction> result = (Result<Transaction>) merchant
				.postTransaction(transaction);

		for (BatchDetails batchDetail : result.getReportingDetails()
				.getBatchDetailsList()) {

			getTransactionList(batchDetail.getBatchId(), login,transactionKey)
			
		}
	}

	
	public static void getTransactionList(String reportingBatchId,
			String login, String transactionKey) {
		System.out.println("GetTransactionList Start....");
		Merchant merchant = Merchant.createMerchant(Environment.SANDBOX,
				login, transactionKey);
		net.authorize.reporting.Transaction transaction = merchant
				.createReportingTransaction(TransactionType.GET_TRANSACTION_LIST);
		ReportingDetails reportingDetails = ReportingDetails
				.createReportingDetails();
		reportingDetails.setBatchId(reportingBatchId);
		transaction.setReportingDetails(reportingDetails);

		Result<Transaction> result = (Result<Transaction>) merchant
				.postTransaction(transaction);

		
		for (TransactionDetails transactionDetail : result
				.getReportingDetails().getTransactionDetailList()) {
		
			String reportingTransId = transactionDetail.getTransId();
			String type = transactionDetail.getAccountType().getValue();
			getTransactionDetailsRequestLive(reportingTransId, login,
					transactionKey);
			
		}

		System.out.println("GetTransctionList End....");
	}

	public static void getTransactionDetailsRequestLive(
			String reportingTransId, String login, String transactionKey) {
		System.out.println("GetTransactionDetails Start....");
		Merchant merchant = Merchant.createMerchant(Environment.SANDBOX,
				login, transactionKey);
		net.authorize.reporting.Transaction transaction = merchant
				.createReportingTransaction(TransactionType.GET_TRANSACTION_DETAILS);
		ReportingDetails reportingDetails = ReportingDetails
				.createReportingDetails();
		reportingDetails.setTransactionId(reportingTransId);
		transaction.setReportingDetails(reportingDetails);

		Result<Transaction> result = (Result<Transaction>) merchant
				.postTransaction(transaction);
		for (TransactionDetails transactionDetail : result
				.getReportingDetails().getTransactionDetailList()) 
			{

			
			if (transactionDetail.getOrder().getOrderItems().size() > 0)
				{
				
				for (OrderItem order : transactionDetail.getOrder()
						.getOrderItems()) {
					
				}
			}
		}

		System.out.println("GetTransactionDetails End....");
	}
}