Skip to content

Commit

Permalink
Update validation for new Mastercard card numbers
Browse files Browse the repository at this point in the history
Fix issue #8690
  • Loading branch information
psaintjust committed Apr 30, 2016
1 parent 96ec485 commit 319f66a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Validation/Validation.php
Expand Up @@ -181,6 +181,7 @@ public static function cc($check, $type = 'fast', $deep = false, $regex = null)
'jcb' => '/^(3\\d{4}|2100|1800)\\d{11}$/',
'maestro' => '/^(?:5020|6\\d{3})\\d{12}$/',
'mc' => '/^5[1-5]\\d{14}$/',
'mc' => '/^(5[1-5]\\d{14})|(2(?:22[1-9]|2[3-9][0-9]|[3-6][0-9]{2}|7[0-1][0-9]|720)\\d{12})$/',
'solo' => '/^(6334[5-9][0-9]|6767[0-9]{2})\\d{10}(\\d{2,3})?$/',
'switch' => '/^(?:49(03(0[2-9]|3[5-9])|11(0[1-2]|7[4-9]|8[1-2])|36[0-9]{2})\\d{10}(\\d{2,3})?)|(?:564182\\d{10}(\\d{2,3})?)|(6(3(33[0-4][0-9])|759[0-9]{2})\\d{10}(\\d{2,3})?)$/',
'visa' => '/^4\\d{12}(\\d{3})?$/',
Expand Down
6 changes: 6 additions & 0 deletions tests/TestCase/Validation/ValidationTest.php
Expand Up @@ -339,6 +339,12 @@ public function testCc()
$this->assertTrue(Validation::cc('5467639122779531', ['mc']));
$this->assertTrue(Validation::cc('5297350261550024', ['mc']));
$this->assertTrue(Validation::cc('5162739131368058', ['mc']));
//Mastercard (additional 2016 BIN)
$this->assertTrue(Validation::cc('2221000000000009', ['mc']));
$this->assertTrue(Validation::cc('2720999999999996', ['mc']));
$this->assertTrue(Validation::cc('2223000010005798', ['mc']));
$this->assertTrue(Validation::cc('2623430710235708', ['mc']));
$this->assertTrue(Validation::cc('2420452519835723', ['mc']));
//Solo 16
$this->assertTrue(Validation::cc('6767432107064987', ['solo']));
$this->assertTrue(Validation::cc('6334667758225411', ['solo']));
Expand Down

0 comments on commit 319f66a

Please sign in to comment.