ibericode / vat

PHP library for dealing with European VAT
https://packagist.org/packages/ibericode/vat
MIT License
425 stars 61 forks source link

BE vat numbers starting with 1 instead of 0 #62

Closed gert-creatic closed 10 months ago

gert-creatic commented 10 months ago

From now on Belgian VAT numbers can start with a 1 instead of a zero, will they be validated correctly?

dannyvankooten commented 10 months ago

Hi @gert-creatic,

Depends. The validation logic checks for either a 9-digit VAT number prefixed with a 0 or a 10-digit VAT number with no specific prefix.

Can you provide a valid new VAT number please? That way we can add tests for it and if needed, update the validation logic.,

gert-creatic commented 10 months ago

Hi @dannyvankooten ,

Since the VAT number is still 10 digits long the validation will still work, but it isn't 100% correct.

So the validation logic should be either a 9-digit number prefixed by a 0 or a 9-digit number prefixed by a 1.

Any other 10 digit number would not be correct: (qoute from KBO)

Elke onderneming in België ontvangt bij inschrijving in de Kruispuntbank van Ondernemingen (KBO) een uniek ondernemingsnummer. Het bestaat uit een 0 of een 1, gevolgd door 9 cijfers

dannyvankooten commented 10 months ago

Was wondering about that looking at the regex @gert-creatic, thanks for confirming. With normal use of the library this would have been picked up the VIES validation, but if this prevents us from having to make the SOAP call for certain invalid number formats then that's a win in my book. :+1: