Class: Exception14
- Inherits:
-
BaseException
- Object
- BaseException
- Exception14
- Defined in:
- lib/uk_account_validator/exceptions/exception_14.rb
Overview
Perform the modulus 11 check as normal:
* If the check passes (that is, there is no remainder), then the account
number should be considered valid. Do not perform the second check.
* If the first check fails, then the second check must be performed as
specified below.
Second check:
* If the 8th digit of the account number (reading from left to right) is not
0, 1 or 9 then the account number fails the second check and is not a valid
Coutts account number
* If the 8th digit is 0, 1 or 9, then remove the digit from the account
number and insert a 0 as the 1st digit for check purposes only
* Perform the modulus 11 check on the modified account number using the same
weightings as specified in the table (that is, 0 0 0 0 0 0 8 7 6 5 4 3 2 1):
- If there is no remainder, then the account number should be considered
valid
- If there is a remainder, then the account number fails the second check
and is not a valid Coutts account number
Constant Summary
Constants included from NumberIndices
Instance Attribute Summary
Attributes inherited from BaseException
#account_number, #check_number, #modulus_weight, #sort_code
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from BaseException
#after_calculate_total, #apply_sort_code_substitutions, #initialize, #override_test?, #replace_weight, #zero_all, #zero_u_b
Constructor Details
This class inherits a constructor from BaseException
Class Method Details
.allow_any? ⇒ Boolean
20 21 22 |
# File 'lib/uk_account_validator/exceptions/exception_14.rb', line 20 def self.allow_any? true end |
Instance Method Details
#apply_account_number_substitutions ⇒ Object
24 25 26 27 28 29 |
# File 'lib/uk_account_validator/exceptions/exception_14.rb', line 24 def apply_account_number_substitutions return account_number unless %w(0 1 9).include?(account_number[7]) account_number.slice!(7) return '0' + account_number end |