Skip to content

Commit

Permalink
synchronize IBAN formats
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Aug 30, 2024
1 parent a1b845a commit 21d022d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Constraints/IbanValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class IbanValidator extends ConstraintValidator
'EG' => 'EG\d{2}\d{4}\d{4}\d{17}', // Egypt
'ES' => 'ES\d{2}\d{4}\d{4}\d{1}\d{1}\d{10}', // Spain
'FI' => 'FI\d{2}\d{3}\d{11}', // Finland
'FK' => 'FK\d{2}[A-Z]{2}\d{12}', // Falkland Islands
'FO' => 'FO\d{2}\d{4}\d{9}\d{1}', // Faroe Islands
'FR' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // France
'GA' => 'GA\d{2}\d{23}', // Gabon
Expand Down Expand Up @@ -117,6 +118,7 @@ class IbanValidator extends ConstraintValidator
'MG' => 'MG\d{2}\d{23}', // Madagascar
'MK' => 'MK\d{2}\d{3}[\dA-Z]{10}\d{2}', // Macedonia
'ML' => 'ML\d{2}[\dA-Z]{2}\d{22}', // Mali
'MN' => 'MN\d{2}\d{4}\d{12}', // Mongolia
'MQ' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // France
'MR' => 'MR\d{2}\d{5}\d{5}\d{11}\d{2}', // Mauritania
'MT' => 'MT\d{2}[A-Z]{4}\d{5}[\dA-Z]{18}', // Malta
Expand All @@ -127,6 +129,7 @@ class IbanValidator extends ConstraintValidator
'NI' => 'NI\d{2}[A-Z]{4}\d{24}', // Nicaragua
'NL' => 'NL\d{2}[A-Z]{4}\d{10}', // Netherlands (The)
'NO' => 'NO\d{2}\d{4}\d{6}\d{1}', // Norway
'OM' => 'OM\d{2}\d{3}[\dA-Z]{16}', // Oman
'PF' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // France
'PK' => 'PK\d{2}[A-Z]{4}[\dA-Z]{16}', // Pakistan
'PL' => 'PL\d{2}\d{8}\d{16}', // Poland
Expand Down Expand Up @@ -160,6 +163,7 @@ class IbanValidator extends ConstraintValidator
'VG' => 'VG\d{2}[A-Z]{4}\d{16}', // Virgin Islands
'WF' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // France
'XK' => 'XK\d{2}\d{4}\d{10}\d{2}', // Kosovo
'YE' => 'YE\d{2}[A-Z]{4}\d{4}[\dA-Z]{18}', // Yemen
'YT' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // France
];

Expand Down
2 changes: 1 addition & 1 deletion Resources/bin/sync-iban-formats.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public function getIbanFormats(): array
$formats = [];

foreach ($this->readIbanFormatsTable() as $item) {
if (!preg_match('/^([A-Z]{2})/', $item['Example'], $matches)) {
if (!preg_match('/^([A-Z]{2})/', $item['IBAN Fields'], $matches)) {
continue;
}

Expand Down
4 changes: 4 additions & 0 deletions Tests/Constraints/IbanValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public static function getValidIbans()
['CZ65 0800 0000 1920 0014 5399'], // Czech Republic
['DK50 0040 0440 1162 43'], // Denmark
['EE38 2200 2210 2014 5685'], // Estonia
['FK12 SC98 7654 3210 98'], // Falkland Islands
['FO97 5432 0388 8999 44'], // Faroe Islands
['FI21 1234 5600 0007 85'], // Finland
['FR14 2004 1010 0505 0001 3M02 606'], // France
Expand All @@ -109,9 +110,11 @@ public static function getValidIbans()
['MU17 BOMM 0101 1010 3030 0200 000M UR'], // Mauritius
['MD24 AG00 0225 1000 1310 4168'], // Moldova
['MC93 2005 2222 1001 1223 3M44 555'], // Monaco
['MN14 0005 0051 6384 7716'], // Mongolia
['ME25 5050 0001 2345 6789 51'], // Montenegro
['NL39 RABO 0300 0652 64'], // Netherlands
['NO93 8601 1117 947'], // Norway
['OM04 0280 0000 1234 5678 901'], // Oman
['PK36 SCBL 0000 0011 2345 6702'], // Pakistan
['PL60 1020 1026 0000 0422 7020 1111'], // Poland
['PT50 0002 0123 1234 5678 9015 4'], // Portugal
Expand All @@ -128,6 +131,7 @@ public static function getValidIbans()
['TR33 0006 1005 1978 6457 8413 26'], // Turkey
['AE07 0331 2345 6789 0123 456'], // UAE
['GB12 CPBK 0892 9965 0449 91'], // United Kingdom
['YE09 CBKU 0000 0000 0000 1234 5601 01'], // Yemen

['DJ21 0001 0000 0001 5400 0100 186'], // Djibouti
['EG38 0019 0005 0000 0000 2631 8000 2'], // Egypt
Expand Down

0 comments on commit 21d022d

Please sign in to comment.