Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Validator] Sync IBAN formats with Swift IBAN registry#48998

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nicolas-grekas merged 1 commit intosymfony:5.4fromsmelesh:sync-iban-formats
Feb 22, 2023

Conversation

@smelesh
Copy link
Contributor

@smeleshsmelesh commentedJan 16, 2023
edited
Loading

QA
Branch?5.4
Bug fix?yes
New feature?no
Deprecations?no
Ticketsn/a
LicenseMIT
Doc PRn/a

Gathered IBAN formats fromIBAN Registry provided by SWIFT.

Some countries don't exist in the registry (Angola, Burkina Faso, Benin, Congo, Ivory Coast, Cameron, Cape Verde, Algeria, Iran, Madagascar, Mali, Mozambique, Senegal). I can't verify the format, but they are marked experimental here:https://www.iban.com/structure

Some formats were changed (Burundi, Costa Rica, Kuwait, Turkey). Is it a BC break?

@carsonbotcarsonbot added this to the5.4 milestoneJan 16, 2023
@smeleshsmelesh changed the titleSync IBAN formats with Swift IBAN registry[Validator] Sync IBAN formats with Swift IBAN registryJan 16, 2023
@nicolas-grekas
Copy link
Member

Thanks for the PR. How did you update the file? Would it make sense to commit some generator in the repo to make it easy to sync with upstream?

OskarStark reacted with rocket emoji

@smelesh
Copy link
ContributorAuthor

@nicolas-grekas, nice idea to keep it up to date.

I have a script that parses registry file and generates regexp list. It was merged manually to preserve existing php comments.
https://gist.github.com/smelesh/f3a93847982999895a4e1a06c3ccad98

But I have some doubts:

  1. I don't like the list of hardcoded "additional" countries, since I can't find IBAN format for them, so no idea if it's a complete list and if they are still valid - the registry provides only officially supported countries.
  2. That CSV file is not well formatted and has some issues and typos, so auto-generation might be unsafe.

@stof
Copy link
Member

@smelesh We already have similar scripts in some components (parsing the ICU data for instance). So I suggest including such script in the repository.

Comments can actually be part of the generated output. The Swift file contains the country name.

Regarding experimental countries, I see that the Wikipedia page about IBAN references them with their BBAN format:https://en.wikipedia.org/wiki/International_Bank_Account_Number#cite_ref-48. This is enough to get the IBAN format (as IBAN is 2-letter country code followed by 2-digit checksum followed by BBAN)

@smelesh
Copy link
ContributorAuthor

Sorry for the delay..

Added a script to collect IBAN formats from Wikipedia (experimental) and SWIFT registry (official):

php src/Symfony/Component/Validator/Resources/bin/sync-iban-formats.php

I cannot find how similar scripts are triggered (for example,update_mime_types.php in String component). I would be happy if someone can share the best practice on how such a script should be added to framework pipeline.

Since comments inIbanValidator were removed in auto-generated data, here is a diff between 5.4 and this PR:

-'AX' => 'FI\d{2}\d{6}\d{7}\d{1}',+'AX' => 'FI\d{2}\d{3}\d{11}',-'BF' => 'BF\d{2}\d{23}',+'BF' => 'BF\d{2}[\dA-Z]{2}\d{22}',-'BI' => 'BI\d{2}\d{12}',+'BI' => 'BI\d{2}\d{5}\d{5}\d{11}\d{2}',-'BJ' => 'BJ\d{2}[A-Z]{1}\d{23}',+'BJ' => 'BJ\d{2}[\dA-Z]{2}\d{22}',-'BR' => 'BR\d{2}\d{8}\d{5}\d{10}[A-Z][\dA-Z]',+'BR' => 'BR\d{2}\d{8}\d{5}\d{10}[A-Z]{1}[\dA-Z]{1}',+'CF' => 'CF\d{2}\d{23}',-'CR' => 'CR\d{2}0\d{3}\d{14}',+'CR' => 'CR\d{2}\d{4}\d{14}',-'CZ' => 'CZ\d{2}\d{20}',+'CZ' => 'CZ\d{2}\d{4}\d{6}\d{10}',+'DJ' => 'DJ\d{2}\d{5}\d{5}\d{11}\d{2}',-'DK' => 'DK\d{2}\d{4}\d{10}',+'DK' => 'DK\d{2}\d{4}\d{9}\d{1}',-'DZ' => 'DZ\d{2}\d{20}',+'DZ' => 'DZ\d{2}\d{22}',+'EG' => 'EG\d{2}\d{4}\d{4}\d{17}',-'FI' => 'FI\d{2}\d{6}\d{7}\d{1}',+'FI' => 'FI\d{2}\d{3}\d{11}',+'GA' => 'GA\d{2}\d{23}',+'GG' => 'GB\d{2}[A-Z]{4}\d{6}\d{8}',+'GQ' => 'GQ\d{2}\d{23}',+'GW' => 'GW\d{2}[\dA-Z]{2}\d{19}',+'HN' => 'HN\d{2}[A-Z]{4}\d{20}',+'IM' => 'GB\d{2}[A-Z]{4}\d{6}\d{8}',+'IQ' => 'IQ\d{2}[A-Z]{4}\d{3}\d{12}',+'JE' => 'GB\d{2}[A-Z]{4}\d{6}\d{8}',+'KM' => 'KM\d{2}\d{23}',-'KW' => 'KW\d{2}[A-Z]{4}\d{22}',+'KW' => 'KW\d{2}[A-Z]{4}[\dA-Z]{22}',+'LC' => 'LC\d{2}[A-Z]{4}[\dA-Z]{24}',+'LY' => 'LY\d{2}\d{3}\d{3}\d{15}',+'MA' => 'MA\d{2}\d{24}',-'ML' => 'ML\d{2}[A-Z]{1}\d{23}',+'ML' => 'ML\d{2}[\dA-Z]{2}\d{22}',+'NE' => 'NE\d{2}[A-Z]{2}\d{22}',+'NI' => 'NI\d{2}[A-Z]{4}\d{24}',+'RU' => 'RU\d{2}\d{9}\d{5}[\dA-Z]{15}',+'SC' => 'SC\d{2}[A-Z]{4}\d{2}\d{2}\d{16}[A-Z]{3}',+'SD' => 'SD\d{2}\d{2}\d{12}',-'SN' => 'SN\d{2}[A-Z]{1}\d{23}',+'SN' => 'SN\d{2}[A-Z]{2}\d{22}',+'SO' => 'SO\d{2}\d{4}\d{3}\d{12}',+'ST' => 'ST\d{2}\d{4}\d{4}\d{11}\d{2}',+'SV' => 'SV\d{2}[A-Z]{4}\d{20}',+'TD' => 'TD\d{2}\d{23}',+'TG' => 'TG\d{2}[A-Z]{2}\d{22}',-'TR' => 'TR\d{2}\d{5}[\dA-Z]{1}[\dA-Z]{16}',+'TR' => 'TR\d{2}\d{5}\d{1}[\dA-Z]{16}',

@stof
Copy link
Member

I cannot find how similar scripts are triggered (for example,update_mime_types.php in String component).

They are run manually by a contributor once in a while.

@nicolas-grekas
Copy link
Member

Thank you@smelesh.

@nicolas-grekasnicolas-grekas merged commit0955438 intosymfony:5.4Feb 22, 2023
This was referencedFeb 28, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@stofstofstof left review comments

Assignees

No one assigned

Projects

None yet

Milestone

5.4

Development

Successfully merging this pull request may close these issues.

5 participants

@smelesh@nicolas-grekas@stof@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp