jessepollak / jessepollak/card

Possible need to update card brand regex

Open
#662 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
SCSS
Stars
11.7k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

I was trying the lib with a card and despite being issued by Mastercard it didn't get recognized. The card is a mastercard platinum issued by a Brazilian bank and starts with "2235 25" and can be found using any online BIN validator.

According to the mastercard bin table available at [https://www.mastercard.us/en-us/business/issuers/get-support/simplified-bin-account-range-table.html](https://www.mastercard.us/en-us/business/issuers/get-support/simplified-bin-account-range-table.html) those cards are ranged from 2235250000 to 2235259999. Also it looks like there's a lot of banks using 223 prefix for mastercard.

I've checked the code that does this parsing and i believe the regex currently used for mastercard is `/^(5[1-5]|677189)|^(222[1-9]|2[3-6]\d{2}|27[0-1]\d|2720)/g` and changing it to `/^(5[1-5]|677189)|^(222[1-9]|2[2-6]\d{2}|27[0-1]\d|2720)/g` would fix it.

Is the lib still being updated with card formats? I could make a PR if needed.

Contributor guide

Open the contributing guide

Research direction

Locate the Mastercard regex in the card-brand parsing code and compare its supported ranges with the reported 223525 prefix. Confirm that the reported Mastercard number is recognized after the range is addressed; the issue does not name a file or test.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
payments
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.