Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1400 from hppycoder/master
Browse files Browse the repository at this point in the history
VISA retired the 13 digit PAN moved to new cardParams
  • Loading branch information
fzaninotto authored Jan 15, 2018
2 parents 251ec16 + 2d9e5db commit b393800
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
22 changes: 12 additions & 10 deletions src/Faker/Provider/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Payment extends Base
protected static $cardVendors = array(
'Visa', 'Visa', 'Visa', 'Visa', 'Visa',
'MasterCard', 'MasterCard', 'MasterCard', 'MasterCard', 'MasterCard',
'American Express', 'Discover Card'
'American Express', 'Discover Card', 'Visa Retired'
);

/**
Expand All @@ -22,25 +22,27 @@ class Payment extends Base
*/
protected static $cardParams = array(
'Visa' => array(
"4539########",
"4539###########",
"4556########",
"4556###########",
"4916########",
"4916###########",
"4532########",
"4532###########",
"4929########",
"4929###########",
"40240071####",
"40240071#######",
"4485########",
"4485###########",
"4716########",
"4716###########",
"4###########",
"4##############"
),
'Visa Retired' => array(
"4539########",
"4556########",
"4916########",
"4532########",
"4929########",
"40240071####",
"4485########",
"4716########",
"4###########",
),
'MasterCard' => array(
"2221###########",
"23#############",
Expand Down
5 changes: 3 additions & 2 deletions test/Faker/Provider/PaymentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,15 @@ public function loadLocalProviders($locale)

public function testCreditCardTypeReturnsValidVendorName()
{
$this->assertContains($this->faker->creditCardType, array('Visa', 'MasterCard', 'American Express', 'Discover Card'));
$this->assertContains($this->faker->creditCardType, array('Visa', 'Visa Retired', 'MasterCard', 'American Express', 'Discover Card'));
}

public function creditCardNumberProvider()
{
return array(
array('Discover Card', '/^6011\d{12}$/'),
array('Visa', '/^4\d{12,15}$/'),
array('Visa', '/^4\d{15}$/'),
array('Visa Retired', '/^4\d{12}$/'),
array('MasterCard', '/^(5[1-5]|2[2-7])\d{14}$/')
);
}
Expand Down

0 comments on commit b393800

Please sign in to comment.