Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Credit Cards Error?


emailanj

Recommended Posts

Posted

I get this error when trying to run any credit card. I have tried to run the card through both of my credit modules, Viaklix and the manual (were the card number is sent to you in two different e-mails and you can enter it manually)

 

Credit Card Error!

 

The first four digits of the number entered are: 5000<br>If that number is correct, we do not accept that type of credit card.<br>If it is wrong, please try again.

 

I am thinking there must be a <BR> in the code somewhere but I have searched and not quite sure were to look.

 

Please any help.....

 

Anj

Posted

The <br> is not part of what you entered, it's part of the error message.

 

There are three relevant defines in includes/languages/english.php:

define('TEXT_CCVAL_ERROR_INVALID_DATE', 'The expiry date entered for the credit card is invalid.<br>Please check the date and try again.');
define('TEXT_CCVAL_ERROR_INVALID_NUMBER', 'The credit card number entered is invalid.<br>Please check the number and try again.');
define('TEXT_CCVAL_ERROR_UNKNOWN_CARD', 'The first four digits of the number entered are: %s<br>If that number is correct, we do not accept that type of credit card.<br>If it is wrong, please try again.');

Unfortunately, the way these strings are processed, the <br> is converted to HTML escapes so that it prints exactly that way. I haven't bothered to find the code that does this and fix it (I removed the <br> instead on my store - it's not needed.)

 

Does the credit card number really start with 5000? Or did you just change it for this post? Some have reported that the validation done in includes/classes/cc_validation.php incorrectly rejects some MasterCard numbers. A card number beginning 50 would be rejected.

Posted

Wow..Thanks a bunch!!! The card I am using does have a 50 for the first two numbers. How do I correct it from giving me an error? (what code do I need to change?)

 

Thanks so much

anj.

 

The <br> is not part of what you entered, it's part of the error message.

 

There are three relevant defines in includes/languages/english.php:

define('TEXT_CCVAL_ERROR_INVALID_DATE', 'The expiry date entered for the credit card is invalid.<br>Please check the date and try again.');
define('TEXT_CCVAL_ERROR_INVALID_NUMBER', 'The credit card number entered is invalid.<br>Please check the number and try again.');
define('TEXT_CCVAL_ERROR_UNKNOWN_CARD', 'The first four digits of the number entered are: %s<br>If that number is correct, we do not accept that type of credit card.<br>If it is wrong, please try again.');

Unfortunately, the way these strings are processed, the <br> is converted to HTML escapes so that it prints exactly that way.  I haven't bothered to find the code that does this and fix it (I removed the <br> instead on my store - it's not needed.)

 

Does the credit card number really start with 5000?  Or did you just change it for this post?  Some have reported that the validation done in includes/classes/cc_validation.php incorrectly rejects some MasterCard numbers.  A card number beginning 50 would be rejected.

Posted

Yeah, I've heard of this before. In includes/classes/cc_validation.php, line 21, change:

      } elseif (ereg('^5[1-5][0-9]{14}$', $this->cc_number)) {

to:

      } elseif (ereg('^5[0-9][0-9]{14}$', $this->cc_number)) {

Posted

You are a Genius!!....I would have never figured that out!!...It worked like a charm. Thank you a hundred times over..

 

Anj

 

Yeah, I've heard of this before.  In includes/classes/cc_validation.php, line 21, change:

 ? ? ?} elseif (ereg('^5[1-5][0-9]{14}$', $this->cc_number)) {

to:

 ? ? ?} elseif (ereg('^5[0-9][0-9]{14}$', $this->cc_number)) {

Posted

Well...I still am excited that you helped me with my problem....genius or not :D

 

Thank you again

anj

 

Not a genius - it's just that I've seen this reported before.  The whole cc_validation class is a mess and I hear it is being restructured for MS3.

  • 2 weeks later...
Posted
You are a Genius!!....I would have never figured that out!!...It worked like a charm. Thank you a hundred times over..

 

Anj

 

 

I'm trying to run an 8 digit local card type with no success, the card is alocal mastercard starting with 5.

 

Any suggestions?

Posted
Well, try inserting this into the series of tests in cc_validation.php:

 ? ? ?} elseif (ereg('^5[0-9][0-9]{6}$', $this->cc_number)) {
? ? ? ?$this->cc_type = 'Master Card';

 

Well no, its still not accepting this type of card, here is my code:

 

 

 

function validate($number, $expiry_m, $expiry_y) {

$this->cc_number = ereg_replace('[^0-9]', '', $number);

 

if (ereg('^4[0-9]{12}([0-9]{3})?$', $this->cc_number)) {

$this->cc_type = 'Visa';

} elseif (ereg('^5[1-9][0-9]{6}$', $this->cc_number)) {

$this->cc_type = 'CUSTOM';

} elseif (ereg('^5[1-9][0-9]{14}$', $this->cc_number)) {

$this->cc_type = 'Master Card';

} elseif (ereg('^3[47][0-9]{13}$', $this->cc_number)) {

$this->cc_type = 'American Express';

} elseif (ereg('^3(0[0-5]|[68][0-9])[0-9]{11}$', $this->cc_number)) {

$this->cc_type = 'Diners Club';

} else {

$this->cc_type = 'Credit Card';

//return 1;

}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...