S

SUPEE-8967

SUPEE-8967 is a Magento compatibility patch to add to Mastercard validation code new Bank Identification Numbers starting in the 22-27 range.

mastercard-magento-8967-validation
Note: All merchants who accept MasterCard as a payment method are officially required to accept the new card numbers. This patch contains an update for Magento to correctly recognize update BIN range of card numbers from Mastercard.

Mastercard actively testing merchants if they accept the new BIN numbers, and you can expect a fine (up to $25,000 per month) if you don’t accept them.

MasterCard validation patch is required for Magento versions below CE 1.9.3.0 and EE 1.14.3.0 and is already included in versions CE 1.9.3.0 and newer. You can check if updated Javascript validation code for accepting new Mastercard BIN numbers is on your store with our online test.

Note: Versions older than CE 1.9.0.0 need to install SUPEE-2725 before this one as well to apply all the changes.

The patch can be downloaded from Magento Tech Resources Download page and installed as usual under Magento root directory with the following command:
$ bash ./PATCH_SUPEE-8967_EE_1.13.1.0_v1-2017-05-02-04-21-21.sh 
Checking if patch can be applied/reverted successfully...
Patch was applied/reverted successfully.

Do not forget to Disable Magento Compiler, Flush Magento cache and purge Cloudflare or any other frontend caches to freshen Javascript code.

Note: If you use any minifiers or Javascript optimizers, make sure to rebuild minified versions, so they include updated validation code.

The following files are altered by this patch:
app/code/core/Mage/Payment/Model/Method/Cc.php
js/prototype/validation.js
Complete diff:
diff --git app/code/core/Mage/Payment/Model/Method/Cc.php app/code/core/Mage/Payment/Model/Method/Cc.php
index 3d9db00..39f7e21 100644
--- app/code/core/Mage/Payment/Model/Method/Cc.php
+++ app/code/core/Mage/Payment/Model/Method/Cc.php
@@ -123,7 +123,7 @@ class Mage_Payment_Model_Method_Cc extends Mage_Payment_Model_Method_Abstract
                     // Visa
                     'VI'  => '/^4[0-9]{12}([0-9]{3})?$/',
                     // Master Card
-                    'MC'  => '/^5[1-5][0-9]{14}$/',
+                    'MC'  => '/^(5[1-5][0-9]{14}|2(22[1-9][0-9]{12}|2[3-9][0-9]{13}|[3-6][0-9]{14}|7[0-1][0-9]{13}|720[0-9]{12}))$/',
                     // American Express
                     'AE'  => '/^3[47][0-9]{13}$/',
                     // Discovery
diff --git js/prototype/validation.js js/prototype/validation.js
index c9c1798..ef9308c 100644
--- js/prototype/validation.js
+++ js/prototype/validation.js
@@ -881,7 +881,7 @@ Validation.creditCartTypes = $H({
     'SO': [new RegExp('^(6334[5-9]([0-9]{11}|[0-9]{13,14}))|(6767([0-9]{12}|[0-9]{14,15}))$'), new RegExp('^([0-9]{3}|[0-9]{4})?$'), true],
     'SM': [new RegExp('(^(5[0678])[0-9]{11,18}$)|(^(6[^05])[0-9]{11,18}$)|(^(601)[^1][0-9]{9,16}$)|(^(6011)[0-9]{9,11}$)|(^(6011)[0-9]{13,16}$)|(^(65)[0-9]{11,13}$)|(^(65)[0-9]{15,18}$)|(^(49030)[2-9]([0-9]{10}$|[0-9]{12,13}$))|(^(49033)[5-9]([0-9]{10}$|[0-9]{12,13}$))|(^(49110)[1-2]([0-9]{10}$|[0-9]{12,13}$))|(^(49117)[4-9]([0-9]{10}$|[0-9]{12,13}$))|(^(49118)[0-2]([0-9]{10}$|[0-9]{12,13}$))|(^(4936)([0-9]{12}$|[0-9]{14,15}$))'), new RegExp('^([0-9]{3}|[0-9]{4})?$'), true],
     'VI': [new RegExp('^4[0-9]{12}([0-9]{3})?$'), new RegExp('^[0-9]{3}$'), true],
-    'MC': [new RegExp('^5[1-5][0-9]{14}$'), new RegExp('^[0-9]{3}$'), true],
+    'MC': [new RegExp('^(5[1-5][0-9]{14}|2(22[1-9][0-9]{12}|2[3-9][0-9]{13}|[3-6][0-9]{14}|7[0-1][0-9]{13}|720[0-9]{12}))$'), new RegExp('^[0-9]{3}$'), true],
     'AE': [new RegExp('^3[47][0-9]{13}$'), new RegExp('^[0-9]{4}$'), true],
     'DI': [new RegExp('^6011[0-9]{12}$'), new RegExp('^[0-9]{3}$'), true],
     'JCB': [new RegExp('^(3[0-9]{15}|(2131|1800)[0-9]{11})$'), new RegExp('^[0-9]{3,4}$'), true],
49 votes, 4.98 avg. rating (99% score)