Result Objects
Note
        API calls that don't have validations, such as searches, will return
        a collection of requested objectsinstead of a result object.
    
Success results
    If the API call was successful, the `isSuccess()` on the result will return
    {true}.
    - Java
 
result.isSuccess(); // true
Transaction transaction = result.getTarget();- Java
 
Result<customer> customerResult = gateway.customer().create(new CustomerRequest());
Customer customer = customerResult.getTarget();
Result<transaction> transactionResult = gateway.transaction().sale(new TransactionRequest());
Transaction transaction = transactionResult.getTarget();Error results
    If the API call was not successful, the success on the result will return
    {false}. An error may be due to:
    - A validation error caused by invalid parameters
 - A processor decline or gateway rejection
 - Other exceptional conditions
 
- Java
 
result.isSuccess(); // false
ValidationErrors errors = result.getErrors();- Java
 
CustomerRequest request = new CustomerRequest()
  .email("invalid_email")
  .creditCard()
  .number("not_numeric")
  .done();
for (ValidationError error : result.getErrors().getAllDeepValidationErrors()) {
  System.out.println(error.getAttribute());
  System.out.println(error.getCode());
  System.out.println(error.getMessage());
}
List<validationerror> customerErrors = result.getErrors().forObject("customer").getAllValidationErrors();
for (ValidationError error : customerErrors) {
  System.out.println(error.getAttribute());
  System.out.println(error.getCode());
  System.out.println(error.getMessage());
}
List<validationerror> creditCardErrors = result.getErrors().forObject("customer").forObject("creditCard").getAllValidationErrors();
for (ValidationError error : creditCardErrors) {
  System.out.println(error.getAttribute());
  System.out.println(error.getCode());
  System.out.println(error.getMessage());
}Message
    The message on the error result gives a human-readable description of what went wrong,
    regardless of the cause and nature of the error.
    - Java
 
System.out.println(result.getMessage()); // "Amount is required.\nCredit card number is invalid."Note This was added in version {{sdkVersionForDate "Jul09_2010"}} 
Params
    Error results include the parameters that were submitted. This can be useful during
    Transparent Redirects to repopulate your form if validations fail.
    - Java
 
System.out.println(result.getParameters()); // {transaction[amount]=1000.00, transaction[type]=sale, transaction[credit_card][expiration_date]=05/2012}