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

Highlight both Visa types until Visa Electron is not possible #34

Open
vipuldelwadia opened this issue Apr 1, 2014 · 3 comments
Open
Assignees
Milestone

Comments

@vipuldelwadia
Copy link

I think it shouldn't dim Visa Electron until you've typed enough of the number to rule it out (e.g. 40 could be either Visa). Via http://www.reddit.com/r/programming/comments/21uf5h/how_to_correctly_detect_credit_card_type/cggwbg1

@PawelDecowski
Copy link
Owner

Very good point. The behaviour will be changed in a future version. It will return null if the card number matches more than one card.

@PawelDecowski
Copy link
Owner

Another option is to return a list of cards that match, instead of null. That way you could, for example, highlight both Visa and Visa Electron until it’s clear which one it is. But it would be a breaking change — some implementations expect null if a single card hasn’t been matched.

A solution to that would be to return null by default, and provide an option to return a list of matched cards instead.

@PawelDecowski PawelDecowski added this to the 1.2 milestone Oct 9, 2016
@PawelDecowski PawelDecowski self-assigned this Oct 9, 2016
@PawelDecowski
Copy link
Owner

Actually, this can’t be done without introducing breaking changes.

For example, cards starting with 50 are Maestro cards. But cards starting with 5019 are Dankort. As you can see all Dankort cards will also match Maestro.

The way it’s solved currently, is the card ranges are sorted with more specific first: Dankort is more specific (5019) than Maestro (50) so it’s a match.

The only solution I can think of is to return a list of all matched cards. Then, you can decide how to present it in the UI (for example highlight all matched cards, or don’t highlight any until only 1 is matched).

The problem is this is a breaking change. The library historically returned only a single card — never a list — so granted, there is code out there that will break.

That’s why I’m putting it in for v2.0 for now.

@PawelDecowski PawelDecowski modified the milestones: 2.0, 1.2 Oct 17, 2016
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

2 participants