Hello,
I'm using the Reporting API SDK in Java, and frequently (around 20% of transactions) I'm unable to access the payer's first or last names.
Most of them are from ARB, but occasionally one will be a standard one-off payment.
As you can see in the snippet I've copied below, I first attempt to get a Customer object from the TransactionDetails object; if that comes back NULL (which it does in most (all?) of these cases), I'm also attempting to use the more-straightforward TransactionDetails.getFirstName() and getLastName() which typically don't return anything, either.
If a Customer object exists, I'll first try obtaining a name pair from the billing Address object, and failing that, from the shipping Address object.
What's strange is that, if I look up the tranactions on the auth.net site, the names will be displayed in the appropriate fields.
I must be missing something -- what is it? Thank you!
// trxDetails is a TransactionDetails object
Customer customer = trxDetails.getCustomer();
if(customer != null){
customerID = (customer.getId() == null) ? "": customer.getId();
Address address = customer.getBillTo();
if(address != null){
firstName = (address.getFirstName() == null) ? "" : address.getFirstName();
lastName = (address.getLastName() == null) ? "" : address.getLastName();
}
else{
address = customer.getShipTo();
if(address != null){
firstName = (address.getFirstName() == null) ? "" : address.getFirstName();
lastName = (address.getLastName() == null) ? "" : address.getLastName();
}
}
}
if(firstName.equals("")){
firstName = (trxDetails.getFirstName() == null) ? "" : trxDetails.getFirstName();
lastName = (trxDetails.getLastName() == null) ? "" : trxDetails.getLastName();
}
03-28-2013 09:00 AM - edited 03-28-2013 09:10 AM
In another thread, I found out that this is a bug in the Java SDK itself.
04-02-2013 10:37 AM