Skip to content

Commit

Permalink
Merge pull request #31 from trishrempel/add-vatican-city
Browse files Browse the repository at this point in the history
Add Vatican City rules
  • Loading branch information
gpuglia authored Dec 1, 2023
2 parents 8dfc480 + 33c9a19 commit 19b8bf1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
4 changes: 4 additions & 0 deletions lib/iban-tools/conversion_rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,10 @@
reserved: 1!c
account_number: 16!c

'VA':
bank_code: 3!n
account_number: 15!n

'VG':
bank_code: 4!c
account_number: 16!n
9 changes: 7 additions & 2 deletions lib/iban-tools/rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,12 @@
# Montenegro
length: 22
bban_pattern: '\d{18}'

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

'MK':
# Macedonia
length: 19
Expand Down Expand Up @@ -370,6 +370,11 @@
length: 29
bban_pattern: '\d{25}'

'VA':
# Vatican City
length: 22
bban_pattern: '\d{18}'

'VG':
# Virgin Islands
length: 24
Expand Down
1 change: 1 addition & 0 deletions spec/iban-tools/conversion_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ module IBANTools
'SM86U0322509800000000270100' => {check_char: 'U', bank_code: '3225', branch_code: '9800', account_number: '270100'},
'TN5914207207100707129648' => {bank_code: '14', branch_code: '207', account_number: '207100707129648'},
'TR330006100519786457841326' => {bank_code: '61', reserved: '0', account_number: '519786457841326'},
'VA59001123000012345678' => {bank_code: '1', account_number: '123000012345678'},
'VG96VPVG0000012345678901' => {bank_code: 'VPVG', account_number: '12345678901'},
}

Expand Down
3 changes: 2 additions & 1 deletion spec/iban-tools/iban_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ module IBANTools
"XK051212012345678906",
"SC52BAHL01031234567890123456USD",
"PS92PALS000000000400123456702",
"CR05015202001026284066"
"CR05015202001026284066",
"VA59001123000012345678"
].each do |iban_code|
describe iban_code do
it "should be valid" do
Expand Down

0 comments on commit 19b8bf1

Please sign in to comment.