Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swiftBicNumber() generates BIC codes with invalid country codes #902

Open
GJoffrey opened this issue Sep 26, 2024 · 0 comments
Open

swiftBicNumber() generates BIC codes with invalid country codes #902

GJoffrey opened this issue Sep 26, 2024 · 0 comments

Comments

@GJoffrey
Copy link

GJoffrey commented Sep 26, 2024

Summary

The swiftBicNumber() function in FakerPHP generates BIC codes where the 5th and 6th characters, which should represent a valid country code according to the ISO 3166-1 alpha-2 standard, are entirely random.
This leads to validation failures when using validators that check for valid country codes in BICs, such as the one provided by Symfony (#[Assert\Bic]) based on a full table of ISO 3166 country codes that can be found here: https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes

Versions

Version
PHP 8.3
fakerphp/faker 1.23.1

Possible solution:

Modify the swiftBicNumber() function to generate the country code segment (positions 5 and 6) using a list of valid ISO 3166-1 alpha-2 country codes. This could involve:

  • Integrating an array of valid country codes into FakerPHP. (maybe Payment::$ibanFormats keys ?)
  • Adjusting the BIC generation logic to select a random valid country code for the relevant positions.

Thank you for addressing this issue. Please let me know if you require any further information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant