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

isBIC country code does not accept XK #2045

Closed
import-brain opened this issue Sep 20, 2022 · 2 comments · Fixed by #2046
Closed

isBIC country code does not accept XK #2045

import-brain opened this issue Sep 20, 2022 · 2 comments · Fixed by #2046

Comments

@import-brain
Copy link
Contributor

import-brain commented Sep 20, 2022

Describe the bug
A clear and concise description of what the bug is.

The isBIC validator uses the list of country codes in './isISO31661Alpha2' and that list of country codes does not include "XK" (Republic of Kosovo).

However, on the ISO 9362 page, Wikipedia says that the country code in a SWIFT/BIC code is "a ISO 3166-1 alpha-2 country code (exceptionally, SWIFT has assigned the code XK to Republic of Kosovo, which does not have an ISO 3166-1 country code)".

Kosovo's code is not in the ISO 3166-1 alpha-2, but for assigning BIC country codes, it is a valid code.

Because isBIC only uses the list of country codes on the ISO 3166-1 alpha-2 format, a BIC code with "XK" as the country code would not pass.

if (!CountryCodes.has(str.slice(4, 6).toUpperCase())) {
return false;
}

We should change the check above in isBIC.js to this to account for "XK" being an allowed country code:

if (!CountryCodes.has(str.slice(4, 6).toUpperCase()) && str.slice(4, 6).toUpperCase() !== "XK" ) {
    return false;
  }

Examples
If applicable, add screenshots to help explain your problem.

Additional context
Validator.js version: 13.7.0
Node.js version: 16
OS platform: [windows, linux, macOS, etc]: Linux

@WikiRik
Copy link
Member

WikiRik commented Sep 20, 2022

Feel free to open a PR for this

@ST-DDT
Copy link
Contributor

ST-DDT commented Sep 20, 2022

Example:

https://wise.com/de/swift-codes/CBRKXKPRXXX

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

Successfully merging a pull request may close this issue.

4 participants