Skip to content

Commit ffe384a

Browse files
authored
Merge pull request #42 from vlasscontreras/master
American Express 4-digit CVV
2 parents 967767a + 7c39f68 commit ffe384a

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/Cards/AmericanExpress.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class AmericanExpress extends Card implements CreditCard
4646
*
4747
* @var array
4848
*/
49-
protected $cvc_length = [3, 4];
49+
protected $cvc_length = [4];
5050

5151
/**
5252
* Test cvc code checksum against Luhn algorithm.

tests/Unit/CardCvcTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ public function it_check_cvc_by_credit_card()
1717
$this->assertTrue($this->validator('243')->passes());
1818
$this->assertTrue($this->validator('1234')->passes());
1919

20+
$this->assertTrue($this->validator('1234', new AmericanExpressTest)->passes());
21+
$this->assertFalse($this->validator('243', new AmericanExpressTest)->passes()); // American Express supports only 4 digits
22+
2023
$this->assertTrue($this->validator('243', new VisaTest)->passes());
2124
$this->assertTrue($this->validator('1234', new VisaTest)->fails()); // Visa supports only 3 digits
2225

0 commit comments

Comments
 (0)