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

Remove spaces to accurately match a unionpay card type #164

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

radar
Copy link

@radar radar commented Aug 29, 2024

I noticed an issue today where a card entered with the prefix 6222 8212, that is including spaces, matched as a maestro card, but should've instead matched as a union pay card. I suspect this might be a wider issue than just these two types. I think to accurately match the types we should be removing the spaces, as they have no bearing on card type.

@radar radar requested a review from a team as a code owner August 29, 2024 01:29
@@ -112,6 +112,7 @@ describe("creditCardType", () => {
["353445444300732639", "jcb"],
["3537286818376838569", "jcb"],

["6222 8212 0000 0000", "unionpay"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest adding test cases (with spaces) for the other major card types.

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

Successfully merging this pull request may close these issues.

2 participants