Search code examples
javabraintreebraintree-data

Braintree Java Implementation of Validation Error codes creating customer


I am using braintree with java, While creating the customer profile, I am getting the error messages like this

try{

            CustomerRequest request = new CustomerRequest()
                    .firstName("Kim")
                    .lastName("Jones")
                    .company("Jones Co.")
                    .email("[email protected]")
                    .fax("419-555-1234")
                    .phone("614-555-1234")
                    .id("asdasda23423433")
                    .paymentMethodNonce("88878692-0157-40c3-b23b-51c113ebf160")

                    .website("http://example.com");
                Result<Customer> result = gateway.customer().create(request);
                System.out.println("\n\n\t isSuccess=="+result.getSubscription());

        ValidationErrors validationErrors=result.getErrors();


for (ValidationError validationError : validationErrors.getAllDeepValidationErrors()) {
            ValidationErrorCode validationErrorCode=validationError.getCode();
            System.out.println("\n\t code==>"+validationErrorCode+"\t msg- "+validationError.getMessage());
        }

The problem is this validationErrorCode is coming as constant For ex:

CUSTOMER_ID_IS_IN_USE

PAYMENT_METHOD_PAYMENT_METHOD_NONCE_UNKNOWN

I didn't find this error codes in document anywhere

How I can get the remaining error codes?

I have been stuck. Please help.


Solution

  • I believe what you are looking for is the list of Braintree Validation Errors.