General information
Issue description
When trying to add a new card that has the same starting digit (pattern) as a Visa card, the card-validator library identifies it as a Visa card. This results in the new card being rejected because the card lengths defined for Visa (16, 18, or 19 digits) do not match the length of the new card (e.g., 13 digits).
Steps to reproduce
Attempt to add a new card with a specific pattern (e.g., starting with 4) and a length of 13 digits.
const NEW_VISA_CARD = {
niceType: 'new-Visa',
type: 'new-visa',
patterns: [4],
gaps: [4, 8, 12],
lengths: [13],
code: {
name: 'CVV',
size: 3,
},
};
valid.creditCardType.addCard(NEW_VISA_CARD);
The library incorrectly identifies the card as a Visa card.
const cardValidation = valid.number(<13-digit-number>);
The new card is identified as Visa card and not new-visa due to pattern conflict and the card is rejected.
Expected Behavior:
The library should distinguish between card types more effectively, allowing the addition of new cards with lengths and patterns that may conflict with existing card types like Visa.