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

Suggestion - Masked Credit Cards and BIN Ranges Support #1303

Open
Leeeeeeelo opened this issue Jun 28, 2020 · 2 comments
Open

Suggestion - Masked Credit Cards and BIN Ranges Support #1303

Leeeeeeelo opened this issue Jun 28, 2020 · 2 comments

Comments

@Leeeeeeelo
Copy link

Dears,

Trust all is well.

I would like to suggest the below improvements on the credit card rule validation :

  • Implement the ability to validate card numbers that are masked. This will happen in cases where an integration with 3rd party tools / SDKs are used to avoid having the current environment as PCI compliant. For example, the Visa test card number 4111 1111 1111 1111 would be 4111 11** **** 1111 if masked (usually first 6 digits and last 4 digits are preserved).

  • Implement the ability to validate card numbers based on BIN Ranges. For instance, Visa cards start with 4. It would extremely helpful if one can validate further to check if the card belongs to a specific Bank, which would own a specific sub set (for example check https://www.bindb.com/bin-list.html).

Many thanks,

Best regards.

@ErikThiart
Copy link

We could add the following regex to https://github.com/Respect/Validation/blob/master/library/Rules/CreditCard.php under a "masked" brand maybe?

/^(\d{4}\s){2}\*\*\*\*\s{4}\d{4}$/

@alganet
Copy link
Member

alganet commented Mar 31, 2023

This is perhaps another rule, like MaskedCreditCard. Depending on the mask, it's possible to also check the brand, so I wouldn't use a "masked" brand parameter to check it.

It's kinda weird have two very similar rules though. Let's gather more feedback on this! I'll wait for a while until more people can join the discussion.

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

No branches or pull requests

3 participants