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)

Calculate the check digit for the number.

stdnum.by.unp.check_nalog(number, timeout=30)

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

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)

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)

Check if the number is a valid number.

stdnum.by.unp.validate(number)

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