Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Validators/CreditCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
self::AMERICAN_EXPRESS => '/^3[47]\d{13}$/',
self::DINERS_CLUB => '/^3(?:0[0-5]|[68]\d)\d{11}$/',
self::DISCOVER => '/^6(?:011|5\d{2})\d{12}$/',
self::JCB => '/^(?:2131|1800|35\d{3})\d{11}$/',
self::JCB => '/^(?:(?:2131|1800)\d{11}|35(?:2[89]|[3-8]\d)\d{12})$/',
self::MASTERCARD => '/^(5[1-5]|2[2-7])\d{14}$/',
self::VISA => '/^4\d{12}(?:\d{3})?$/',
self::RUPAY => '/^6(?!011)(?:0[0-9]{14}|52[12][0-9]{12})$/',
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/Validators/CreditCardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ public static function providerForValidInput(): iterable
[$discover, '6011000990139424'],
[$general, '3566002020360505'], // JBC
[$jcb, '3566002020360505'],
[$jcb, '3528000000000007'], // JCB 35 BIN Range lower bound
[$jcb, '3589000000000003'], // JCB 35 BIN Range upper bound
[$general, '6522447005971501'], // RuPay
[$rupay, '6062973831636410'],
];
Expand Down Expand Up @@ -94,6 +96,8 @@ public static function providerForInvalidInput(): iterable
[$diners, '4012888888881881'], // Visa
[$discover, '371449635398431'], // American Express
[$jcb, '38520000023237'], // Diners Club
[$jcb, '3500000000000009'], // Luhn-valid, below the JCB 35 BIN Range (3528)
[$jcb, '3590000000000000'], // Luhn-valid, above the JCB 35 BIN Range (3589)
[$master, '05105105105105100'], // Over-long (17-digit) Luhn-valid number; regression for missing ^ anchor
];
}
Expand Down
Loading