cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Java SDK: TransactionDetails.isFullTransactionDetails() returning false. Why?

Does anyone know under what conditions TransactionDetails.isFullTransactionDetails() will return false?  This is from the Java Reporting API SDK.

 

I'm having an issue where a not-insignificant number of transactions are coming back missing data; specifically, TransactionDetails.getCustomer() is returning null, which is problematic as I cannot access name/address data.  In these cases, isFullTransactionDetails() will return false.  This is occurring even on successfully-settled transactions.

 

What's even more interesting is that I've tested these same incomplete transactions in the PHP SDK, and am receiving back the appropriate data.

 

Anyone have any ideas?

seanc_cole
Member
7 REPLIES 7

Might need to debug the source, probably a problem with the SDKs.

RaynorC1emen7
Expert

That's what I was worried about; from digging through the forums, it looks like that Java SDK is not widely-used; plus, given the relative newness of the Reporting API, it could very well be buggy.

 

I'll dive into the SDK source and debug there, if I come up with anything I'll post back for anyone who may run into this in the future (and hopefully create an action item for the SDK devs).

Ok, I've dug through the SDK source, and it is indeed a bug in the Java SDK.

 

The problem lies in net.authorize.reporting.Result.  This class reads the BasicXmlDocument that's built from the parsed XML response.

 

The bug is in the importTransactionDetails() method, which pulls the various data from the XML nodes and populates the Result object.  What's happening is that this method is looking for a customer node, and if and only if a customer node exists, will it look for a billto and shipTo node.  As a result, not all available data fields are being populated, and presumably (by some mechanism, I haven't dug completely into it) the isFullTransactionDetails flag is set to false.

 

However, billto and shipTo are not children of customer (they are children of the transaction container), and a customer node does not necessarily always get sent (which may be a bug in the API endpoint, itself -- but that's a separate subject).

 

A workaround would be to query the xml response itself (this example extracts only the billTo node, but a similar method could extract the shipTo node).

 

 

ReportingDetails reportingDetails = result.getReportingDetails();
Transaction t = result.getTarget();
BasicXmlDocument xml = t.getCurrentResponse();

NodeList transactions_list = xml.getDocument().getElementsByTagName(AuthNetField.ELEMENT_TRANSACTION.getFieldName());
Element transaction_el =(Element)transactions_list.item(0);

NodeList bill_to_list = transaction_el.getElementsByTagName(AuthNetField.ELEMENT_BILL_TO.getFieldName());

String elFirstName = "";
String elLastName = "";
String elCompany = "";
String elAddress = "";
String elCity = "";
String elState = "";
String elZip = "";
String elCountry = "";
String elPhoneNumber = "";
String elFaxNumber = "";

if(bill_to_list != null && bill_to_list.getLength() == 1) {
	Element address_el = (Element)bill_to_list.item(0);
	
	elFirstName = BasicXmlDocument.getElementText(address_el, AuthNetField.ELEMENT_FIRST_NAME.getFieldName());
	elLastName = BasicXmlDocument.getElementText(address_el, AuthNetField.ELEMENT_LAST_NAME.getFieldName());
	elCompany = BasicXmlDocument.getElementText(address_el, AuthNetField.ELEMENT_COMPANY.getFieldName());
	elAddress = BasicXmlDocument.getElementText(address_el, AuthNetField.ELEMENT_ADDRESS.getFieldName());
	elCity = BasicXmlDocument.getElementText(address_el, AuthNetField.ELEMENT_CITY.getFieldName());
	elState = BasicXmlDocument.getElementText(address_el, AuthNetField.ELEMENT_STATE.getFieldName());
	elZip = BasicXmlDocument.getElementText(address_el, AuthNetField.ELEMENT_ZIP.getFieldName());
	elCountry = BasicXmlDocument.getElementText(address_el, AuthNetField.ELEMENT_COUNTRY.getFieldName());
	elPhoneNumber = BasicXmlDocument.getElementText(address_el, AuthNetField.ELEMENT_PHONE_NUMBER.getFieldName());
	elFaxNumber = BasicXmlDocument.getElementText(address_el, AuthNetField.ELEMENT_FAX_NUMBER.getFieldName());
}

EDIT: I'd like to note that this is occurring in version 1.4.6 of the SDK, presumably the latest that's available.

Agree. This is still broken. Any ETA on a fix? I'm running against my own version of the code right now.

An FYI if anyone else needs this...

 

net.authorize.reporting.Result - Line 356

 

customer.setShipTo(billToAddress);

 

If you need this fixed, check out the SDK, and change the line to: 

 

customer.setShipTo(shipToAddress);

Hello,

 

This issue is now resolved and an updated SDK is available from GitHub: https://github.com/AuthorizeNet/sdk-java/

 

Richard