Jump to content

Archived

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

Kero_1116

4111111111111111 only credit card number

Recommended Posts

What payment module are you using? Are you trying to just make up cc numbers and enter them in or are you using an actual cc number from one of your own cards out of your pocket?

Share this post


Link to post
Share on other sites
What payment module are you using? Are you trying to just make up cc numbers and enter them in or are you using an actual cc number from one of your own cards out of your pocket?

i'm using the credit card module

Share this post


Link to post
Share on other sites

It sounds like you have the TEST mode on.

That will show automatically when that is on.


One of these days, I will actually understand what I just changed...

 

But reading the Manual DEFINATELY helps...

Share this post


Link to post
Share on other sites

What happens if you enter a valid credit card number? Do you get an error? If so what does it say?

 

If you are using the "Credit Card" module there isn't a test mode.

 

We need more information please.

Share this post


Link to post
Share on other sites

it says that it doesn't accept that credit card

 

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

Share this post


Link to post
Share on other sites

osC does a standard verification process, checking for 4visa,5mc,6discover and several others. Im not sure of the CC that starts with 1284.

Share this post


Link to post
Share on other sites

OSC 2.2 MS2 Credit Card payment module has no "Test Mode" and therefore CANNOT be disabled.

 

Since it does not actually process the credit card you can use any credit card number from your personal collection, or you can use the test number 4111111111111111 either way if it is a valid number it will continue to the next step. After the order is completed/comfirmed you can just delete it once you have completed your testing.

 

If you enter a invalid credit card number for Visa, Master Card, American Express, Discover, JCB, or Australian BankCard, you will get an error message.

 

BTW those are the built in cards that a simple test is applied against.

 

1284 is not a valid begining for ANY credit card currently available.

 

If you use a valid credit card number or the test number with a valid experation date you will be able to continue to the next step.

Share this post


Link to post
Share on other sites
i want to only accept mastercard, visa, and interac

 

Then go into the file /catalog/includes/classes/cc_validation.php and in change the first IF statement in the validate function. Remove the cards you do not want to take from the statement and add the one you would like that are not there.

 

The statement you are looking for looks 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';
     } 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;
     }

 

You want to change it to this to accept only Visa and MC:

 

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

 

You will then need to an your own elseif before the final else for interac verification.

 

-Aalst

Share this post


Link to post
Share on other sites
elseif for interac?how would i do that?

 

I do not know since I never heard of an interact credit card.

 

You will need know how to use Regular Expressions, at the least to introduce the addition of a new Credit Card type.

 

You can check out www.php.net and look up the function "ereg" and it will give you a starting point.

 

If you have no programming experience you may want to look into getting a PHP book first and learn some basics about programming in PHP. The OSC community can only take you so far, and you shouldn't rely on it for getting what you want done, especially if you need it right away.

 

If you plan on customizing your OSC I would recommend that you learn PHP and then learn the OSC Framework, or higher a consultant or developer familiar with PHP and OSC to make the changes you want.

Share this post


Link to post
Share on other sites

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

 

Could someone who knows more PHP than I do (most people here I imagine) take a look at this to see if it meets the need?

 

I've attempted to eliminate the unaccepted cards and assign Interac by default. Certainly not a perfect solution, but combined with something on the site that states the accepted cards, it could help.

 

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

Share this post


Link to post
Share on other sites

Databuilder,

 

You do not need to have all the checks to verify that it is a card that you do not want, the checks are to be for the cards you DO want. Checking for every card you dont want is a waste of time and takes longer than just check for the 3 cards you want.

 

I recommend you actually REMOVE the elseif statements you do not want. Like the example I provided and that you quoted.

 

Also with the code you have there with the "catch all" else that if none of the other statements match then it is a Interac card. Which means if I enter "1234" it will be considered GOOD and a INTERAC card, and the order will continue without problems.

 

Therefore, you should not change the ELSE from returning -1, because that is what it should be doing.

 

You should add your OWN elseif, just before the ELSE and setup a Regular Expression for that will verify the interact card as being basicly valid similiar to those for the other cards.

 

If you do not know how to setup a regular expression and or you do not know the basic min requirements for validating a interac number, then you need to find someone who can. You should start with a GOOGLE of interac and find out what makes there numbers valid, etc. Then you can create a NEW TOPIC in the General Support forum request programming help for creating a Regular expression for validating an Interac number, and then provide the information you found.

 

-Aalst

Share this post


Link to post
Share on other sites
how do i do that?

That is what you need to learn or find out on your own. I gave you enough to get you started, pointed you to the exact lines of code, gave you the function you need to research. The rest is up to you. Time to snatch the peeble grasshopper!

 

Helpful Links:

OS Commerce Wiki Documentation
 
PHP Website
 
PHP Events and Training
 
PHPHelp.com (Has Tutorials)
 
<?php Freaks (Has Tutorials)
 
CodeWalkers (Has Tutorials)

Books:

PHP 4: A Beginner's Guide
 
Programming PHP
 
PHP and MySQL Web Development
 
Teach Yourself PHP4 in 24 Hours
 
... More Books!

Share this post


Link to post
Share on other sites

×