Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

require cvv code


knifeman

Recommended Posts

Hi all,

 

I am still kinda weak in php and need a boost. My merchant account is now charging me if customers do not fill out the cvv field. I use linkpoint and I think I have narrowed the code to this section

function javascript_validation() {
  $js = '  if (payment_value == "' . $this->code . '") {' . "\n" .
		'	var cc_owner = document.checkout_payment.cc_owner.value;' . "\n" .
		'	var cc_number = document.checkout_payment.cc_number.value;' . "\n" .
		'	if (cc_owner == "" || cc_owner.length < ' . CC_OWNER_MIN_LENGTH . ') {' . "\n" .
		'	  error_message = error_message + "' . MODULE_PAYMENT_LINKPOINTMS1_TEXT_JS_CC_OWNER . '";' . "\n" .
		'	  error = 1;' . "\n" .
		'	}' . "\n" .
		'	if (cc_number == "" || cc_number.length < ' . CC_NUMBER_MIN_LENGTH . ') {' . "\n" .
		'	  error_message = error_message + "' . MODULE_PAYMENT_LINKPOINTMS1_TEXT_JS_CC_NUMBER . '";' . "\n" .
		'	  error = 1;' . "\n" .
		'	}' . "\n" .
		'  }' . "\n";

  return $js;
}

I realize I will need to add a define for the error message in a different file. I believe I can handle that part. I just don't know where to begin modifying this code to make the cvv field required.

This is the define for the cvv field now.

define('MODULE_PAYMENT_LINKPOINTMS1_TEXT_CREDIT_CARD_CHECKNUMBER', 'Card Verification Value:');

So if someone would be kind enough to help me out here, I think this checknumber bit needs to be added into the first code so it too will be required. To be brutally honest, there are too many " } and n for me to figure this one out.

Link to comment
Share on other sites

I changed the code to this

function javascript_validation() {
$js = ' if (payment_value == "' . $this->code . '") {' . "\n" .
' var cc_owner = document.checkout_payment.cc_owner.value;' . "\n" .
' var cc_number = document.checkout_payment.cc_number.value;' . "\n" .
' var cc_checkcode = document.checkout_payment.cc_checkcode;' . "\n" .
' if (cc_owner == "" || cc_owner.length < ' . CC_OWNER_MIN_LENGTH . ') {' . "\n" .
' error_message = error_message + "' . MODULE_PAYMENT_LINKPOINTMS1_TEXT_JS_CC_OWNER . '";' . "\n" .
' error = 1;' . "\n" .
' }' . "\n" .
' if (cc_number == "" || cc_number.length < ' . CC_NUMBER_MIN_LENGTH . ') {' . "\n" .
' error_message = error_message + "' . MODULE_PAYMENT_LINKPOINTMS1_TEXT_JS_CC_NUMBER . '";' . "\n" .
' error = 1;' . "\n" .
' }' . "\n" .
' }' . "\n";
' if (cc_checkcode == "" || cc_checkcode.length < ' . CC_CHECKCODE_MIN_LENGTH . ') {' . "\n" .
' error_message = error_message + "' . MODULE_PAYMENT_LINKPOINTMS1_TEXT_JS_CC_CHECKCODE . '";' . "\n" .
' error = 1;' . "\n" .
' }' . "\n" .
' }' . "\n" .
' }' . "\n";

return $js;
}

and added a define to includes/languages/english/modules/payment/linkpointms1.php

define('MODULE_PAYMENT_LINKPOINTMS1_TEXT_JS_CC_CHECKCODE', '* The credit card verification number must be at least ' . CC_CHECKCODE_MIN_LENGTH . ' characters.\n');

The checkout still works, but does not require the cvv number. I cannot find anyplace to define what the minimum length is. Matter of fact, I can't find where the other two lengths are defined either. I sure hope someone can tell me before I have to undo everything I have tried this evening.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...