OSCOMMERCE SUPPORT CALL 702-453-3332

 

Help - Search - Members - Calendar
Full Version: Need to make CVV2 required field
osCommerce Community Support Forums > osCommerce Online Merchant v2.x > Contributions / Add-Ons > Payment Modules > Other
lamur
Greetings,
I installed this:
http://www.oscommerce.com/community/contri...all/search,cvv2

Credit Card with CVV2

Well I finally got it working after a few problems. But I need to know how I can make that field required so that everyone that uses a credit card will have to input that?
Anyhelp would be great. Thank you.
lamur
I don't need anything fancy, just an easy fix would be appreciated. I am not much of a coder so this is very hard for me to figure out.
satish
QUOTE (lamur @ Nov 15 2005, 05:34 AM) *
Greetings,
I installed this:
http://www.oscommerce.com/community/contri...all/search,cvv2

Credit Card with CVV2

Well I finally got it working after a few problems. But I need to know how I can make that field required so that everyone that uses a credit card will have to input that?
Anyhelp would be great. Thank you.

in the cc validation class check for CVV and if blank then return an error.
Also in the check box when the user fill placea red *** showing that it is compulsry.

Satish
lamur
QUOTE (satish @ Nov 17 2005, 04:45 AM) *
in the cc validation class check for CVV and if blank then return an error.
Also in the check box when the user fill placea red *** showing that it is compulsry.

Satish

Which cc validation class? I am not all that great at coding and havent worked much with the code so this is pretty new to me. Which files would I end up editing?
Thanks a ton for your reply satish
arames
Have you found out the solution? What files do we need to change to make the CVV2 entry a MUST filed for customers to fill ?

Also how do we setup a link next to the CVV to explain what is CVV?

Regards,
Arames T.
from Berlin, GERMANY
satish
In includes/classes/cc_validation.php
function validate($number, $expiry_m, $expiry_y) change to function validate($number, $expiry_m, $expiry_y,$ccv) .
Pass $ccv additionally to this function.

if ($ccv)
{}
else
{return an error}

Satish

QUOTE (arames @ Sep 3 2006, 06:41 PM) *
Have you found out the solution? What files do we need to change to make the CVV2 entry a MUST filed for customers to fill ?

Also how do we setup a link next to the CVV to explain what is CVV?

Regards,
Arames T.
from Berlin, GERMANY
balynce
I installed this mod ... a version after the "fix for the database" but mine does not write the cvv to the database as far as I can tell. When I go into admin the CVV is blank. Was this not implimented in the newer version? I'm having a hard time finding the differences between the two..
newtech
QUOTE (balynce @ Oct 1 2006, 01:29 PM) *
I installed this mod ... a version after the "fix for the database" but mine does not write the cvv to the database as far as I can tell. When I go into admin the CVV is blank. Was this not implimented in the newer version? I'm having a hard time finding the differences between the two..

I am having the same problem-when go into admin the CVV is blank.
newtech
QUOTE (satish @ Sep 7 2006, 07:29 AM) *
In includes/classes/cc_validation.php
function validate($number, $expiry_m, $expiry_y) change to function validate($number, $expiry_m, $expiry_y,$ccv) .
Pass $ccv additionally to this function.

if ($ccv)
{}
else
{return an error}

Satish

I am using ccv version 2, so my class cc_validation looks like this:
{
var $cc_type, $cc_number, $cc_expiry_month, $cc_expiry_year, $cc_cvv2;

function validate($number, $expiry_m, $expiry_y, $cvv2) {
$this->cc_number = ereg_replace('[^0-9]', '', $number);

Right after this I am adding
if ($ccv2)
{}
else
{return an error}

and I get a blank white screen if the customer does not enter a CCV and clicks continue
newtech
QUOTE (newtech @ Dec 11 2006, 01:17 PM) *
I am having the same problem-when go into admin the CVV is blank.

The program is writing the CCV to teh database because I can see it in the database, but I do not see it in admin.
newtech
QUOTE (newtech @ Dec 11 2006, 01:40 PM) *
The program is writing the CCV to teh database because I can see it in the database, but I do not see it in admin.

I got this contrib to work properly, but I need it to make CCV field have red asterisk and make it a required field. Anybody know how to do this? I can't get this part to work right.
newtech
QUOTE (newtech @ Dec 19 2006, 02:36 PM) *
I got this contrib to work properly, but I need it to make CCV field have red asterisk and make it a required field. Anybody know how to do this? I can't get this part to work right.


Here is the latest edit I have done but still get blank screen
QUOTE
class cc_validation {
var $cc_type, $cc_number, $cc_expiry_month, $cc_expiry_year, $cc_cvv2;

function validate($number, $expiry_m, $expiry_y, $cvv2) {
$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;
}

if (is_numeric($expiry_m) && ($expiry_m > 0) && ($expiry_m < 13)) {
$this->cc_expiry_month = $expiry_m;
} else {
return -2;
}

$current_year = date('Y');
$expiry_y = substr($current_year, 0, 2) . $expiry_y;
if (is_numeric($expiry_y) && ($expiry_y >= $current_year) && ($expiry_y <= ($current_year + 10))) {
$this->cc_expiry_year = $expiry_y;
} else {
return -3;
}

if ($expiry_y == $current_year) {
if ($expiry_m < date('n')) {
return -4;
}
}

if ( (strlen($cvv2) < 3) or (strlen($cvv2) > 4)) {
return -5;
}

return $this->is_valid();
}

if ($ccv2)
{}
else
{return an error}

function is_valid() {
$cardNumber = strrev($this->cc_number);
$numSum = 0;

for ($i=0; $i<strlen($cardNumber); $i++) {
$currentNum = substr($cardNumber, $i, 1);
cmjeter
I am having the same issue. In admin I get blank code. Any ideas why this wont work. I followed the instructions correctly.

Thanks
Vger
I know this post is a little old, but I find the "helpful" posts to be very unhelpful. So here is how to make CVV a required field:

In your payment module in includes/modues/payment/ add these pieces of code where appropriate:

In the javascript validation section:
CODE
'    if (cc_checkcode == "" || cc_checkcode.length < "3" || cc_checkcode.length > "4") {' . "\n".
             '      error_message = error_message + "' . MODULE_PAYMENT_YOUR_PAYMENT_MODULE_TEXT_CVV_ERROR_CODE . '";' . "\n" .
             '      error = 1;' . "\n" .
             '    }' . "\n" .


Where you see $selection = array add this:
CODE
array('title' => MODULE_PAYMENT_YOUR_PAYMENT_MODULE_TEXT_CREDIT_CARD_CHECKNUMBER,
                         'field' => tep_draw_input_field('your_payment_module_cc_checkcode', '', 'size="4" maxlength="4"') . '&nbsp;<small>' . MODULE_PAYMENT_YOUR_PAYMENT_MODULE_TEXT_CREDIT_CARD_CHECKNUMBER_LOCATION . '</small>')),


Below this:
$this->cc_expiry_year = $cc_validation->cc_expiry_year;
add this:
CODE
$this->cc_checkcode = $cc_validation->cc_checkcode;


where you see this: $confirmation = array
insert this:
CODE
array('title' => MODULE_PAYMENT_YOUR_PAYMENT_MODULE_TEXT_CREDIT_CARD_CHECKNUMBER,
                                                    'field' => $HTTP_POST_VARS['your_module_cc_checkcode']),


where you see this:
$process_button_string
insert this:
CODE
tep_draw_hidden_field('cc_checkcode', $HTTP_POST_VARS['your_module_cc_checkcode']) .


to pass the cvv code to the card processing company use something like this in amongst all the other informaton to be passed:

CODE
$cc_checkcode = iconv(CHARSET, 'UTF-8', $HTTP_POST_VARS['cc_checkcode']);


Then make sure that you have the TEXT defines from above in includes/languages/english/modules/payment/your_module.php

I won't be monitoring this thread, and won't be replying to posts on it - but this should help you out.

Vger
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.