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

This commit is contained in:
Koji Tanaka 2017-10-08 16:15:10 +09:00
parent 1b364176ff
commit 7d2d902b57
2 changed files with 9 additions and 9 deletions

View file

@ -329,14 +329,14 @@ class ValidationTest extends CakeTestCase {
$this->assertTrue(Validation::cc('214981579370225', array('enroute'))); $this->assertTrue(Validation::cc('214981579370225', array('enroute')));
$this->assertTrue(Validation::cc('201447595859877', array('enroute'))); $this->assertTrue(Validation::cc('201447595859877', array('enroute')));
//JCB 15 digit //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('180078671678892', array('jcb')));
$this->assertTrue(Validation::cc('180010559353736', array('jcb'))); $this->assertTrue(Validation::cc('180010559353736', array('jcb')));
$this->assertTrue(Validation::cc('210095474464258', array('jcb'))); $this->assertTrue(Validation::cc('213195474464253', array('jcb')));
$this->assertTrue(Validation::cc('210006675562188', array('jcb'))); $this->assertTrue(Validation::cc('213106675562183', array('jcb')));
$this->assertTrue(Validation::cc('210063299662662', array('jcb'))); $this->assertTrue(Validation::cc('213163299662667', array('jcb')));
$this->assertTrue(Validation::cc('180032506857825', 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('180031358949367', array('jcb')));
$this->assertTrue(Validation::cc('180033802147846', array('jcb'))); $this->assertTrue(Validation::cc('180033802147846', array('jcb')));
//JCB 16 digit //JCB 16 digit
@ -706,7 +706,7 @@ class ValidationTest extends CakeTestCase {
//enRoute //enRoute
$this->assertTrue(Validation::luhn('201496944158937', true)); $this->assertTrue(Validation::luhn('201496944158937', true));
//JCB 15 digit //JCB 15 digit
$this->assertTrue(Validation::luhn('210034762247893', true)); $this->assertTrue(Validation::luhn('213134762247898', true));
//JCB 16 digit //JCB 16 digit
$this->assertTrue(Validation::luhn('3096806857839939', true)); $this->assertTrue(Validation::luhn('3096806857839939', true));
//Maestro (debit card) //Maestro (debit card)
@ -811,7 +811,7 @@ class ValidationTest extends CakeTestCase {
//enRoute //enRoute
$this->assertTrue(Validation::cc('201496944158937', 'all')); $this->assertTrue(Validation::cc('201496944158937', 'all'));
//JCB 15 digit //JCB 15 digit
$this->assertTrue(Validation::cc('210034762247893', 'all')); $this->assertTrue(Validation::cc('213134762247898', 'all'));
//JCB 16 digit //JCB 16 digit
$this->assertTrue(Validation::cc('3096806857839939', 'all')); $this->assertTrue(Validation::cc('3096806857839939', 'all'));
//Maestro (debit card) //Maestro (debit card)
@ -861,7 +861,7 @@ class ValidationTest extends CakeTestCase {
//enRoute //enRoute
$this->assertTrue(Validation::cc('201496944158937', 'all', true)); $this->assertTrue(Validation::cc('201496944158937', 'all', true));
//JCB 15 digit //JCB 15 digit
$this->assertTrue(Validation::cc('210034762247893', 'all', true)); $this->assertTrue(Validation::cc('213134762247898', 'all', true));
//JCB 16 digit //JCB 16 digit
$this->assertTrue(Validation::cc('3096806857839939', 'all', true)); $this->assertTrue(Validation::cc('3096806857839939', 'all', true));
//Maestro (debit card) //Maestro (debit card)

View file

@ -175,7 +175,7 @@ class Validation {
'disc' => '/^(?:6011|650\\d)\\d{12}$/', 'disc' => '/^(?:6011|650\\d)\\d{12}$/',
'electron' => '/^(?:417500|4917\\d{2}|4913\\d{2})\\d{10}$/', 'electron' => '/^(?:417500|4917\\d{2}|4913\\d{2})\\d{10}$/',
'enroute' => '/^2(?:014|149)\\d{11}$/', '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}$/', '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})$/', '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})?$/', 'solo' => '/^(6334[5-9][0-9]|6767[0-9]{2})\\d{10}(\\d{2,3})?$/',