mirror of
https://github.com/vlucas/valitron.git
synced 2025-12-31 07:01:54 +00:00
Update MasterCard BIN Range
Updates the credit card validator regular expression for the MasterCard brand to also match 16-digit card numbers starting with 22 - 27. Additionally, updates the unit test for credit cards with two published test cards in the new BIN range. Additional information on the BIN range update can be found at: https://www.mastercard.us/en-us/issuers/get-support/2-series-bin-expansion.html
This commit is contained in:
parent
ce8e9a4a39
commit
f9dd486b5d
@ -725,7 +725,7 @@ class Validator
|
|||||||
} else {
|
} else {
|
||||||
$cardRegex = array(
|
$cardRegex = array(
|
||||||
'visa' => '#^4[0-9]{12}(?:[0-9]{3})?$#',
|
'visa' => '#^4[0-9]{12}(?:[0-9]{3})?$#',
|
||||||
'mastercard' => '#^5[1-5][0-9]{14}$#',
|
'mastercard' => '#^(5[1-5]|2[2-7])[0-9]{14}$#',
|
||||||
'amex' => '#^3[47][0-9]{13}$#',
|
'amex' => '#^3[47][0-9]{13}$#',
|
||||||
'dinersclub' => '#^3(?:0[0-5]|[68][0-9])[0-9]{11}$#',
|
'dinersclub' => '#^3(?:0[0-5]|[68][0-9])[0-9]{11}$#',
|
||||||
'discover' => '#^6(?:011|5[0-9]{2})[0-9]{12}$#',
|
'discover' => '#^6(?:011|5[0-9]{2})[0-9]{12}$#',
|
||||||
|
|||||||
@ -994,7 +994,7 @@ class ValidateTest extends BaseTestCase
|
|||||||
public function testCreditCardValid()
|
public function testCreditCardValid()
|
||||||
{
|
{
|
||||||
$visa = array(4539511619543489, 4532949059629052, 4024007171194938, 4929646403373269, 4539135861690622);
|
$visa = array(4539511619543489, 4532949059629052, 4024007171194938, 4929646403373269, 4539135861690622);
|
||||||
$mastercard = array(5162057048081965, 5382687859049349, 5484388880142230, 5464941521226434, 5473481232685965);
|
$mastercard = array(5162057048081965, 5382687859049349, 5484388880142230, 5464941521226434, 5473481232685965, 2223000048400011, 2223520043560014);
|
||||||
$amex = array(371442067262027, 340743030537918, 345509167493596, 343665795576848, 346087552944316);
|
$amex = array(371442067262027, 340743030537918, 345509167493596, 343665795576848, 346087552944316);
|
||||||
$dinersclub = array(30363194756249, 30160097740704, 38186521192206, 38977384214552, 38563220301454);
|
$dinersclub = array(30363194756249, 30160097740704, 38186521192206, 38977384214552, 38563220301454);
|
||||||
$discover = array(6011712400392605, 6011536340491809, 6011785775263015, 6011984124619056, 6011320958064251);
|
$discover = array(6011712400392605, 6011536340491809, 6011785775263015, 6011984124619056, 6011320958064251);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user