Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

credit card module


Guest

Recommended Posts

how does this credit card module really works?

 

Does it have a table of valid credit card somewhere that it uses as a reference? How does it know from a valid or not valid credit card?

Link to comment
Share on other sites

The credit card validation code only verifies that the credit number is a valid number based upon the type of card. The following "regular expressions are used.

 

Also, it performs a standard cross check of the numbers - some special algorithm that makes sure the check-sums are ok.

 

It DOES NOT verify that the credit card is good.

 

HTH

Tom

 

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;

Link to comment
Share on other sites

Thanks Tom for the reply,

 

Where can i find this file? what's the name of the file?

 

Say if i want only to accept Visa and Master offline so the I could change the code to look like this:

 

****

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';

} else {

return -1;

****

 

Is this correct?

Thanks,

Link to comment
Share on other sites

The function cc_validation is in catalog/includes/classes/cc_validation.php

 

I'm not sure what other payment modules might use this function so be carefull regarding removing the validation of certain cards. It should work just fine though for the simple cc payment module.

 

HTH

Tom

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...