stdnum.tw.ubn

UBN (Unified Business Number, 統一編號, Taiwanese tax number).

The Unified Business Number (UBN, 統一編號) is the number assigned to businesses within Taiwan for tax (VAT) purposes. The number consists of 8 digits, the last being a check digit.

More information:

>>> validate('00501503')
'00501503'
>>> validate('00501502')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('12345')
Traceback (most recent call last):
    ...
InvalidLength: ...
>>> format(' 0050150 3 ')
'00501503'
stdnum.tw.ubn.calc_checksum(number)

Calculate the checksum over the number.

stdnum.tw.ubn.compact(number)

Convert the number to the minimal representation.

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

stdnum.tw.ubn.format(number)

Reformat the number to the standard presentation format.

stdnum.tw.ubn.is_valid(number)

Check if the number is a valid Taiwan UBN number.

stdnum.tw.ubn.validate(number)

Check if the number is a valid Taiwan UBN number.

This checks the length, formatting and check digit.