A collection of validation errors.
result = Braintree::Customer.create(
:email => "invalid",
:credit_card => {
:number => "invalidnumber",
:billing_address => {
:country_name => "invalid"
}
}
)
result.success?
#=> false
result.errors.for(:customer).on(:email)
#=> [#<Braintree::ValidationError (81604) Email is an invalid format.>]
result.errors.for(:customer).for(:credit_card).on(:number)
#=> [#<Braintree::ValidationError (81715) Credit card number is invalid.>]
result.errors.for(:customer).for(:credit_card).for(:billing_address).on(:country_name)
#=> [#<Braintree::ValidationError (91803) Country name is not an accepted country.>]
For more detailed documentation on ValidationErrors, see www.braintreepaymentsolutions.com/gateway/validation-errors
Returns an array of ValidationError objects at this level and all nested levels in the error hierarchy
Returns a ValidationErrorCollection of errors nested under the given nested_key. Returns nil if there are not any errors nested under the given key.
Returns an array of ValidationError objects on the given attribute.
Returns an array of ValidationError objects at the given level in the error hierarchy