Permalink
Browse files

[2.x]Fix Credit card number pattern(JCB) is wrong

  • Loading branch information...
tenkoma committed Oct 8, 2017
1 parent 1b36417 commit 7d2d902b573ea519f519c5bd2e4b5cebb56a4ece
Showing with 9 additions and 9 deletions.
  1. +8 −8 lib/Cake/Test/Case/Utility/ValidationTest.php
  2. +1 −1 lib/Cake/Utility/Validation.php
@@ -329,14 +329,14 @@ public function testCc() {
$this->assertTrue(Validation::cc('214981579370225', array('enroute')));
$this->assertTrue(Validation::cc('201447595859877', array('enroute')));
//JCB 15 digit
$this->assertTrue(Validation::cc('210034762247893', array('jcb')));
$this->assertTrue(Validation::cc('213134762247898', array('jcb')));
$this->assertTrue(Validation::cc('180078671678892', array('jcb')));
$this->assertTrue(Validation::cc('180010559353736', array('jcb')));
$this->assertTrue(Validation::cc('210095474464258', array('jcb')));
$this->assertTrue(Validation::cc('210006675562188', array('jcb')));
$this->assertTrue(Validation::cc('210063299662662', array('jcb')));
$this->assertTrue(Validation::cc('213195474464253', array('jcb')));
$this->assertTrue(Validation::cc('213106675562183', array('jcb')));
$this->assertTrue(Validation::cc('213163299662667', array('jcb')));
$this->assertTrue(Validation::cc('180032506857825', array('jcb')));
$this->assertTrue(Validation::cc('210057919192738', array('jcb')));
$this->assertTrue(Validation::cc('213157919192733', array('jcb')));
$this->assertTrue(Validation::cc('180031358949367', array('jcb')));
$this->assertTrue(Validation::cc('180033802147846', array('jcb')));
//JCB 16 digit
@@ -706,7 +706,7 @@ public function testLuhn() {
//enRoute
$this->assertTrue(Validation::luhn('201496944158937', true));
//JCB 15 digit
$this->assertTrue(Validation::luhn('210034762247893', true));
$this->assertTrue(Validation::luhn('213134762247898', true));
//JCB 16 digit
$this->assertTrue(Validation::luhn('3096806857839939', true));
//Maestro (debit card)
@@ -811,7 +811,7 @@ public function testAllCc() {
//enRoute
$this->assertTrue(Validation::cc('201496944158937', 'all'));
//JCB 15 digit
$this->assertTrue(Validation::cc('210034762247893', 'all'));
$this->assertTrue(Validation::cc('213134762247898', 'all'));
//JCB 16 digit
$this->assertTrue(Validation::cc('3096806857839939', 'all'));
//Maestro (debit card)
@@ -861,7 +861,7 @@ public function testAllCcDeep() {
//enRoute
$this->assertTrue(Validation::cc('201496944158937', 'all', true));
//JCB 15 digit
$this->assertTrue(Validation::cc('210034762247893', 'all', true));
$this->assertTrue(Validation::cc('213134762247898', 'all', true));
//JCB 16 digit
$this->assertTrue(Validation::cc('3096806857839939', 'all', true));
//Maestro (debit card)
@@ -175,7 +175,7 @@ public static function cc($check, $type = 'fast', $deep = false, $regex = null)
'disc' => '/^(?:6011|650\\d)\\d{12}$/',
'electron' => '/^(?:417500|4917\\d{2}|4913\\d{2})\\d{10}$/',
'enroute' => '/^2(?:014|149)\\d{11}$/',
'jcb' => '/^(3\\d{4}|2100|1800)\\d{11}$/',
'jcb' => '/^(3\\d{4}|2131|1800)\\d{11}$/',
'maestro' => '/^(?:5020|6\\d{3})\\d{12}$/',
'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})?$/',

0 comments on commit 7d2d902

Please sign in to comment.