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

Mastercard regex coverage issue #135

Open
sesser opened this issue Sep 11, 2024 · 0 comments
Open

Mastercard regex coverage issue #135

sesser opened this issue Sep 11, 2024 · 0 comments

Comments

@sesser
Copy link

sesser commented Sep 11, 2024

Issue

The regex pattern used to detect MasterCard excludes a portion of cards (according to the range 2221 - 2720). Specifically, 2230 - 2299. Also, according to MC simplified BIN account range, the min BIN is 222635. You can download the list from https://www.mastercard.us/en-us/business/issuers/get-support/simplified-bin-account-range-table.html

I can't speak to BINs that start with 2221-2225. I have not researched.

  • CardBrand.from("223557******") yields Unknown when it should be MasterCard
  • I think this can be solved with a minor adjustment to the regex pattern

^(?:5[1-5][0-9]{2}|222[1-9]|2[2-6][0-9]{2}|27[01][0-9]|2720)[0-9]*

Environment

Specify the

  • version of Credit Card Number: 4.0.4
  • version of Java: 17
  • operating system and version: Alpine/macOS
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