stdnum.by.unp

УНП, UNP (Учетный номер плательщика, the Belarus VAT number).

The УНП (UNP) or Учетный номер плательщика (Uchetniy nomer platel’shika, Payer account number) is issued to organisations and individuals for tax purposes. The number consists of 9 digits (numeric for organisations, alphanumeric for individuals) and contains a region identifier, a serial per region and a check digit.

More information:

>>> validate('200988541')
'200988541'
>>> validate('УНП MA1953684')
'MA1953684'
>>> validate('200988542')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
stdnum.by.unp.calc_check_digit(number: str) str

Calculate the check digit for the number.

stdnum.by.unp.check_nalog(number: str, timeout: float = 30, verify: bool | str = True) dict[str, str | None] | None

Retrieve registration information from the portal.nalog.gov.by web site.

The timeout argument specifies the network timeout in seconds.

The verify argument is either a boolean that determines whether the server’s certificate is validate or a string which must be a path the CA certificate bundle to use for verification.

This basically returns the JSON response from the web service as a dict. Will return None if the number is invalid or unknown.

stdnum.by.unp.compact(number: str) str

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

stdnum.by.unp.is_valid(number: str) bool

Check if the number is a valid number.

stdnum.by.unp.validate(number: str) str

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