Skip to content

Commit

Permalink
Added support for several IBANs
Browse files Browse the repository at this point in the history
  • Loading branch information
odeknop committed Nov 21, 2021
1 parent 811e735 commit fa1cd68
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
19 changes: 17 additions & 2 deletions lib/iban-tools/rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
length: 28
bban_pattern: '\d{8}[A-Z0-9]{16}'

'AO':
# Angola
length: 25
bban_pattern: '\d{21}'

'AT':
# Austria
length: 20
Expand Down Expand Up @@ -100,6 +105,11 @@
length: 28
bban_pattern: '[A-Z]{4}\d{20}'

'DZ':
# Algeria
length: 24
bban_pattern: '\d{20}'

'EG':
# Egypt
length: 27
Expand Down Expand Up @@ -244,12 +254,12 @@
# Montenegro
length: 22
bban_pattern: '\d{18}'

'MG':
# Madagascar
length: 27
bban_pattern: '\d{23}'

'MK':
# Macedonia
length: 19
Expand Down Expand Up @@ -345,6 +355,11 @@
length: 27
bban_pattern: '[A-Z]\d{10}[A-Z0-9]{12}'

'SN':
# Senegal
length: 28
bban_pattern: '[A-Z]\d{23}'

'TN':
# Tunisia
length: 24
Expand Down
5 changes: 4 additions & 1 deletion spec/iban-tools/iban_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ module IBANTools
[ "AD1200012030200359100100",
"AE070331234567890123456",
"AL47212110090000000235698741",
"AO06004400006729503010102",
"AT611904300234573201",
"AZ21NABZ00000000137010001944",
"BA391290079401028494",
Expand All @@ -108,6 +109,7 @@ module IBANTools
"CZ6508000000192000145399",
"DE89370400440532013000",
"DK5000400440116243",
"DZ9518659728582762741154",
"DO28BAGR00000001212453611324",
"EE382200221020145685",
"ES9121000418450200051332",
Expand Down Expand Up @@ -169,7 +171,8 @@ module IBANTools
"CI93CI0080111301134291200589",
"JO71CBJO0000000000001234567890",
"XK051212012345678906",
"SC52BAHL01031234567890123456USD"
"SC52BAHL01031234567890123456USD",
"SN22K12177694469833683746267"
].each do |iban_code|
describe iban_code do
it "should be valid" do
Expand Down

0 comments on commit fa1cd68

Please sign in to comment.