From 27b5fd90283c9c69efa0d2e1695b3f1f0a6e1b26 Mon Sep 17 00:00:00 2001 From: Andy Snell Date: Tue, 29 Nov 2016 23:36:06 -0500 Subject: [PATCH 1/2] Update MasterCard BIN Range Update valid MasterCard card number ranges in Payment.php, adding entries to support 16-digit card numbers starting with 2221-2720. Additionally, updated the regular expression used by the test function in PaymentTest.php to match on these ranges. Additional information on the BIN range update can be found at: https://www.mastercard.us/en-us/issuers/get-support/2-series-bin-expansion.html --- src/Faker/Provider/Payment.php | 6 ++++++ test/Faker/Provider/PaymentTest.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Faker/Provider/Payment.php b/src/Faker/Provider/Payment.php index dff988aa10..3d82d461b9 100644 --- a/src/Faker/Provider/Payment.php +++ b/src/Faker/Provider/Payment.php @@ -38,6 +38,12 @@ class Payment extends Base "4##############" ), 'MasterCard' => array( + "2221###########", + "23#############", + "24#############", + "25#############", + "26#############", + "2720###########", "51#############", "52#############", "53#############", diff --git a/test/Faker/Provider/PaymentTest.php b/test/Faker/Provider/PaymentTest.php index 3cdec4ca31..773b722718 100644 --- a/test/Faker/Provider/PaymentTest.php +++ b/test/Faker/Provider/PaymentTest.php @@ -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}$/') ); } From e26a2b3b07e4b658af77607ab6767072acbc9366 Mon Sep 17 00:00:00 2001 From: Andy Snell Date: Thu, 8 Dec 2016 14:00:43 -0500 Subject: [PATCH 2/2] Add Comment to Source Containing MasterCard Link Additionally, updated the existing variable comment to docblock format and edited the Wikipedia link in the comment to the direct page as the previous link was a redirect. --- src/Faker/Provider/Payment.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Faker/Provider/Payment.php b/src/Faker/Provider/Payment.php index 3d82d461b9..9244cfa651 100644 --- a/src/Faker/Provider/Payment.php +++ b/src/Faker/Provider/Payment.php @@ -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########",