stdnum.ca.bn¶
BN (Canadian Business Number).
A Business Number (BN) is a 9-digit identification number for businesses issued by the Canada Revenue Agency for tax purposes. The 9-digit number can be followed by two letters (program identifier) and 4 digits (reference number) to form a program account (or BN15).
More information:
- https://www.canada.ca/en/services/taxes/business-number.html
- https://www.ic.gc.ca/app/scr/cc/CorporationsCanada/fdrlCrpSrch.html?locale=en_CA/
>>> validate('12302 6635')
'123026635'
>>> validate('12302 6635 RC 0001')
'123026635RC0001'
>>> validate('123456783')
Traceback (most recent call last):
...
InvalidChecksum: ...
>>> validate('12345678Z')
Traceback (most recent call last):
...
InvalidFormat: ...
-
stdnum.ca.bn.
compact
(number)¶ Convert the number to the minimal representation. This strips the number of any valid separators and removes surrounding whitespace.
-
stdnum.ca.bn.
is_valid
(number)¶ Check if the number is a valid BN or BN15.
-
stdnum.ca.bn.
validate
(number)¶ Check if the number is a valid BN or BN15. This checks the length, formatting and check digit.