Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate a valid BE TAX number #415

Merged
merged 3 commits into from Jan 2, 2022
Merged

Conversation

robvankeilegom
Copy link

According to wikipedia:

'BE'+ 8 digits + 2 check digits – e.g. BE09999999XX. At this time no numbers starting with "1" are issued, but this can happen any time. Note that the old numbering schema only had 9 characters, separated with dots (e.g. 999.999.9XX), just adding a zero in front and removing the dots makes it a valid number in the new schema.

The check digits are calculated as 97 - MOD 97

This change generates a VAT number according to those rules.

@bram-pkg
Copy link
Member

bram-pkg commented Jan 1, 2022

When reading the Wikipedia page on Belgian VAT id numbers, it seems there should be 10 digits?
The one with 9 digits is old.

https://en.wikipedia.org/wiki/VAT_identification_number

@bram-pkg bram-pkg self-assigned this Jan 1, 2022
@pimjansen
Copy link

Yeah the original is technically valid though it will never start with a 1 though.

I agree with updating it according spec which is clear i guess?

BE
0,2,3,4,5,6,7,8,9
7 random digits
2 check digits mod97

@robvankeilegom
Copy link
Author

@bram-pkg Yes. This code generates a 10 digit vat number. '0' + 7 digit random number + 2 digit mod97, which is 10 digits total.

@pimjansen The Wikipedia page is not completely clear. The At this time no numbers starting with "1" are issued part means the first digit is always 0. In theory this could be 0-9 but no vat numbers are issued starting with a number other than 0.

@bram-pkg
Copy link
Member

bram-pkg commented Jan 2, 2022

@bram-pkg Yes. This code generates a 10 digit vat number. '0' + 7 digit random number + 2 digit mod97, which is 10 digits total.

My bad, I missed the 0 in your sprintf call.

Copy link
Member

@bram-pkg bram-pkg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@bram-pkg bram-pkg merged commit 9594d0a into FakerPHP:main Jan 2, 2022
@robvankeilegom
Copy link
Author

Thanks!

@robvankeilegom
Copy link
Author

I'm just gonna leave this here for later.

Dear Madam, Sir,

As you know, every entity is assigned an enterprise number (unique identification number) when it is registered in the Crossroads Bank for Enterprises (CBE).

The structure of the enterprise number has been established by Royal Decree[4] and takes the form ZNNN.NNN.NNN, the first digit being either 0 or 1.

We currently use numbers starting with 0: “0.xxx.xxx.xxx” (0-series). However, the 0-series is not infinite. Once this series is exhausted, enterprise numbers will be assigned with the first number being 1: “1.xxx.xxx.xxx” (1-series).

Today there are still 183,600 enterprise numbers of the 0-series available. We estimate that at least 140,000 enterprise numbers beginning with “0” will be used up in the coming year. However, new projects (such as SABE – “loading of foreign entities”) may cause the 0-series to be used up faster than expected and thus more quickly numbers from the 1-series will be put into use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants