Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Limiting Specific Credit Cards


jrwrestling

Recommended Posts

There is a thread in Tips & Tricks that explains in more detail, but you essentially remove or comment out the two lines from includes/classes/cc_validation.php that look sort of like this:

} elseif (stuff) {
return AmEx;

Hth,

Matt

Link to comment
Share on other sites

Here is how I did it:

 

1) go to catalog/includes/classes, make a backup copy of cc_validation.php.

2) open it and find ?function validate($number, $expiry_m, $expiry_y)" start at line 16.

3) Just delete the whole "elseif" statement regarding to the credit card you DON'T want.

 

for example, if I don't want Diners Club, I will delete:

 

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

$this->cc_type = 'Diners Club';

}

 

below are the files before and after modification.

 

Original file:

 

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;

}

 

Modified file:

 

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('^6011[0-9]{12}$', $this->cc_number)) {

$this->cc_type = 'Discover';

} else {

return -1;

}

4) save the modified file.

5) go to catalog/includes/languages/english,

6) make a backup copy of checkout-payment.php

7) open it and find "define('TEXT_ENTER_PAYMENT_INFORMATION','This is ..." at line 25

8) change it to :

define('TEXT_ENTER_PAYMENT_INFORMATION', 'We accept VISA, MASTER Card, and DISCOVER Card.');

9) save the modified file.

10) make a test order and enter an American Express credit card number, submit, then the top of the page will show:

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

11) test with other cards.

12) Done!

 

This is how I did it. Take about 2-3 minutes. If you have other prior modification or other payment method, you have change accordingly.

 

Hope this can be a little help.

 

Eddie

Link to comment
Share on other sites

I don't think too many people will try submitting a card not listed there just for kicks and giggles.

 

Dan

 

OH, yes they do. I've had 2 in the last month! :blink: Makes you wonder if people can read...

--

Lloyd

 

"Managing programmers is like herding cats."

Link to comment
Share on other sites

That just lowered my confidence in the human species a few notches. I wonder if there are also people out there dumb enough to put $100 bills in snack machines to see if they'll get change or even get the c-note back? Why would you submit a CC that isn't listed as being accepted? Makes no sense to me. Either you get a failed transaction (does you no good) or it goes through and may or may not be processed (might do you good, might not). No benefit over just following directions...

 

Dan

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...