ibericode / vat-bundle

Symfony bundle for ibericode/vat
https://packagist.org/packages/ibericode/vat-bundle
MIT License
18 stars 9 forks source link

Check VAT format when WS is unavailable #1

Closed Seb33300 closed 5 years ago

Seb33300 commented 5 years ago

Hello,

When the WS is unavailable, the VAT number is always considered as valid: https://github.com/ibericode/vat-bundle/blob/master/src/Validator/Constraints/VatNumberValidator.php#L39

You should at least provide a minimal control to check if the provided VAT number format is valid (starting with a valid country code and following by digits).

You can also provide a more or less strict control depending on the country code: https://en.wikipedia.org/wiki/VAT_identification_number#European_Union_VAT_identification_numbers

Thank you for your work.

Seb33300 commented 5 years ago

My bad.

Just found out the control is done in the library. This is just the Symfony bundle...

https://github.com/ibericode/vat/blob/master/src/Validator.php#L15

Thank you