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 @@ -61,7 +61,7 @@
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::MASTERCARD => '/^(5[1-5]|2[2-7])\d{14}$/',
self::MASTERCARD => '/^(?:5[1-5]\d{2}|222[1-9]|22[3-9]\d|2[3-6]\d{2}|27[01]\d|2720)\d{12}$/',
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 @@ -52,6 +52,8 @@ public static function providerForValidInput(): iterable
[$master, '5376 7473 9720 8720'],
[$general, '2223000048400011'], // MasterCard 2 BIN Range
[$master, '2222 4000 4124 0011'],
[$master, '2221000000000009'], // MasterCard 2 BIN Range lower bound
[$master, '2720000000000005'], // MasterCard 2 BIN Range upper bound
[$general, '4024.0071.5336.1885'], // Visa 16
[$visa, '4024.0071.5336.1885'],
[$general, '4024 007 193 879'], // Visa 13
Expand Down Expand Up @@ -94,6 +96,8 @@ public static function providerForInvalidInput(): iterable
[$diners, '4012888888881881'], // Visa
[$discover, '371449635398431'], // American Express
[$jcb, '38520000023237'], // Diners Club
[$master, '2200000000000004'], // Luhn-valid, below the MasterCard 2 BIN Range (2221)
[$master, '2721000000000004'], // Luhn-valid, above the MasterCard 2 BIN Range (2720)
[$master, '05105105105105100'], // Over-long (17-digit) Luhn-valid number; regression for missing ^ anchor
];
}
Expand Down
Loading