1

Magento has just released a MasterCard validation patch for Magento versions below 1.9.3.0 https://magento.com/tech-resources/download#download2005

NOTE: If you are running CloudFlare, make sure to disable it and Purge Cache after Patch installation. I was punching in credit cards numbers starting with 2xxx and checkout would not validate them. Purging CloudFlare cache fixed the issue!

- Also, make sure to install discovery SUPEE-2725 first, only then install SUPEE 8967

If you found any issues, please post them in this thread.

closed as too broad by Siarhey Uchukhlebau, Rakesh Jesadiya, Moose, Ashish Jagnani, David Manners May 5 '17 at 9:59

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • If you want to create a question collecting issues for this patch, you should addresses actual problems and do so in the form of a question – 7ochem May 5 '17 at 13:22
  • Guys you should not close this question, its a reference for those installing the patch. Seriously! As with every Patch there is one major topic, we can relate to. – Icon May 5 '17 at 20:35
  • 1
    Please read my comment. This kind of questions is indeed very helpful, but you should formulate it as a question and ask about issues. You should post your solution for the specific "CloudFlare" issue and "SUPEE-2725" issue as an answer. If you have edited your question is such a way, then you will have my reopen vote! ;) – 7ochem May 8 '17 at 10:15
2

Two things to keep in mind after applying this patch:

  • If you're using a payment method that deals with credit cards but that is not the default Magento CC payment method (that patch only applies on Mage_Payment_Model_Method_CC), you'll have to double check that this payment method is supporting the 2XXX Mastercard CC numbers.
  • I've seen a numerous amount of Magento installations where the js/prototype/validation.js (where the patch is applied) is rewritten. Ensure this file is not overriden and if it is, bring the patch changes over the file you're using if you don't want the credit card frontend validation to fail when using 2XXX CC numbers.

Apart from that, the changes in the patch are the exact same changes as the one that are here from 1.9.3.0

  • I have installed the patch on 1.7 version and I can see that after installation I have two files validation.js and validation.js.orig. and also same thing for cc.php and cc.php.orig. Is this normal to create .orig files after patch installation? Overall, the store not started to accept both MasterCards 2xxx and 5xxx. – Icon May 3 '17 at 18:57
  • patching file app/code/core/Mage/Payment/Model/Method/Cc.php Hunk #1 succeeded at 122 with fuzz 1 (offset -1 lines). patching file js/prototype/validation.js Hunk #1 succeeded at 851 with fuzz 2 (offset -30 lines). – Icon May 3 '17 at 19:00
  • I think the reason it created. orig files is because duing SUPEE 8967 Installation there were two hunk errors, but it still installed. – Icon May 3 '17 at 19:01
  • Excellent advise regarding validation.js being overriden! – mpchadwick May 4 '17 at 16:13
2

The two files affected with this patch are here

app/code/core/Mage/Payment/Model/Method/Cc.php
js/prototype/validation.js

and below is the changes for this patch

__PATCHFILE_FOLLOWS__
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],

please note if you have done some modification in above two files then this patch will fail

so in that case copy original file from default installation and revert that file and apply this patch.

Not the answer you're looking for? Browse other questions tagged or ask your own question.