Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

error on credit card type validation
 
conticreative
Member
 
Total Posts:  38
Joined:  2007-12-13
 

We have a Magento store with paypal Pro and we have been experiencing very bizarre errors at the credit card validation point (where the system recognizes the credit card type).

An increasingly high number of customers (and sadly potential customers) have reported to us that when they enter their credit card they receive a notice that the credit card type is wrong. However they are positive that the type is the right one.

In fact, some of the smarter once have tried repeatedly to check out, as guests or as registered users and often at the third or forth try, without changing their credit card type or number, they succeed in checking out.

We are unable to reproduce this behavior ourselves but we cannot discount it as it is happening now several times a day and we have concluded that it’s not due to the customers entering the wrong information. It is a fault somewhere in the system.

I have been trying to identify where in Magento this validation takes effect, but I was unable to find it.

Has anyone any idea about what can be going wrong?

Where is the validation script for the credit cards in Magento?

Could this be related to paypal Pro by any chance?

Thank you very much for your help. We are on the verge of ditching Magento for some other cart if we cannot solve this issue.

 
Magento Community Magento Community
Magento Community
Magento Community
 
oshipper
Member
 
Total Posts:  53
Joined:  2008-02-04
New York, NY
 

Seeing similar issues with Authorizenet. Why is Credit Card Type even being checked? Should only show customers which cards are accepted and ask for the number, expiration, csv and any other important verification details determined by business rules.

If this is something to prevent fraud then it is very poorly thought out. Anyone who works with cards knows the rules.
Beginning with:
4 is Visa
5 is Mastercard
3 is Amex
6 is Discover

All this unnecessary question does is increase complexity and the chance that the merchant loses a sale. We will be looking to remove promptly and suggest others do as well. Back to Google…

 
Magento Community Magento Community
Magento Community
Magento Community
 
conticreative
Member
 
Total Posts:  38
Joined:  2007-12-13
 

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..

 
Magento Community Magento Community
Magento Community
Magento Community
 
conticreative
Member
 
Total Posts:  38
Joined:  2007-12-13
 

I wanted to clarify the error above a bit better in case others have the same issue and need to have more info about it.

From what I understand, our users, after submitting the card, are taken back to the shopping cart page without receiving an error. At that point, they usually try again and often at the second or third try (sometimes the 4th and 5th) the transaction goes through.
Problem is by then Paypal Pro has processed the transaction each time and we get just as many notices with the error

“Payment transaction failed. Reason Credit card number mismatch with credit card type “

In my OP, I failed to mention this error and at the time I did not know that our users were not getting the validation error but rather they were able to submit the card but were taken to their shopping cart page without any type of confirmation.

Unfortunately, I am the developer, but the owner is the one receiving the messages and checking the logs. I have not seen one so far.

Hopefully the above can help someone better help us.

 
Magento Community Magento Community
Magento Community
Magento Community
 
bstdevelopment
Member
 
Total Posts:  48
Joined:  2008-04-14
 

have you solved the issue?

I am in a similar situation:
I need to add other credit card types like dinners. and although they are showing in admin and frontend the problem is that I am getting the credit card type error.

Even deleting or overriding the validation method didn’t solved the issue. I suspect is also somekind of javascript validation too.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Saggy
Sr. Member
 
Total Posts:  133
Joined:  2009-02-03
 
bstdevelopment - 17 March 2009 04:23 AM

have you solved the issue?

I am in a similar situation:
I need to add other credit card types like dinners. and although they are showing in admin and frontend the problem is that I am getting the credit card type error.

Even deleting or overriding the validation method didn’t solved the issue. I suspect is also somekind of javascript validation too.

Hi Guys,

If you are still looking then click on the below link

Validation overwrite for credit card

Cheers
S

 
Magento Community Magento Community
Magento Community
Magento Community
 
bstdevelopment
Member
 
Total Posts:  48
Joined:  2008-04-14
 

thank you very much - I’ve found the same post that helped me a lot - there is a small addition I mentioned there

 
Magento Community Magento Community
Magento Community
Magento Community
 
sei
Member
 
Total Posts:  35
Joined:  2008-08-13
 

@conticreative - we are experiencing this same exact issue, customer gets no type of warning, nonetheless admin email is being flooded with: Credit card number mismatch with credit card type errors. Paypal records the transaction each and every time. Sometimes the order is even processed, sometimes it is not.

These errors began when our hosting began to act up. Lots of mysql disconnection errors and serious downtime. We know for a fact that the store was running smoothly with many valid, error free, transactions before december and not even one similar email was recieved before this.

Do you know if youre server was acting slow when it happened to you?

 
Magento Community Magento Community
Magento Community
Magento Community
 
anunay
Jr. Member
 
Total Posts:  5
Joined:  2008-04-19
 
sei - 29 January 2010 11:51 AM

Do you know if youre server was acting slow when it happened to you?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top