spaze / vat-calculator

[EOL, use driesvints/vat-calculator] Handle all the hard stuff related to EU MOSS tax/vat regulations, the way it should be. Fork of mpociot/vat-calculator, standalone, PHP 7.3+, modernized, with more features.
MIT License
48 stars 2 forks source link

Check if non-latin chars are in the VAT id before validation #19

Closed spaze closed 3 years ago

spaze commented 4 years ago

VAT id numbers like CY123123Μ come back from the VIES service as not valid because they don't even pass the regex mentioned in the WSDL.

The vatNumber input parameter must follow the pattern [0-9A-Za-z+*.]{2,12}

Because that's not the Μ you think it is, this one's a multibyte with hex 0xce9c. There's no reason to even try to VIES this, let's throw a nice exception instead.

Upstream bug https://github.com/mpociot/vat-calculator/issues/99