stdnum.dz.nif

NIF, sometimes N.I.F. (Numéro d’Identification Fiscale, Algeria tax number).

The NIF was adopted by the Algerian tax authorities on 2006, replacing the NIS number.

The NIF applies to physical persons, legal persons, legal entities, administrative entities, local branches for foreign companies, associations, professional organisations, etc.

The NIF consists of 15 digits, but sometimes it can be 20 digits long in order to represent branches or secondary establishments.

More information:

>>> validate('416001000000007')
'416001000000007'
>>> validate('408 020 000 150 039')
'408020000150039'
>>> validate('41201600000606600001')
'41201600000606600001'
>>> validate('000 216 001 808 337 13010')
'00021600180833713010'
>>> validate('12345')
Traceback (most recent call last):
    ...
InvalidLength: ...
>>> validate('X1600100000000V')
Traceback (most recent call last):
    ...
InvalidFormat: ...
>>> format('408 020 000 150 039')
'408020000150039'
>>> format('000 216 001 808 337 13010')
'00021600180833713010'
stdnum.dz.nif.compact(number)

Convert the number to the minimal representation.

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

stdnum.dz.nif.format(number)

Reformat the number to the standard presentation format.

stdnum.dz.nif.is_valid(number)

Check if the number is a valid Algeria NIF number.

stdnum.dz.nif.validate(number)

Check if the number is a valid Algeria NIF number.

This checks the length and formatting.