stdnum.mk.edb

ЕДБ (Едниствен Даночен Број, North Macedonia tax number).

This number consists of 13 digits, sometimes with an additional “MK” prefix.

More information:

>>> validate('4030000375897')
'4030000375897'
>>> validate('МК 4020990116747')  # Cyrillic letters
'4020990116747'
>>> validate('MK4057009501106')  # ASCII letters
'4057009501106'
>>> validate('4030000375890')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> format('МК 4020990116747')  # Cyrillic letters
'4020990116747'
>>> format('MK4057009501106')  # ASCII letters
'4057009501106'
stdnum.mk.edb.calc_check_digit(number: str) str

Calculate the check digit.

stdnum.mk.edb.compact(number: str) str

Convert the number to the minimal representation.

This strips the number of any valid separators and removes surrounding whitespace.

stdnum.mk.edb.format(number: str) str

Reformat the number to the standard presentation format.

stdnum.mk.edb.is_valid(number: str) bool

Check if the number is a valid North Macedonia ЕДБ number.

stdnum.mk.edb.validate(number: str) str

Check if the number is a valid North Macedonia ЕДБ number.

This checks the length, formatting and check digit.