|
Just to continue this saga, I id a complete diff between my template and the new release’s template just to make sure nothing was left out.
While I was at it I also diffed other areas of the file system just too make sure. During that process I found a file located at:
app/code/core/Mage/Payment/Model/source/invoice.php
This file was not present in the installation files I used and I did not upgrade the store to the latest version because my server does not support innoDB and we are in the process of acquiring one that does.
However, I decided that uploading the invoice.php file to the server would not hurt. If it wasn’t there before and it was not addressed by the system, what damage could it be causing?
Amazingly, since I did that the errors stopped. I have no idea why and I am pretty sure it is a coincidence, but the reality is that we used to get several of these errors every day and now we did not get a single one since 5 days ago.
Incidentally, the file where the code generating the problem is in: app/code/core/Mage/Payment/Model/Method/Cc.php
The code is as follows:
$ccType = '';
if (!$this->_validateExpDate($info->getCcExpYear(), $info->getCcExpMonth())) { $errorCode = 'ccsave_expiration,ccsave_expiration_yr'; $errorMsg = $this->_getHelper()->__('Incorrect credit card expiration date'); } if (in_array($info->getCcType(), $availableTypes)){ if ($this->validateCcNum($ccNumber) // Other credit card type number validation || ($this->OtherCcType($info->getCcType()) && $this->validateCcNumOther($ccNumber))) { $ccType = 'OT'; $ccTypeRegExpList = array( 'VI' => '/^4[0-9]{12}([0-9]{3})?$/', // Visa 'MC' => '/^5[1-5][0-9]{14}$/', // Master Card 'AE' => '/^3[47][0-9]{13}$/', // American Express 'DI' => '/^6011[0-9]{12}$/', // Discovery 'SS' => '/^((6759[0-9]{12})|(49[013][1356][0-9]{13})|(633[34][0-9]{12})|(633110[0-9]{10})|(564182[0-9]{10}))([0-9]{2,3})?$/' ); foreach ($ccTypeRegExpList as $ccTypeMatch=>$ccTypeRegExp) { if (preg_match($ccTypeRegExp, $ccNumber)) { $ccType = $ccTypeMatch; break; } } if (!$this->OtherCcType($info->getCcType()) && $ccType!=$info->getCcType()) { $errorCode = 'ccsave_cc_type,ccsave_cc_number'; $errorMsg = $this->_getHelper()->__('Credit card number mismatch with credit card type'); } } else { $errorCode = 'ccsave_cc_number'; $errorMsg = $this->_getHelper()->__('Invalid Credit Card Number'); } } else { $errorCode = 'ccsave_cc_type'; $errorMsg = $this->_getHelper()->__('Credit card type is not allowed for this payment method'); } if($errorMsg){ Mage::throwException($errorMsg); //throw Mage::exception('Mage_Payment', $errorMsg, $errorCode); } return $this; }
I am pretty well versed in php, but having had some bad experiences with Magento code I’d like it if someone else could confirm how to modify the code above to eliminate this silly CC check without breaking the cart..
|