accodeing / fortnox-api

Gem that abstracts Fortnox's F3 API
GNU Lesser General Public License v3.0
9 stars 8 forks source link

AccountNumber validation #183

Closed ehannes closed 5 years ago

ehannes commented 5 years ago

Our validation of AccountNumber is invalid. It is used by the Customer model and maybe some more resource that I do not know of.

Fortnox allows two unset values for AccountNumber: '' and null. We only support the latter for the moment. So when we get a Customer that has the attribute set to empty string, we get this error message:

"" (String) has invalid type for :sales_account violates constraints (type?(Integer, "") AND gteq?(0, "") AND lteq?(9999, "") failed) (Dry::Types::SchemaError)

So we need to change our validation logic to support this case.