Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Urgent help needed


Matt_M

Recommended Posts

Hi,

 

I have installed the contribution at

http://www.oscommerce.com/community/contributions,99

 

now when people are using visa cards they get this error:

 

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

 

but that number is perfectly valid. Can anyone please tell me how to fix this so that it will accept all cards? We have already lost an order because of this :(

 

Thanks!

Link to comment
Share on other sites

The type doesnt matter. This fix will accept all numbers and give it a type "Credit Card" if its not in those ranges. Your payment gateway will figure out the type, if its valid number, and if it has funds available.

 

catalog/includes/classes/cc_validation.php

 

Changes

 

      } else {
       $this->cc_type = 'Credit Card';
       //return -1;
     }

 

 

      if (ereg('^4[0-9]{12}([0-9]{3})?$', $this->cc_number)) {
       $this->cc_type = 'Visa';
     } elseif (ereg('^5[1-5][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';
     } elseif (ereg('^6011[0-9]{12}$', $this->cc_number)) {
       $this->cc_type = 'Discover';
     } elseif (ereg('^(3[0-9]{4}|2131|1800)[0-9]{11}$', $this->cc_number)) {
       $this->cc_type = 'JCB';
     } elseif (ereg('^5610[0-9]{12}$', $this->cc_number)) {
       $this->cc_type = 'Australian BankCard';
     } else {
       $this->cc_type = 'Credit Card';
       //return -1;
     }

Link to comment
Share on other sites

  • 4 months later...
 ? ? ?if (ereg('^4[0-9]{12}([0-9]{3})?$', $this->cc_number)) {
? ? ? ?$this->cc_type = 'Visa';
? ? ?} elseif (ereg('^5[1-5][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';
? ? ?} elseif (ereg('^6011[0-9]{12}$', $this->cc_number)) {
? ? ? ?$this->cc_type = 'Discover';
? ? ?} elseif (ereg('^(3[0-9]{4}|2131|1800)[0-9]{11}$', $this->cc_number)) {
? ? ? ?$this->cc_type = 'JCB';
? ? ?} elseif (ereg('^5610[0-9]{12}$', $this->cc_number)) {
? ? ? ?$this->cc_type = 'Australian BankCard';
? ? ?} else {
? ? ? ?$this->cc_type = 'Credit Card';
? ? ? ?//return -1;
? ? ?}

 

Hello, I am trying to process an 8 digit local card starting with 5, When pasting this code I still get the "4 digits" error, it is not processes as "Credit Card".

 

Is there anyway way to disable the validation on a specific type of card?

 

or

 

Is there a way to accept ALL cards?

 

 

Thanks

Link to comment
Share on other sites

  • 1 month later...

Yes, I think I've just got it.

 

I was looking for the same answer and got some of the relevent information from your thread with regards to accepting any number as a valid cc number.

 

The answer to accepting any number (it still requires at least 10 digits) lies in the same file cc_validations.php.

Right at the very bottom is the calculation for whether the number is valid which is:

 

// If the total has no remainder it's OK

return ($numSum % 10 == 0);

}

}

?>

 

This means that the variable has to have no remainder. If you change the first equals sign to a greater sign, that will do it.

i.e:::

 

// If the total has no remainder it's OK

return ($numSum % 10 >= 0);

}

}

?>

 

That way the remainder can be greater than or equal to zero and it will be accepted.

I have been trying all sorts of real and imaginary card numbers and it has accepted them all.

 

Regards

 

Steve

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...