besepa / besepa-ruby

Ruby client for besepa.com
besepa.com
MIT License
3 stars 3 forks source link

Validation errors #7

Closed dgilperez closed 8 years ago

dgilperez commented 8 years ago

Hi!

Is there any way to get information about validation errors from the API? Right now, I'm just receiving a 422 error when trying to add a debit to a customer, with no further explanation:

Besepa::Customer.find(id).add_debit("XXXXXXX", "XXXXXX", "My description", 10000, "2014-05-10", nil, nil)
# => Besepa::Errors::InvalidResourceError: (Status 422) invalid_resource (El recurso no se puedo guardar porque falló alguna de las validaciones)

Both customer and bank_account exist.

Thanks!

dgilperez commented 8 years ago

Well, I think I solved it: there is a validation for collect_at date being greater than today.

Anyway, I think a more verbose error would be a nice to have.