Skip to content

Commit

Permalink
Merge pull request #137 from gocardless/vinay/us-ach-account-number-f…
Browse files Browse the repository at this point in the history
…ormat

Allow digits only in US ACH account numbers
  • Loading branch information
vinayvinay authored Feb 22, 2019
2 parents adbc5d0 + d5a4b97 commit 7da8ef1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 1 addition & 2 deletions data/structures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -902,8 +902,7 @@ US:
:branch_code_length: 0
:account_number_length: 17
:bank_code_format: "\\d{9}"
# TODO: update account number format based on inputs from user research
:account_number_format: ".{1,17}"
:account_number_format: "\\A_*\\d{1,17}\\z"
:national_id_length: 9
:pseudo_iban_bank_code_length: 9
:pseudo_iban_branch_code_length: 0
Expand Down
11 changes: 10 additions & 1 deletion spec/ibandit/iban_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@
its(:to_s) { is_expected.to eq("") }
end

context "when the input is an invalid US pseudo-IBAN" do
context "when the input pseudo-IBAN has an invalid US bank_code" do
let(:arg) { "USZZ__012345601234567890123456" }

it "is invalid and has the correct errors" do
Expand All @@ -733,6 +733,15 @@
to eq(bank_code: "is the wrong length (should be 9 characters)")
end
end

context "when the input pseudo-IBAN has an invalid US account_number" do
let(:arg) { "USZZ965498456ABC01234567890123" }

it "is invalid and has an error populated" do
expect(subject.valid?).to eq(false)
expect(subject.errors).to eq(account_number: "is invalid")
end
end
end

describe "#to_s" do
Expand Down

0 comments on commit 7da8ef1

Please sign in to comment.