Repository navigation
PF-2509 add modulus checks for US - #279
Conversation
| } | ||
| end | ||
|
|
||
| it { is_expected.to be(true) } |
There was a problem hiding this comment.
I might be being a silly goose - why is iban.valid_us_details true for non-US details?
There was a problem hiding this comment.
Wait, I've just realised that all methods are the same. But I don't understand why valid_us_details? would return false if the country code is US, that seems counter intuitive
There was a problem hiding this comment.
Theres a similar test for CA, NZ and AU so I just copied them in, I think the point is that because it uses the default modulus check it should pass too
There was a problem hiding this comment.
I think it's fine, I think I just don't understand this remit well enough 🤦♀️
|
Not sure if relevant needed, but the modulus checker itslef does not have a 'pipeline' (function) for the us and returns the default pipeline that simply says true. Do we want the modulus checker itself to do things or is for now the purpose of this change to allow ibandit to work with us accounts? ps please can we go through ibandit sometime |
I dont think so, i copied the style of CAD, NZ and AUD which also doesnt as they dont have IBANs |
https://gocardless.atlassian.net/browse/PF-2509
What
Add
valid_us_details?for US pseudo-IBANs. After the existing routing numberchecksum, it calls the configured modulus checker's
valid_bank_code?, in thesame way
valid_australian_details?,valid_nz_details?andvalid_ca_details?already do for AU, NZ and CA.If no modulus checker is configured, behaviour is unchanged.
Why
For US details the only check was the ABA checksum, and the modulus checker was
never called. The checksum passes some invalid numbers, such as 000000000, so
routing numbers that do not exist were accepted.
Behaviour change
Anyone with a modulus checker configured will now see US routing numbers
rejected when the checker says the bank code does not exist. The error is
bank_code"bank code does not exist". Marked [Breaking] in the changelog, inline with how the NZ validation change was handled.
Testing
valid_us_details?: with no checker, with a checker that accepts,with a checker that rejects, and with a failing checksum.