Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] CC_CVV_start date plus credit card blacklist


Guest

Recommended Posts

Barry thanks for this contrib man,

 

i hope you can find some time to update the readme with the 2.2 version, I got this contrib working after figuring myself few things that readme file say got but in actual file dont got, but it make me afraid i might made mistake anywhere.

 

The contrib work, it capture etc but 1 thing is it recognise visa card as JCB and when i say JCB not accepted then it wont accept visa.

 

man thanks allot for this, would you like any of my product as donation :D for this fine contribution of yours .

 

https://www.muslimin.com/store/

 

thanks

 

Jaleel

Link to comment
Share on other sites

  • Replies 311
  • Created
  • Last Reply

Top Posters In This Topic

  • 1 month later...

I've been using this great mod for the last few months, its great!

Anyway I just recently discovered a small problem.

SOme customers were receicing "the first 4 digits are not accepted" error even though the card is accepted. I have found that if you enter a card in with the spaces this error will pop up. The reason is that the script test the first 6 digits, obviously if there is a space in there it will fail.

I've changed the error message to ask the customer to type in the card number without the spaces for the meantime until I get the script to delete the spaces before it submits. If anyone has any ideas on how to do this please feel free to let me know

Link to comment
Share on other sites

Sefu

 

I have what version of oscommerce are you running it on?

 

And I have had a problem with that in Admin it is not displaying the text boxes properly and in some cases not at all with big gaps in it, plus in the catalog when i go to pay there is just the standard name, number and expiry date. I have tried it on MS1 and MS2.

 

The easiest way I would say is to tell your customers not to include the spaces between the numbers.

 

Jezza

Link to comment
Share on other sites

  • 4 weeks later...
Anyway I just recently discovered a small problem.

SOme customers were receicing "the first 4 digits are not accepted" error even though the card is accepted. I have found that if you enter a card in with the spaces this error will pop up. The reason is that the script test the first 6 digits, obviously if there is a space in there it will fail.

Hmmm ...

 

I've just added this contribution to MS2 today and I don't get this problem - I can put numbers in with spaces and the code removes the spaces perfectly ...

 

:rolleyes:

Link to comment
Share on other sites

And I have had a problem with that in Admin it is not displaying the text boxes properly and in some cases not at all with big gaps in it, plus in the catalog when i go to pay there is just the standard name, number and expiry date. I have tried it on MS1 and MS2.

Have you tried the tip mentioned earlier in this thread of 'removing' then re-'installing' the credit card module (in Admin)?

 

It needs to be re-installed in Admin after you've added the mod in order for OSC to recognise the changes you've made.

Link to comment
Share on other sites

The contrib work, it capture etc but 1 thing is it recognise visa card as JCB and when i say JCB not accepted then it wont accept visa.

It seems that the card recognition code in cc_validation.php overlaps such that Visa cards within a certain number range are being trapped by the JCB recognition code first (the JCB recognition code is processed before the Visa recognition code). Since I don't take JCB at present I've simply commented out the JCB section for now. If you do take JCB, perhaps you could try reversing the positions of those two sections of code.

Link to comment
Share on other sites

(I am blur_imagination under diff alias)

 

This might be going slightly off topic, but it is really bugging me and someone may know the answer.

 

In the standard osC cc_validation you only get support for these credit cards: Visa, Master Card, Amercian Express, JCB and discover. However I would like to add Maestro, Delta, Switch and Solo.

 

However from the CC_CVV_start date plus credit card blacklist contrib I cut and paste just the cc_validation.php file. It works however in Admin >> Orders, the credit card type is shown as 'CC'. I have looked through the code and I have come to this conclusion (I could be wrong).

 

It is working out what type of credit card it is from the number:

 

// Electron ? 
? ? ?} elseif ( ($NumberLeft6 == 450875)
? ? ? ? ? ?|| (($NumberLeft6 >= 484406) && ($NumberLeft6 <= 484455))
? ? ? ? ? ?|| (($NumberLeft6 >= 491730) && ($NumberLeft6 <= 491759))
? ? ? ? ? ?|| ?($NumberLeft6 == 491880)
? ? ? ? ? ? ) {
? ? ? ?$this->cc_type = 'Electron'; ? ? ?
? ? ? ?$ShouldLength = 16;
? ? ? ? if ( strtolower(MODULE_PAYMENT_CC_ACCEPT_ELECTRON) != 'true' ) {
? return -5;
? }
// Mastercard ? 
? ? ?} elseif ( ($NumberLeft6 >= 510000) && ($NumberLeft6 <= 549999) ) {
? ? ? ?$this->cc_type = 'Mastercard';
? ? ? ?$ShouldLength = 16;
? ? ? ? if ( strtolower(MODULE_PAYMENT_CC_ACCEPT_MASTERCARD) != 'true' ) { ? ? ?
? ? ?return -5;
? }

 

So this is saying either Electron or Mastercard depending on whether the credit card number is between the defined ranges.

 

$this->cc_type = 'Mastercard';

 

so far the code above has said, yes its mastercard. (presuming i typed in a mastercard number)

 

But, the length check has not yet been carried out which is done here:

 

// function to check the number length
// Is the number the right length?
? ?
? if ( !( ($NumberLength == $ShouldLength)
? ? ? ? ?|| ( !(empty($ShouldLength2)) && ($NumberLength == $ShouldLength2) )
? ? ? ? ?|| ( !(empty($ShouldLength3)) && ($NumberLength == $ShouldLength3) ) ) ) {
? ? ? ? ?return -6;
? ? ? ? }
} else {
$this->cc_type = 'CC';
}

 

This time where it says $this->cc_type = 'CC'; above it is telling to override the previous $this->cc_type = '...'; and instead of inputting Mastercard into the database it inputs CC.

 

So is this a possible bug, that it is overiding the card for no reason. Cant the length check be carried out without overriding the credit card type with CC.

 

Or am I the only person that has experience this?

 

My next point is that in the orginal cc_validation.php with osC just has:

 

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

 

Those credit cards, is there a way to add Maestro, Switch, Delta and Solo?

 

Sorry for so many questions but this is really annoying me.

Edited by saJezza

Just embarked upon the greatest journey of my life........

Link to comment
Share on other sites

Also since I wrote my previous post I hve also thought of this. If you use a card which requires Issue Number, and if a customer forgets to give the issue number will the catalog tell you that it has been left out. However since the customer has not defined what type of credit card he is using how will the catalog know if he needs to enter an issue number or not.

 

Is this included in the CC_CVV_start date mod or not?

 

Or would it be easy to add.

 

As I am writing my own checkout procedure and so far I have this working: CC Name, CC Number, CC Start Date, CC Expiry Date and CVV number. I am now working on Issue Number.

 

However, could there be a drop-down menu which lists the types of credit cards that can be used, if you select one whichs requires Issue number it will then say so. However the validation checks in cc_validation could be left in as another check to see what the credit card is used anyway.

 

OR

 

Would it be difficult to add Issue Number with the right forms of verification checks in place depending on the type of CC number to tell the customer that Issue Number is needed if he continues without typing the issue number in.

 

[i think I may have over complicated that]

 

This is a second part of my previous post.

Edited by saJezza

Just embarked upon the greatest journey of my life........

Link to comment
Share on other sites

We also just added this mod to a fresh MS2 store and it seems to be working in initial testing.

 

ONE IMPORTANT THING FOR INSTALLING!!! I forgot to uninstall (Remove) the previous stock CC.php module first (in the Admin control panel) and I could not get this one to show up in the Admin section -- kept getting errors. I had to manually go into the database to remove all the previous settings so that I could do the Install function from the control panel. Run Remove first if you've been using the stock cc module!!

Link to comment
Share on other sites

I've got all the same problems that keysmediagroup had, plus nothing useful shows up in plus nothing shows up in admin when I go to modules>>payment>>credit cards to change stuff - I just get the stuff that ws there before the update plus a load of extra boxes under "Sort order of display." No options to add / remove cards etc. Followed the installation to the letter (several times). I'm using milestone 2.2 and the latest update of your contribution (05/05/03). Did you work out the problem? If so please pm me when you make a new release.

 

Thanks,

 

Justin

The answer to this problem is what I just commented on in my previous post. If anyone has this problem after doing the install, you will need to use phpAdmin to go into the database (configuration) and remove all the references to the previous cc.php module that are stored there. Otherwise the new module looks to the configuration database, sees that there is info there, and tries to put it into the Admin control panel section (which has the wrong info and boxes).

 

Clean out the old database, then you'll get an Install button when you refresh the Admin/Payment Modules section. That will generate new entries and records into the database appropriate to the new cc.php module.

Link to comment
Share on other sites

I got rid off my current osC and reinstalled a fresh osC 2.2 MS2 on to my server with a new database.

 

Everything admin side appears to be working, the only problem I am having is that when you go to checkout the credit card option is not there.

 

In Admin Credit Card is enabled and I even looked in my database and it is saying enabled, but in checkout it is not there.

 

Has anyone else had this, and do you know what the problem is?

Just embarked upon the greatest journey of my life........

Link to comment
Share on other sites

I've been doing some testing with different cards (done about 40 numbers so far) and I've found a Mastercard number beginning 550450 that the module won't accept.

 

You will need to increase the upper range for Mastercard in cc_validation.php - I increased it to 559999 since no other cards seemed to use the range in between, and the next card range starts at 560000.

 

BTW a fix that seems to work for removing the spaces/any non-numeric characters from the card number the customer inputs is (in cc_validation.php):

 

// start the card recognition and acceptance
	 
 class cc_validation {
   var $cc_type, $cc_number, $cc_expiry_month, $cc_expiry_year;
 
// Remove any non numeric characters.
 function cleancc($number) {
 return ereg_replace('[^0-9]', '', $number);
 }	
   
   function validate($number, $expiry_m, $expiry_y) {
     // Removed by Dee
     //$this->cc_number = $number;
     
     // Added by Dee
       $this->cc_number = ereg_replace('[^0-9]', '', $number);
       $Number = ereg_replace('[^0-9]', '', $number);
    // End added by Dee


//  could not get the strip non numerics to work but left the function in and commented out the function call
//	$Number = cc_validation::cleancc($number);	
 
   // Removed by Dee
// $Number = $number;
// End removed by Dee

Link to comment
Share on other sites

Thanks Dee, you are right!

 

 

 

In the original cc_validation, the code for Mastercard go until 559...

 

} elseif (ereg('^5[1-5][0-9]{14}$', $this->cc_number)) {

$this->cc_type = 'Master Card';

 

 

I just have had the problem with a client today, who was not able to validate his card.

 

 

 

Best regards

 

 

FX

Link to comment
Share on other sites

Thanks for that little tip, but do you know why paying by credit card option is not appearing in the checkout procedure, so far it has completely baffled me on why its not showing.

Just embarked upon the greatest journey of my life........

Link to comment
Share on other sites

Don't think I've had that problem ... I take it the module is 'installed' (enabled) in admin, and that you can set the individual cards to true or false there? If the module is enabled in admin it should show up in checkout unless you've accidentally added the mod in such a way that the new code is preventing the original bit of code being executed that puts it there ... just a thought ...

Link to comment
Share on other sites

there was one part that did confuse me:

 

<!-- BMC Delete CC Info Start -- original line -- <td class="pageHeading" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action'))) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td> -->
        <td class="pageHeading" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_ORDERS, 'oID=' . $HTTP_GET_VARS['oID'] . '&action=deleteccinfo') . '">' . tep_image_button('button_removeccinfo.gif', RemoveCCInfo) . ' </a>' . '<a href="' . tep_href_link(FILENAME_ORDERS_INVOICE, 'oID=' . $HTTP_GET_VARS['oID']) . '" TARGET="_blank">' . tep_image_button('button_invoice.gif', IMAGE_ORDERS_INVOICE) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS_PACKINGSLIP, 'oID=' . $HTTP_GET_VARS['oID']) . '" TARGET="_blank">' . tep_image_button('button_packingslip.gif', IMAGE_ORDERS_PACKINGSLIP) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action'))) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>
<!-- BMC Delete CC Info End -->

 

The first part which says BMC CC Info Start -- original line --

 

I see that the HTML is cancelled out but the PHP code is not, when i installed it i did no bother putting in that first part, should i have. Im gonna have a go now and see if it works.

 

But yeah everything in the Admin side works, I uninstalled the original CC and enabled the new one and selected all my options.

 

jez

Just embarked upon the greatest journey of my life........

Link to comment
Share on other sites

Hmm.

 

I looked through all the code that I added and any code that I would have replaced. My problem exists in the catalog section where no actual code is replaced, only added. So my problem must lie some where else.

 

I cannot think why the code is not working.

 

Or is the problem in Admin and the settings are not being placed into the database and so when the catalog looks in the database there is nothing there.

 

...

Just embarked upon the greatest journey of my life........

Link to comment
Share on other sites

HA HAA HAA HAAA

 

 

Im laughing with joy

 

IT WORKS!!! :lol: :lol: :) :P ;) :D :rolleyes:

 

all I had to do was remove then reinstall the module. So simple i over looked it.

Just embarked upon the greatest journey of my life........

Link to comment
Share on other sites

I just installed this and everything has been working good, however I just had one customer who tried ordering with an american express and couldnt order as I guess American Express uses a 4 diget CVV number and I only have it set for 3 didget CVV.

 

If I change the CVV to 4 numbers will that mean that people using visa and mastercard with 3 number CVV numbers will not be able to order?

 

Please advise.

 

Thanks!

Link to comment
Share on other sites

Leave it at 3, you will need to change the CVV field to accept 4 characters.

In catalog>includes>modules>payments>cc.php

On about line 124 or 125 you should something like

'field' => tep_draw_input_field('cc_cvv', '', 'size=3 maxlength=3'))));

 

Change the number from 3 to 4

Link to comment
Share on other sites

Does anyone know how to get the top line of this bit (on the checkout confirmation screen) to line up with the text below it:

 

Credit/Debit Card:Visa
Card Owner (name as printed on card):	Test Test
Card Number:	4111XXXXXXXX1111
Card Start Date (Switch/Solo/Maestro/Delta):	January, 2000
Card Expiry Date (all cards):	January, 2004
Card CVV Code (the last 3 digits on the signature strip):	123
Card Issue Number (Switch/Solo/Maestro/Delta):

 

I don't know it's going to come out formatted properly on this post, but on the checkout confirmation screen the 'Credit/Debit Card:' text doesn't line up with the rest of the text below it ('card Owner' etc.), and neither does the 'Visa' text line up with 'Test Test' etc.

 

Seems to be this bit of code in checkout_confirmation.php:

 

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
           <td><table border="0" cellspacing="0" cellpadding="2">
             <tr>
               <td class="main" colspan="4"><?php echo $confirmation['title']; ?></td>
             </tr>
<?php
     for ($i=0, $n=sizeof($confirmation['fields']); $i<$n; $i++) {
?>
             <tr>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td class="main"><?php echo $confirmation['fields'][$i]['title']; ?></td>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td class="main"><?php echo $confirmation['fields'][$i]['field']; ?></td>
             </tr>
<?php

 

But I can't see where the formatting code is.

 

Similar problem on the previous page (payment information) where the 'Credit/Debit Card' text doesn't line up, eg:

 

Credit/Debit Card

Card Owner (name as printed on card):

Card Number:

Card Start Date (Switch/Solo/Maestro/Delta): ?

Card Expiry Date (all cards): ?

Card CVV Code (the last 3 digits on the signature strip):

Card Issue Number (Switch/Solo/Maestro/Delta):

 

and (I think) this bit of code is responsible ... but again, how to change it..?

 

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                   <td class="main" colspan="3"><b><?php echo $selection[$i]['module']; ?></b></td>
                   <td class="main" align="right">

 

TIA

 

:)

Link to comment
Share on other sites

Ooops ... you obviously can't put spaces in front of text when you paste on here and expect it to do what you want ... that second 'Credit/Debit Card' question in my post above was supposed to have the 'Credit/Debit Card' text 3 or 4 spaces to the left of the text below it ...

 

Why can't computers get on with each other ...

 

 

 

:rolleyes:

Link to comment
Share on other sites

Hi

 

Found the problem.

 

Change this piece of code:

 

<tr>
              <td class="main" colspan="4"><?php echo $confirmation['title']; ?></td>
            </tr>

 

to:

 

<tr>
              <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
              <td class="main"><?php echo $confirmation['fields'][$i]['title']; ?></td>
              <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
              <td class="main"><?php echo $confirmation['fields'][$i]['field']; ?></td>
            </tr>

 

That should work.

 

Jez

Just embarked upon the greatest journey of my life........

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