Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Problem Adding CVV2 to Usight Payment Module


Recommended Posts

Posted

I am having problems passing the CVV2 number to our payment gateway usight. The cvv2 number sucessfully passes to the checkout confirmation screen, but then for some reason is not passed correctly to usight. Can somebody please look at my code and see what is wrong?

 

<?php

/*

 

Brian Yarger <[email protected]>

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2002 osCommerce

 

Released under the GNU General Public License

*/

 

class usight {

var $code, $title, $description, $enabled, $states;

 

// class constructor

function usight() {

$this->code = 'usight';

$this->title = MODULE_PAYMENT_USIGHT_CURL_TEXT_TITLE;

$this->description = MODULE_PAYMENT_USIGHT_CURL_TEXT_DESCRIPTION;

$this->enabled = ((MODULE_PAYMENT_USIGHT_CURL_STATUS == 'True') ? true : false);

$this->states = $this->_state_list();

}

 

// class methods

// this method returns the javascript that will validate the form entry

function javascript_validation() {

$js = ' if (payment_value == "' . $this->code . '") {' . "\n" .

' var cc_owner = document.payment.usight_cc_owner.value;' . "\n" .

' var cc_number = document.payment.usight_cc_number.value;' . "\n" .

' if (cc_owner == "" || cc_owner.length < ' . CC_OWNER_MIN_LENGTH . ') {' . "\n" .

' error_message = error_message + "' . MODULE_PAYMENT_USIGHT_CURL_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_USIGHT_CURL_TEXT_JS_CC_NUMBER . '";' . "\n" .

' error = 1;' . "\n" .

' }' . "\n" .

' }' . "\n";

 

return $js;

}

 

// this method returns the html that creates the input form

function selection() {

global $order;

 

for ($i=1; $i<13; $i++) {

$expires_month[] = array('id' => sprintf('%02d', $i), 'text' => strftime('%B',mktime(0,0,0,$i,1,2000)));

}

 

$today = getdate();

for ($i=$today['year']; $i < $today['year']+10; $i++) {

$expires_year[] = array('id' => strftime('%y',mktime(0,0,0,1,1,$i)), 'text' => strftime('%Y',mktime(0,0,0,1,1,$i)));

}

 

if (MODULE_PAYMENT_USIGHT_CURL_ACCEPT_VISA == 'True') {

$creditCardTypes[] = array('id' => 'VISA', 'text' => 'Visa');

}

if (MODULE_PAYMENT_USIGHT_CURL_ACCEPT_MASTERCARD == 'True') {

$creditCardTypes[] = array('id' => 'MASTERCARD', 'text' => 'MasterCard');

}

if (MODULE_PAYMENT_USIGHT_CURL_ACCEPT_AMEX == 'True') {

$creditCardTypes[] = array('id' => 'AMEX', 'text' => 'American Express');

}

if (MODULE_PAYMENT_USIGHT_CURL_ACCEPT_DISCOVER == 'True') {

$creditCardTypes[] = array('id' => 'DISCOVER', 'text' => 'Discover');

}

if (MODULE_PAYMENT_USIGHT_CURL_ACCEPT_DINERS == 'True') {

$creditCardTypes[] = array('id' => 'DINERS', 'text' => 'Diners Club');

}

if (MODULE_PAYMENT_USIGHT_CURL_ACCEPT_JCB == 'True') {

$creditCardTypes[] = array('id' => 'JCB', 'text' => 'JCB');

}

 

/*$selection = array('id' => $this->code,

'module' => $this->title,

'fields' => array(array('title' => MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_OWNER,

'field' => tep_draw_input_field('usight_cc_owner', $order->billing['firstname'] . ' ' . $order->billing['lastname'])),

array('title' => MODULE_PAYMENT_USIGHT_CURL_TEXT_TYPE,

'field' => tep_draw_pull_down_menu('usight_cc_type', $creditCardTypes)),

array('title' => MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_NUMBER,

'field' => tep_draw_input_field('usight_cc_number')),

array('title' => MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_CVV,

'field' => tep_draw_input_field( 'usight_cc_cvv', '', 'size="4" maxlength="4"' ) ),

array('title' => MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_EXPIRES,

'field' => tep_draw_pull_down_menu('usight_cc_expires_month', $expires_month) . ' ' . tep_draw_pull_down_menu('usight_cc_expires_year', $expires_year))));*/

$selection = '<table border="0" cellspacing="0" cellpadding="0" width="100%">' . "\n" .

' <tr>' . "\n" .

' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_OWNER . ' </td>' . "\n" .

' <td class="main"> ' . tep_draw_input_field('usight_cc_owner') . ' </td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_TYPE . ' </td>' . "\n" .

' <td class="main"> ' . tep_draw_pull_down_menu('usight_cc_type', $creditCardTypes) . ' </td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_NUMBER . ' </td>' . "\n" .

' <td class="main"> ' . tep_draw_input_field('usight_cc_number') . ' </td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_CVV . ' </td>' . "\n" .

' <td class="main"> ' . tep_draw_input_field('usight_cc_cvv') . ' </td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_EXPIRES . ' </td>' . "\n" .

' <td class="main"> ' . tep_draw_pull_down_menu('usight_cc_expires_month', $expires_month) . ' / ' . tep_draw_pull_down_menu('usight_cc_expires_year', $expires_year) . '</td>' . "\n" .

' </tr>' . "\n" .

'</table>' . "\n";

 

return $selection;

}

 

// this method is called before the data is sent to the credit card processor

// here you can do any field validation that you need to do

// we also set the global variables here from the form values

function pre_confirmation_check() {

global $HTTP_POST_VARS;

 

include(DIR_WS_CLASSES . 'cc_validation.php');

 

$cc_validation = new cc_validation();

$result = $cc_validation->validate($HTTP_POST_VARS['usight_cc_number'], $HTTP_POST_VARS['usight_cc_expires_month'], $HTTP_POST_VARS['usight_cc_expires_year']);

 

$error = '';

switch ($result) {

case -1:

$error = sprintf(TEXT_CCVAL_ERROR_UNKNOWN_CARD, substr($cc_validation->cc_number, 0, 4));

break;

case -2:

case -3:

case -4:

$error = TEXT_CCVAL_ERROR_INVALID_DATE;

break;

case false:

$error = sprintf(TEXT_CCVAL_ERROR_INVALID_NUMBER, $cc_validation->cc_number);

break;

}

 

if ( ($result == false) || ($result < 1) ) {

$payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode($error) . '&usight_cc_owner=' . urlencode($HTTP_POST_VARS['usight_cc_owner']) . '&usight_cc_type=' . urlencode($HTTP_POST_VARS['usight_cc_type']) . '&usight_cc_expires_month=' . $HTTP_POST_VARS['usight_cc_expires_month'] . '&usight_cc_expires_year=' . $HTTP_POST_VARS['usight_cc_expires_year'];

 

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false));

}

 

// check the type the user said the card was, versus the type that cc_validation

// says it is.

//print_r($HTTP_POST_VARS);

//print_r($cc_validation);

if (($cc_validation->cc_type == 'Visa' &&

$HTTP_POST_VARS['usight_cc_type'] != 'VISA') ||

($cc_validation->cc_type == 'Master Card' &&

$HTTP_POST_VARS['usight_cc_type'] != 'MASTERCARD') ||

($cc_validation->cc_type == 'American Express' &&

$HTTP_POST_VARS['usight_cc_type'] != 'AMEX') ||

($cc_validation->cc_type == 'Diners Club' &&

$HTTP_POST_VARS['usight_cc_type'] != 'DINERS') ||

($cc_validation->cc_type == 'Discover' &&

$HTTP_POST_VARS['usight_cc_type'] != 'DISCOVER') ||

($cc_validation->cc_type == 'JCB' &&

$HTTP_POST_VARS['usight_cc_type'] != 'JCB')) {

$payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode(MODULE_PAYMENT_USIGHT_CURL_TEXT_WRONG_TYPE) . '&usight_cc_owner=' . urlencode($HTTP_POST_VARS['usight_cc_owner']) . '&usight_cc_type=' . urlencode($HTTP_POST_VARS['usight_cc_type']) . '&usight_cc_expires_month=' . $HTTP_POST_VARS['usight_cc_expires_month'] . '&usight_cc_expires_year=' . $HTTP_POST_VARS['usight_cc_expires_year'];

//echo $payment_error_return;

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false));

}

 

$this->cc_card_owner = $HTTP_POST_VARS['usight_cc_owner'];

$this->cc_card_type = $HTTP_POST_VARS['usight_cc_type'];

$this->cc_card_number = $cc_validation->cc_number;

$this->cc_expiry_month = $cc_validation->cc_expiry_month;

$this->cc_expiry_year = $cc_validation->cc_expiry_year;

$this->cc_cvv = $HTTP_POST_VARS['usight_cc_cvv'];

/*global $payment, $HTTP_POST_VARS;

 

include(DIR_WS_FUNCTIONS . 'ccval.php');

 

$cc_val = OnlyNumericSolution($HTTP_POST_VARS['usight_cc_number']);

$cc_val = CCValidationSolution($cc_val);

echo $cc_val;

if ($cc_val == '1') $cc_val = ValidateExpiry($HTTP_POST_VARS['usight_cc_expires_month'], $HTTP_POST_VARS['usight_cc_expires_year']);

 

if ($cc_val != '1') {

$payment_error_return = 'payment_error=' . $payment . '&usight_cc_owner=' . urlencode($HTTP_POST_VARS['usight_cc_owner']) . '&usight_cc_expires_month=' . $HTTP_POST_VARS['usight_cc_expires_month'] . '&usight_cc_expires_year=' . $HTTP_POST_VARS['usight_cc_expires_year'] . '&cc_val=' . urlencode($cc_val);

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false));

}*/

}

 

// this method returns the data for the confirmation page

function confirmation() {

/*global $HTTP_POST_VARS;

 

$confirmation = array('title' => $this->title,

'fields' => array(array('title' => MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_OWNER,

'field' => $HTTP_POST_VARS['usight_cc_owner']),

array('title' => MODULE_PAYMENT_USIGHT_CURL_TEXT_TYPE,

'field' => $HTTP_POST_VARS['usight_cc_type']),

array('title' => MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_NUMBER,

'field' => substr($this->cc_card_number, 0, 4) . str_repeat('X', (strlen($this->cc_card_number) - 8)) . substr($this->cc_card_number, -4)),

array('title' => MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_CVV,

'field' => $_POST['usight_cc_cvv'] ),

array('title' => MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_EXPIRES,

'field' => strftime('%B, %Y', mktime(0,0,0,$HTTP_POST_VARS['usight_cc_expires_month'], 1, '20' . $HTTP_POST_VARS['usight_cc_expires_year'])))));

 

return $confirmation;*/

global $HTTP_POST_VARS, $CardName, $CardNumber;

 

$confirmation_string = '<table border="0" cellspacing="0" cellpadding="0" width="100%">' . "\n" .

' <tr>' . "\n" .

' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_OWNER . ' ' . $HTTP_POST_VARS['usight_cc_owner'] . ' </td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_TYPE . ' ' . $HTTP_POST_VARS['usight_cc_type'] . ' </td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_NUMBER . ' ' . substr($HTTP_POST_VARS['usight_cc_number'], 0, 4) . str_repeat('X', (strlen($HTTP_POST_VARS['usight_cc_number']) - 8)) . substr($HTTP_POST_VARS['usight_cc_number'], -4) . ' </td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_CVV . ' ' . $HTTP_POST_VARS['usight_cc_cvv'] . ' </td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main"> ' . MODULE_PAYMENT_USIGHT_CURL_TEXT_CREDIT_CARD_EXPIRES . ' ' . strftime('%B, %Y', mktime(0,0,0,$HTTP_POST_VARS['usight_cc_expires_month'], 1, '20' . $HTTP_POST_VARS['usight_cc_expires_year'])) . ' </td>' . "\n" .

' </tr>' . "\n" .

'</table>' . "\n";

 

return $confirmation_string;

}

function output_error() {

global $HTTP_GET_VARS;

 

$output_error_string = '<table border="0" cellspacing="0" cellpadding="0" width="100%">' . "\n" .

' <tr>' . "\n" .

' <td class="main"> <font color="#FF0000"><b>' . $HTTP_GET_VARS['error'] . '</b></font><br> ' . stripslashes(urldecode($HTTP_GET_VARS['cc_val'])) . ' </td>' . "\n" .

' </tr>' . "\n" .

'</table>' . "\n";

 

return $output_error_string;

}

 

// this method performs the authorization by sending the data to the processor, and getting the result

function process_button() {

global $HTTP_SERVER_VARS, $order, $customer_id;

 

$process_button_string = tep_draw_hidden_field('login', ((MODULE_PAYMENT_USIGHT_CURL_TESTMODE == 'Production') ? MODULE_PAYMENT_USIGHT_CURL_LOGIN : 'testgateway')) .

tep_draw_hidden_field('firstname', $order->customer['firstname']) .

tep_draw_hidden_field('lastname', $order->customer['lastname']) .

tep_draw_hidden_field('amount', $order->info['total']) .

tep_draw_hidden_field('cardtype', $this->cc_card_type) .

tep_draw_hidden_field('cardnum', $this->cc_card_number) .

tep_draw_hidden_field('cc_v', $this->cc_cvv ) .

tep_draw_hidden_field('expmonth', $this->cc_expiry_month) .

tep_draw_hidden_field('expyear', $this->cc_expiry_year) .

tep_draw_hidden_field('cardname', $this->cc_card_owner) .

tep_draw_hidden_field('address', $order->customer['street_address']) .

tep_draw_hidden_field('city', $order->customer['city']) .

// usight expects 2 digit capilalized state codes

tep_draw_hidden_field('state', $this->states[strtoupper($order->customer['state'])]) .

tep_draw_hidden_field('zip', $order->customer['postcode']) .

tep_draw_hidden_field('country', $order->customer['country']['title']) .

tep_draw_hidden_field('phone', $order->customer['telephone']) .

// a blank email address will suppress the customer email

tep_draw_hidden_field('email', ((MODULE_PAYMENT_USIGHT_CURL_EMAIL_CUSTOMER == 'True') ? $order->customer['email_address']: '')) .

// I would like to get the order number here

// but it isn't available under after this code

// executes. So, we'll put the date in there

// so that we have something to reference. If

// we get more than one order per second we

// have problems, but I guess that would be

// a pretty good problem to have :)

tep_draw_hidden_field('invoiceno', date('Ymdhis')) .

tep_draw_hidden_field('description', 'Order Submitted from IP: ' . $HTTP_SERVER_VARS['REMOTE_ADDR'] . "\n" . $products_list);

 

$process_button_string .= tep_draw_hidden_field(tep_session_name(), tep_session_id());

 

return $process_button_string;

}

 

// this method gets called after the processing is done but before the app server

// accepts the result. It is used to check for errors.

function before_process() {

global $HTTP_POST_VARS;

 

$path_to_curl = '/usr/bin/curl';

$url = 'https://gateway.usight.com/postauth.secure';

 

$urlstring = 'GWUsername=' . rawurlencode($HTTP_POST_VARS['login']) .

'&GWBillingFirstName=' . rawurlencode($HTTP_POST_VARS['firstname']) .

'&GWBillingLastName=' . rawurlencode($HTTP_POST_VARS['lastname']) .

'&GWAmount=' . rawurlencode($HTTP_POST_VARS['amount']) .

'&GWCardNumber=' . rawurlencode($HTTP_POST_VARS['cardnum']) .

'&GWCardExpMonth=' . rawurlencode($HTTP_POST_VARS['expmonth']) .

'&GWCardExpYear=' . rawurlencode($HTTP_POST_VARS['expyear']) .

'&GWNameOnCard=' . rawurlencode($HTTP_POST_VARS['cardname']) .

'&GWBillingAddress=' . rawurlencode($HTTP_POST_VARS['address']) .

'&GWBillingCity=' . rawurlencode($HTTP_POST_VARS['city']) .

'&GWBillingState=' . rawurlencode($HTTP_POST_VARS['state']) .

'&GWBillingZip=' . rawurlencode($HTTP_POST_VARS['zip']) .

'&GWBillingCountry=' . rawurlencode($HTTP_POST_VARS['country']) .

'&Phone=' . rawurlencode($HTTP_POST_VARS['phone']) .

'&Email=' . rawurlencode($HTTP_POST_VARS['email']) .

'&CVV2=' . rawurlencode($HTTP_POST_VARS['cc_v']) .

'&custno=' . rawurlencode($HTTP_POST_VARS['custno']) .

'&InvoiceNo=' . rawurlencode($HTTP_POST_VARS['invoiceno']) .

'&Description=' . rawurlencode($HTTP_POST_VARS['description']);

 

/*

exec("$path_to_curl -f -m 60 -s --cacert '/etc/curl/curl-ca-bundle.crt' -e '$url' -d '" . $urlstring . "' --url '".$url."'", $ret_arr, $ret_code);

// echo ("$path_to_curl -f -m 60 -s -E /etc/curl/curl-ca-bundle.crt -e '$url' -d '" . $urlstring . "' --url '".$url."'");

// exec("$path_to_curl --url", $ret_arr, $ret_code);

//exec('pwd', $ret_arr, $ret_code);

// echo $path_to_curl . ' -d "' . $urlstring . '"';

// echo "$path_to_curl -f -m 60 -s -e $url -d '" . $urlstring . "' --url '".$url."'<br>";

// die;

//echo "$path_to_curl -f -m 60 -s -e $url -d '".$urlstring."' --url '".$url."'";die;

*/

$ch = curl_init('https://gateway.usight.com/postauth.secure');

 

curl_setopt($ch, CURLOPT_HEADER, 0); //-H

curl_setopt($ch, CURLOPT_POST, 1); //-d

curl_setopt($ch, CURLOPT_POSTFIELDS, $urlstring);

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

 

$data = curl_exec($ch);

curl_close($ch);

 

// $codes = split("&", $ret_arr[0]);

$codes = split("&", $data);

$returnCodes = array();

foreach($codes as $code)

{

list ($header, $value) = split('=', $code);

$returnCodes[$header] = $value;

}

if ($returnCodes['ResponseCode'] != "0")

{

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . ($returnCodes['ResponseMessage']) . '<BR>' . urlencode(MODULE_PAYMENT_USIGHT_CURL_TEXT_ERROR_MESSAGE), 'SSL', true, false));

}

if (MODULE_PAYMENT_USIGHT_CURL_CHECK_AVS == 'True')

{

if (strpos(MODULE_PAYMENT_USIGHT_CURL_AVS_CODES, $returnCodes['AVSResponse']) === false)

{

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . $returnCodes['AVSResponse'] . '<br>' . urlencode(MODULE_PAYMENT_USIGHT_CURL_TEXT_ERROR_MESSAGE_AVS), 'SSL', true, false));

}

}

# AuthCode is in AuthCode, TransactionID is in TransactionID

}

 

function after_process() {

return false;

}

 

function get_error() {

global $HTTP_GET_VARS;

 

$error = array('title' => MODULE_PAYMENT_USIGHT_CURL_TEXT_ERROR,

'error' => stripslashes(urldecode($HTTP_GET_VARS['error'])));

return $error;

}

 

function check() {

if (!isset($this->_check)) {

$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_USIGHT_CURL_STATUS'");

$this->_check = tep_db_num_rows($check_query);

}

return $this->_check;

}

 

function install() {

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Usight Module', 'MODULE_PAYMENT_USIGHT_CURL_STATUS', 'True', 'Do you want to accept Usight payments?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Login Username', 'MODULE_PAYMENT_USIGHT_CURL_LOGIN', '', 'The login username used for the Usight service', '6', '0', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Transaction Mode', 'MODULE_PAYMENT_USIGHT_CURL_TESTMODE', 'Test', 'Transaction mode used for processing orders', '6', '0', 'tep_cfg_select_option(array(\'Test\', \'Production\'), ', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Customer Notifications', 'MODULE_PAYMENT_USIGHT_CURL_EMAIL_CUSTOMER', 'False', 'Should Usight e-mail a receipt to the customer?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Check AVS', 'MODULE_PAYMENT_USIGHT_CURL_CHECK_AVS', 'False', 'Should Usight checks the AVS response?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Valid AVS Codes', 'MODULE_PAYMENT_USIGHT_CURL_AVS_CODES', 'A,W,Y,Z', 'Comma separated list of valid AVS Codes from

https://gateway.usight.com/avs.jsp', '6', '0', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Accept Visa', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_VISA', 'True', 'Should we accept Visa?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Accept Mastercard', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_MASTERCARD', 'True', 'Should we accept Mastercard?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Accept American Express', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_AMEX', 'False', 'Should we accept American Express?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Accept Discover', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_DISCOVER', 'False', 'Should we accept Discover?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Accept Diners Club', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_DINERS', 'False', 'Should we accept Diners Club?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Accept JCB', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_JCB', 'False', 'Should we accept JCB?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");

}

 

function remove() {

tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");

}

 

function keys() {

return array('MODULE_PAYMENT_USIGHT_CURL_STATUS', 'MODULE_PAYMENT_USIGHT_CURL_LOGIN', 'MODULE_PAYMENT_USIGHT_CURL_TESTMODE', 'MODULE_PAYMENT_USIGHT_CURL_EMAIL_CUSTOMER', 'MODULE_PAYMENT_USIGHT_CURL_CHECK_AVS', 'MODULE_PAYMENT_USIGHT_CURL_AVS_CODES', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_VISA', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_MASTERCARD', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_AMEX', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_DISCOVER', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_DINERS', 'MODULE_PAYMENT_USIGHT_CURL_ACCEPT_JCB');

}

 

// this internal method returns an array keyed by state name, with a value of state code

function _state_list() {

$list = array('ALABAMA' => 'AL' ,

'ALASKA' => 'AK' ,

'AMERICAN SAMOA' => 'AS' ,

'ARIZONA' => 'AZ' ,

'ARKANSAS' => 'AR' ,

'CALIFORNIA' => 'CA' ,

'COLORADO' => 'CO' ,

'CONNECTICUT' => 'CT' ,

'DELAWARE' => 'DE' ,

'DISTRICT OF COLUMBIA' => 'DC' ,

'FEDERATED STATES OF MICRONESIA' => 'FM' ,

'FLORIDA' => 'FL' ,

'GEORGIA' => 'GA' ,

'GUAM' => 'GU' ,

'HAWAII' => 'HI' ,

'IDAHO' => 'ID' ,

'ILLINOIS' => 'IL' ,

'INDIANA' => 'IN' ,

'IOWA' => 'IA' ,

'KANSAS' => 'KS' ,

'KENTUCKY' => 'KY' ,

'LOUISIANA' => 'LA' ,

'MAINE' => 'ME' ,

'MARSHALL ISLANDS' => 'MH' ,

'MARYLAND' => 'MD' ,

'MASSACHUSETTS' => 'MA' ,

'MICHIGAN' => 'MI' ,

'MINNESOTA' => 'MN' ,

'MISSISSIPPI' => 'MS' ,

'MISSOURI' => 'MO' ,

'MONTANA' => 'MT' ,

'NEBRASKA' => 'NE' ,

'NEVADA' => 'NV' ,

'NEW HAMPSHIRE' => 'NH' ,

'NEW JERSEY' => 'NJ' ,

'NEW MEXICO' => 'NM' ,

'NEW YORK' => 'NY' ,

'NORTH CAROLINA' => 'NC' ,

'NORTH DAKOTA' => 'ND' ,

'NORTHERN MARIANA ISLANDS' => 'MP' ,

'OHIO' => 'OH' ,

'OKLAHOMA' => 'OK' ,

'OREGON' => 'OR' ,

'PALAU' => 'PW' ,

'PENNSYLVANIA' => 'PA' ,

'PUERTO RICO' => 'PR' ,

'RHODE ISLAND' => 'RI' ,

'SOUTH CAROLINA' => 'SC' ,

'SOUTH DAKOTA' => 'SD' ,

'TENNESSEE' => 'TN' ,

'TEXAS' => 'TX' ,

'UTAH' => 'UT' ,

'VERMONT' => 'VT' ,

'VIRGIN ISLANDS' => 'VI' ,

'VIRGINIA' => 'VA' ,

'WASHINGTON' => 'WA' ,

'WEST VIRGINIA' => 'WV' ,

'WISCONSIN' => 'WI' ,

'WYOMING' => 'WY' ,

'ALBERTA' => 'AB' ,

'BRITISH COLUMBIA' => 'BC' ,

'MANITOBA' => 'MB' ,

'NEW BRUNSWICK' => 'NB' ,

'NEWFOUNDLAND AND LABRADOR' => 'NL' ,

'NORTHWEST TERRITORIES' => 'NT' ,

'NOVA SCOTIA' => 'NS' ,

'NUNAVUT' => 'NU' ,

'ONTARIO' => 'ON' ,

'PRINCE EDWARD ISLAND' => 'PE' ,

'QUEBEC' => 'QC' ,

'SASKATCHEWAN' => 'SK' ,

'YUKON' => 'YT' ,

'ARMED FORCES AFRICA' => 'AE' ,

'ARMED FORCES EUROPE' => 'AE' ,

'ARMED FORCES CANADA' => 'AE' ,

'ARMED FORCES MIDDLE EAST' => 'AE' ,

'ARMED FORCES AMERICAS' => 'AA' ,

'ARMED FORCES PACIFIC' => 'AP');

return $list;

}

}

?>

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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