Closed iagomelanias closed 6 years ago
You're right, we'll look at this and come up with a solution.
Looks like the underlying issue is that the card type detection was showing the card type could be Elo or Maestro, when it could really only be Elo. We elected to go with a different way of detecting the card type, in such a way that should be easier to maintain.
This should be fixed in v6.0.0
That was a great refactoring! Now it's much simpler to manage card types. ... Elo is always making our lives more difficult 😂
General information
Issue description
Currently, the card number validation logic does not allow multiple potencial card types. https://github.com/braintree/card-validator/blob/2f14aed55390a8582084feb48510e5bea6fba309/src/card-number.js#L29-L31
It means that even if the card number is completely valid based on luhn algorithm, the validation result will always return
isValid
asfalse
.Here is a example of a valid card number, which can be Elo or Maestro:
I believe this behavior was created to avoid the card type to be specified very early, when the user is typing the first numbers still. Ex: only typing
5
could trigger the card type to be Visa, but it can be Visa, Maestro or Elo.Possible solutions