stdnum.pl.nip

NIP (Numer Identyfikacji Podatkowej, Polish VAT number).

The NIP (Numer Identyfikacji Podatkowej) number consists of 10 digit with a straightforward weighted checksum.

>>> validate('PL 8567346215')
'8567346215'
>>> validate('PL 8567346216')  # invalid check digits
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> format('PL 8567346215')
'856-734-62-15'
stdnum.pl.nip.checksum(number: str) int

Calculate the checksum.

stdnum.pl.nip.compact(number: str) str

Convert the number to the minimal representation. This strips the number of any valid separators and removes surrounding whitespace.

stdnum.pl.nip.format(number: str) str

Reformat the number to the standard presentation format.

stdnum.pl.nip.is_valid(number: str) bool

Check if the number is a valid VAT number.

stdnum.pl.nip.validate(number: str) str

Check if the number is a valid VAT number. This checks the length, formatting and check digit.