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 #1103 from andysnell/mastercard-bin-update
Browse files Browse the repository at this point in the history
Update MasterCard BIN Range
  • Loading branch information
fzaninotto authored Dec 12, 2016
2 parents b98e70c + e26a2b3 commit 9b86341
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion src/Faker/Provider/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ class Payment extends Base
'American Express', 'Discover Card'
);

// see http://en.wikipedia.org/wiki/Bank_card_number for a reference of existing prefixes
/**
* @var array List of card brand masks for generating valid credit card numbers
* @see https://en.wikipedia.org/wiki/Payment_card_number Reference for existing prefixes
* @see https://www.mastercard.us/en-us/issuers/get-support/2-series-bin-expansion.html MasterCard 2017 2-Series BIN Expansion
*/
protected static $cardParams = array(
'Visa' => array(
"4539########",
Expand All @@ -38,6 +42,12 @@ class Payment extends Base
"4##############"
),
'MasterCard' => array(
"2221###########",
"23#############",
"24#############",
"25#############",
"26#############",
"2720###########",
"51#############",
"52#############",
"53#############",
Expand Down
2 changes: 1 addition & 1 deletion test/Faker/Provider/PaymentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function creditCardNumberProvider()
return array(
array('Discover Card', '/^6011\d{12}$/'),
array('Visa', '/^4\d{12,15}$/'),
array('MasterCard', '/^5[1-5]\d{14}$/')
array('MasterCard', '/^(5[1-5]|2[2-7])\d{14}$/')
);
}

Expand Down

0 comments on commit 9b86341

Please sign in to comment.