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

VISA retired the 13 digit PAN moved to new cardParams #1400

Merged
merged 1 commit into from
Jan 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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