我在这里要问的是确切的查询:http://mvnrepository.com/artifact/net.authorize/anet-java-sdk。我正在使用java.net.HttpURLConnection中的anet-java-sdk(1.8.4)。 我希望获得已结算和未结算交易的清单。但是,当我运行以下代码时,我发现错误来了:
public static final String apiLoginID = "xxxxxxxxxxxx";
public static final String transactionKey = "yyyyyyyyyyyyyxxx";
public static void main(String[] args) {
Merchant merchant = Merchant.createMerchant(Environment.SANDBOX, apiLoginID, transactionKey);
Transaction transaction = merchant.createReportingTransaction(TransactionType.GET_TRANSACTION_DETAILS);
ReportingDetails details = ReportingDetails.createReportingDetails();
details.setBatchIncludeStatistics(true);
transaction.setReportingDetails(details);
Result<Transaction> result = (Result<Transaction>) merchant.postTransaction(transaction);
System.out.println("Code : "+result.getMessages().get(0).getCode());
System.out.println("Text : "+result.getMessages().get(0).getText());
for (BatchDetails batchDetail : result.getReportingDetails().getBatchDetailsList()) {
System.out.println("---------------------");
System.out.println("ID : "+ batchDetail.getBatchId() );
System.out.println("Settlement State : "+ batchDetail.getSettlementState().value());
System.out.println("local settlementTime: "+ batchDetail.getSettlementTimeLocal().toString());
}
}
出现的错误如下: 07/11/15 02:22:16,984:INFO [main](net.authorize.util.LogHelper:24) - 使用代理:'false'
Code : E00003
Text : The element 'getTransactionDetailsRequest' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has incomplete content. List of possible elements expected: 'refId, transId' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.
答案 0 :(得分:1)
您对Authorize.Net API提出的请求不正确,
如果您想获得已结算交易清单
使用:getSettledBatchListRequest
如果您想获得未结算交易的清单
使用:getUnsettledTransactionListRequest
相反,我发现你正在使用getTransactionDetailsRequest
提供单个事务的详细信息,因此它需要一个transactionID,这是你得到的错误。
有关这些类型API的更多信息,请参阅:Authorize.Net Reference
的java示例代码