d-edge / Cardidy

A .net library to identify credit card number and cvv
MIT License
30 stars 12 forks source link

Should inactive card loose precedence over active card? #98

Open aloisdg opened 1 year ago

aloisdg commented 1 year ago

Hello,

Right now the precedence rule is quite wacky. One way to improve it could be to strictly favorite an active card over an inactive one. To know which card id actually active or not we can follow the Wikipedia's table:

For example, we would have Visa over Switch for a card starting with 4903 and GPN over Solor for a card starting with 6334:

image

Our goal is to identify a card given a card number. I guess that there are more chance to cross the path of an active card over an inactive one.

This change could introduce a breaking change.

What do you think?

Tarmil commented 1 year ago

We could make this another boolean option, eg preferActive = true, which you could explicitly set to false if you're working with potentially old cards.

torendil commented 1 year ago

We could set this as a boolean option, but set it to true by default. I think we already discussed this a while ago, I am in favor of trying the Ockham's razor approach: by default, return the most probable solution, and if it doesn't work, search for alternatives