RTN (Routing transport number).
The routing transport number is a nine digit number used in the US banking system for processing deposits between banks.
The last digit is a checksum.
>>> calc_check_digit('11100002')
'5'
>>> validate('111000025')
'111000025'
>>> validate('11100002') # Not nine digits
Traceback (most recent call last):
...
InvalidLength: ..
>>> validate('11100002B') # Not all numeric
Traceback (most recent call last):
...
InvalidFormat: ..
>>> validate('112000025') # bad checksum
Traceback (most recent call last):
...
InvalidChecksum: ..
Traceback (most recent call last):
...
InvalidChecksum: ..
Calculate the check digit. The number passed should not have the check digit included.
Convert the number to the minimal representation. This strips the number of any surrounding whitespace.
Checks to see if the number provided is a valid RTN. This checks the length and check digit.
Checks to see if the number provided is a valid routing number. This checks the length and check digit.