Closed NL66278 closed 4 years ago
More information can be found here(in dutch)
The new dutch VAT number is represented as follows: country code NL, 9 numbers, the letter 'B' and a check digit of 2 numbers. the 9 numbers are not bound to the bsn anymore. The check digit consist out of 2 random numbers.
Example: NL000099998B57
The check is now in btw.py
def validate(number):
"""Check if the number is a valid BTW number. This checks the length,
formatting and check digit."""
number = compact(number)
if not isdigits(number[10:]) or int(number[10:]) <= 0:
raise InvalidFormat()
if len(number) != 12:
raise InvalidLength()
if number[9] != 'B':
raise InvalidFormat()
bsn.validate(number[:9])
return number
by removing the bsn.validate(number[:9])
it will pass the new "regulations" .
def validate(number):
"""Check if the number is a valid BTW number. This checks the length,
formatting and check digit."""
number = compact(number)
if not isdigits(number[10:]) or int(number[10:]) <= 0:
raise InvalidFormat()
if len(number) != 12:
raise InvalidLength()
if number[9] != 'B':
raise InvalidFormat()
return number
Can someone provide me with some sample numbers of actual companies that are valid (i.e. pass the VIES VAT validation but do not pass the check algorithm in BSN. Thanks!
hi @arthurdejong. I send you one via the email
Also see PR #183
@Schrooms There should still be a validation algorithm for new numbers. #185 aims to implement it.
@Schrooms There should still be a validation algorithm for new numbers. #185 aims to implement it.
@nim-odoo yeah I really like #185 :+1: great work. Also can you tell me where this definition of the check can be found on the internet? (just curious) found it in your PR :smile:
Thanks everyone for helping fix this. I've implemented the fix in a9b3e90. I will make a new release quickly.
The first 9 digits of the vat number where validated for a check digit, like the bsn number that was part of it. However, this is no longer necessarily the case since 01-01-2020 (because of the privacy of self employed persons). Therefore this check should be removed.