Skip to content

Commit

Permalink
Merge pull request #90 from gocardless/aussie_national_id
Browse files Browse the repository at this point in the history
Return correct swift national id for Australia
  • Loading branch information
GeorgeA93 authored Feb 8, 2018
2 parents ee2a1d1 + a117dbb commit 60c616a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions data/structures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ AU:
:pseudo_iban_bank_code_length: 0
:pseudo_iban_branch_code_length: 6
:pseudo_iban_account_number_length: 9
:national_id_length: 6
AZ:
:bank_code_position: 5
:bank_code_length: 4
Expand Down
2 changes: 1 addition & 1 deletion lib/ibandit/iban.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def to_s(format = :compact)
###################

def swift_national_id
return unless decomposable?
return if swift_bank_code.nil? && swift_branch_code.nil?

national_id = swift_bank_code.to_s
national_id += swift_branch_code.to_s
Expand Down
2 changes: 2 additions & 0 deletions spec/ibandit/iban_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
its(:swift_bank_code) { is_expected.to be_nil }
its(:swift_branch_code) { is_expected.to eq("123456") }
its(:swift_account_number) { is_expected.to eq("123456789") }
its(:swift_national_id) { is_expected.to eq("123456") }
its(:iban) { is_expected.to be_nil }
its(:pseudo_iban) { is_expected.to eq("AUZZ123456123456789") }
its(:valid?) { is_expected.to eq(true) }
Expand All @@ -191,6 +192,7 @@
its(:swift_bank_code) { is_expected.to be_nil }
its(:swift_branch_code) { is_expected.to eq("123456") }
its(:swift_account_number) { is_expected.to eq("123456789") }
its(:swift_national_id) { is_expected.to eq("123456") }
its(:iban) { is_expected.to be_nil }
its(:pseudo_iban) { is_expected.to eq("AUZZ123456123456789") }
its(:valid?) { is_expected.to eq(true) }
Expand Down

0 comments on commit 60c616a

Please sign in to comment.