drahosistvan / vatvalidation

A simple wrapper for VIES VAT Validation WebService.
MIT License
13 stars 6 forks source link

EL / Greek VRNs do not validate #10

Closed Kier closed 5 years ago

Kier commented 5 years ago

I've noticed that this tool marks EL-prefixed VRNs as invalid.

The following VRNs are valid according to VIES, but invalid when checked with this validator:

I think the problem is the use of 'GR' in the formatVatNumber $pattern, where 'GR' is used rather than 'EL'.

Fix: $pattern = '/^(AT|BE|BG|CY|CZ|DE|DK|EE|EL|ES|FI|FR|GB|HR|HU|IE|IT|LT|LU|LV|MT|NL|PL|PT|RO|SE|SI|SK)[A-Z0-9]{6,20}$/';

drahosistvan commented 5 years ago

@Kier #11 was merged into master! Thank you very much for your fast fix. Maybe in later versions I will refactor the code based on this specification: https://www.avalara.com/vatlive/en/eu-vat-rules/eu-vat-number-registration/eu-vat-number-formats.html