yolk / valvat

Validates european vat numbers. Standalone or as a ActiveModel validator.
MIT License
321 stars 80 forks source link

Support for Apple Distribution International in Italy #104

Closed albertbellonch closed 3 years ago

albertbellonch commented 3 years ago

Hello,

At Quipu, one of the features we offer is helping our users fill tax forms for Spain. One of them ("Modelo 349") includes operations with parties from other European countries, and we validate the checksum for these parties via valvat.

Today we came across Apple Distribution International in Italy, with VAT IT00146089990 (can be found here, under Informazioni aziendali). Following the Italian validations implemented here, we see that the province (digits 7-9, 999 for this specific case) is validated to be either within 1 to 100, 120 or 121.

Nevertheless, Apple Distribution International's is a valid VAT in the VIES website: image

We can only guess that Italy has the 999 reserved for special occasions like this one, apart from the real provinces already supported by the gem.

Do you know something else about this case? What would be the best way for the gem to support it? We would be more than happy to submit a PR, either supporting the 999 province as well, supporting this specific VAT (does not seem the best way) or another solution you might deem appropriate.

Thanks for your work! ❤️

yolk commented 3 years ago

Hi Albert!

Thanks a lot for the hint. Didn't know about these special cases. I just modified the italian checksum code to allow 999 as regional part. Could you please take a look if this fixes your issue.

Have a nice day & all the best to spain, Sebastian.

albertbellonch commented 3 years ago

Hi Sebastian,

Amazing! Thanks for implementing a solution that quickly.

We temporarily allowed this specific VAT as a special case, so after taking a look at your commit I'm sure it will work wonders. We'll use the current edge from GitHub for now (apart from reverting the special case on our codebase).

What's your release strategy for new versions? How can be notified of new releases?

Thanks again :)

Best,

yolk commented 3 years ago

Hi Albert, thanks for your feedback. I just released v1.1.1 of valvat, containing the fixed italian checksum calculation.

albertbellonch commented 3 years ago

Hi Sebastian, thanks again for your quick response. Cheers!