Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Need to make CVV2 required field


lamur

Recommended Posts

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

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 9 months later...

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

Link to comment
Share on other sites

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

 

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

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Link to comment
Share on other sites

  • 4 weeks later...

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

Link to comment
Share on other sites

  • 2 months later...
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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 2 weeks later...
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.

Link to comment
Share on other sites

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

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

Link to comment
Share on other sites

  • 5 months later...

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:

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

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"') . ' <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:

$this->cc_checkcode = $cc_validation->cc_checkcode;

 

where you see this: $confirmation = array

insert this:

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:

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:

 

$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

Edited by Vger
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...