Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Credit card verification


Guest

Recommended Posts

Posted

I have spent hours searching the forums and contribs trying to figure out how to allow certain cards and not others. Everything i have tried has failed. I even copied the verification from a contrib for UK CVV and that failed miserably.

 

Can anyone please tell me how to change from this:

 

class cc_validation {

var $cc_type, $cc_number, $cc_expiry_month, $cc_expiry_year;

 

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

return -1;

}

To work so that we accept all types of UK cards, in particular Visa, Delta, Maestro, Switch, Electron, Solo, mastercard etc, but not diners or amex.

 

At present the configuration will accept some mastercards but not all and the same with solo, but no switch etc.

 

I am really at the end of my tether now, please can someone put me out of my misery.

 

I would really like to add the contrib that collects the cvv etc, but when i look at doing this i need to do sql queries etc and i do not understand how to do this.

 

Just being able to verify the correct cards will do for now.

 

Thanks in advance

 

Paul

  • 1 month later...
Posted

I did the code mod and it works well.

My users get this message.

 

Credit Card Error!

 

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

 

 

Where is this language file located so I can edit it?

 

Thanks,

Ed

Archived

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

×
×
  • Create New...