Jump to content
Sign in to follow this  
tom@westchatham.com

Linkpoint API Problems

Recommended Posts

I am having the exact same problem.. has anyone else dealt with this?

 

I don't think Josh ever came to us for the solution and we aren't able to replicate it here. It is most likely a browser autocomplete or caching issue but it is possible there is some fundamental underyling problem we have simply not yet seen and would see if we worked with a customer on the issue.

Share this post


Link to post
Share on other sites

I've used linkpoint for years, and have the latest version of the API connector installed (1.3.4.)

 

I'm having a problem where long-existing customers, who've changed their credit card expiration dates, are being rejected by Linkpoint. Either bounced or some message, both are happening. I don't store expiration dates on site, or indeed any CC info on site, but for some reason, the rejection still happens.

 

Anyone else running into this?

 

Obviously, the ID# of the customer is the same, CC# is the same, only expiration has changed...

 

/Linkpoint is working with new customers, or ones who've been with me a year, but not the ones who've been with me for a very long time. FirstData support is no help whatsoever on this issue.

Share this post


Link to post
Share on other sites
I've used linkpoint for years, and have the latest version of the API connector installed (1.3.4.)

 

I'm having a problem where long-existing customers, who've changed their credit card expiration dates, are being rejected by Linkpoint. Either bounced or some message, both are happening. I don't store expiration dates on site, or indeed any CC info on site, but for some reason, the rejection still happens.

 

Anyone else running into this?

 

Obviously, the ID# of the customer is the same, CC# is the same, only expiration has changed...

 

/Linkpoint is working with new customers, or ones who've been with me a year, but not the ones who've been with me for a very long time. FirstData support is no help whatsoever on this issue.

 

The error logging and debug messages are verbose enough to both list the expiration and the result of using that expiration. You just need to test a case to see where the data is being pulled from because the standard module pulls it from the data entered at the time of purchase and not from a prior stored db location.

Share this post


Link to post
Share on other sites

There has been an error processing your credit card, please try again : SGS-005002: The merchant is not setup to support the requested service.

 

How can I deal with this error?

Share this post


Link to post
Share on other sites
There has been an error processing your credit card, please try again : SGS-005002: The merchant is not setup to support the requested service.

 

How can I deal with this error?

 

You call linkpoint / yourpay support and/or your merchant bank. Probably its a card you dont handle... like someone tried an Amex card and you haven't added Amex to your merchant account.

Share this post


Link to post
Share on other sites

I have got linkpoint installed I get all the way through the check out process and when I hit comfirm this fatal error is returned

Fatal error: Cannot use string offset as an array in /home/popdno5/public_html/public/includes/modules/payment/linkpoint_api.php on line 473

 

I am fairly new to oscommerce so any help would be great.

 

	
// Send PREAUTH transaction.
$result = $mylphp->curl_process($myorder);  // use curl methods
//restore the grand total

$lpOrderID="Auth: ".$result["r_ordernum"].", AVS: ".$result["r_avs"];

//mail inbound data v1.3
mail(STORE_OWNER_EMAIL_ADDRESS, "CC DEBUG INBOUND PREAUTH ".date('r'), print_r($result,true));

//perform verification work
line 473   if($result["r_avs"][1]=="N" || $result["r_avs"][3]=="N" || $result["r_avs"][3]=="S" || $result["r_approved"] != "APPROVED") {
  $myerrdisplay='';
  if($result["r_approved"] != "APPROVED") {
	$newerr=split(":",$result["r_error"]);

 

Im have no idea what to do

Thanks for any help

Share this post


Link to post
Share on other sites

Aloha,

 

I am having the same ofset error. Here is the code.

 

Thanks

 

<?php

class linkpoint_api {

var $code, $title, $description, $enabled, $cc_type, $transtype, $transmode, $zipcode, $states, $bstate, $sstate;

// class constructor

function linkpoint_api() {

global $order;

$this->code = 'linkpoint_api';

$this->title = MODULE_PAYMENT_LINKPOINT_API_TEXT_TITLE;

$this->description = MODULE_PAYMENT_LINKPOINT_API_TEXT_DESCRIPTION;

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

$this->sort_order = MODULE_PAYMENT_LINKPOINT_API_SORT_ORDER;

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

if ((int)MODULE_PAYMENT_LINKPOINT_API_ORDER_STATUS_ID > 0) {

$this->order_status = MODULE_PAYMENT_LINKPOINT_API_ORDER_STATUS_ID;

}

if (is_object($order)) $this->update_status();

}

 

// class methods

function filterLinkPoint($strToFilter){

$strToFilter=str_replace("&", " and ", $strToFilter);

$strToFilter=str_replace("?", "u", $strToFilter);

 

return $strToFilter;

}

 

//in string check

function in_string($haystack,$needle){

if(stristr($haystack, $needle) === FALSE){

return false;

}else{

return true;

}

}

 

function update_status() {

global $order;

if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_LINKPOINT_API_ZONE > 0) ) {

$check_flag = false;

$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_LINKPOINT_API_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");

while ($check = tep_db_fetch_array($check_query)) {

if ($check['zone_id'] < 1) {

$check_flag = true;

break;

} elseif ($check['zone_id'] == $order->billing['zone_id']) {

$check_flag = true;

break;

}

}

if ($check_flag == false) {

$this->enabled = false;

}

}

}

 

function javascript_validation() {

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

// ' var cc_owner = document.checkout_payment.linkpoint_api_cc_owner.value;' . "\n" .

' var cc_number = document.checkout_payment.linkpoint_api_cc_number.value;' . "\n" .

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

// ' error_message = error_message + "' . MODULE_PAYMENT_LINKPOINT_API_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_LINKPOINT_API_TEXT_JS_CC_NUMBER . '";' . "\n" .

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

' if (cc_number == "" || cc_number.length < 3) {' . "\n" .

' error_message = error_message + "' . MODULE_PAYMENT_LINKPOINT_API_TEXT_JS_CVV_NUMBER . '";' . "\n" .

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

' }' . "\n" .

' }' . "\n";

 

return $js;

}

 

function selection() {

global $order;

 

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

$expires_month[] = array('id' => sprintf('%02d', $i), 'text' => strftime('%m - %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)));

}

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

'module' => $this->title,

'fields' => array(array('title' => '<img src="'.DIR_WS_IMAGES.'cclogos.gif"><br><br>',

// 'field' => '<br><br><br>'.tep_draw_input_field('linkpoint_api_cc_owner', $order->billing['firstname'] . ' ' . $order->billing['lastname'])),

'field' => ''),

array('title' => MODULE_PAYMENT_LINKPOINT_API_TEXT_CREDIT_CARD_NUMBER,

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

array('title' => MODULE_PAYMENT_LINKPOINT_API_TEXT_CREDIT_CARD_EXPIRES,

'field' => tep_draw_pull_down_menu('linkpoint_api_cc_expires_month', $expires_month) . ' ' . tep_draw_pull_down_menu('linkpoint_api_cc_expires_year', $expires_year)),

array('title' => MODULE_PAYMENT_LINKPOINT_API_TEXT_CREDIT_CARD_CHECK_VALUE,

// 'field' => tep_draw_input_field('linkpoint_api_cc_cvm', '', 'size="4" maxlength="4"') . '  (last 3 or 4 digits on back of credit card)<br>' . '  </small>'),

'field' => tep_draw_input_field('linkpoint_api_cc_cvm', '', 'size="4" maxlength="4"') . '<img src="spacer.gif" width="13" height="1"><a href="java script:popupWindow(\''.DIR_WS_IMAGES.'cvv2.html\')" class="articleLink"><img src="'.DIR_WS_IMAGES.'cvv.gif" title="Visa/Mastercard" alt="Visa/Mastercard" align="top" border="0"><img src="spacer.gif" width="5" height="1" border="0"><img src="'.DIR_WS_IMAGES.'cvv-amex.gif" align="top" alt="American Express" title="American Express" border="0"><img src="spacer.gif" width="15" height="1" border="0">Where?</a>')));

 

return $selection;

}

 

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['linkpoint_api_cc_number'], $HTTP_POST_VARS['linkpoint_api_cc_expires_month'], $HTTP_POST_VARS['linkpoint_api_cc_expires_year']);

$error = '';

switch ($result) {

case -1:

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

break;

case -2:

case -3:

case -4:

$error = TEXT_CCVAL_ERROR_INVALID_DATE;

break;

case false:

$error = TEXT_CCVAL_ERROR_INVALID_NUMBER;

break;

}

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

$payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode($error) . '&linkpoint_api_cc_expires_month=' . $HTTP_POST_VARS['linkpoint_api_cc_expires_month'] . '&linkpoint_api_cc_expires_year=' . $HTTP_POST_VARS['linkpoint_api_cc_expires_year'] . '&linkpoint_api_cc_cvm=' . $HTTP_POST_VARS['linkpoint_api_cc_cvm'];

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

}

$this->cc_card_type = $cc_validation->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_cvm = $HTTP_POST_VARS['linkpoint_api_cc_cvm'];

$this->cc_nocvm = $HTTP_POST_VARS['linkpoint_api_cc_nocvm'];

}

 

function confirmation() {

global $HTTP_POST_VARS, $order;

$confirmation = array('title' => $this->title . ': ' . $this->cc_card_type,

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

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

array('title' => MODULE_PAYMENT_LINKPOINT_API_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_LINKPOINT_API_TEXT_CREDIT_CARD_EXPIRES,

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

return $confirmation;

}

 

function process_button() {

global $HTTP_SERVER_VARS, $order, $customer_id;

$sequence = rand(1, 1000);

$process_button_string = tep_draw_hidden_field('cc_owner', $_POST['cc_owner']) .

tep_draw_hidden_field('cc_expires', $this->cc_expiry_month . substr($this->cc_expiry_year, -2)) .

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

tep_draw_hidden_field('cc_expires_year', substr($this->cc_expiry_year, -2)) .

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

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

tep_draw_hidden_field('userid', $customer_id) .

tep_draw_hidden_field('cc_cvv', $this->cc_cvm);

// tep_draw_hidden_field('cc_cvv', $_POST['cc_cvmvalue']);

 

if ($order->billing['country']['iso_code_2'] == 'US') {

$this->bstate = $this->states[strtoupper($order->billing['state'])];

if ($this->bstate == '') {

$this->bstate = $order->billing[state];

}

$process_button_string .= tep_draw_hidden_field('bstate', $this->bstate);

} else {

$process_button_string .= tep_draw_hidden_field('bstate', $order->billing[state]);

}

 

if ($order->delivery['country']['iso_code_2'] == 'US') {

$this->sstate = $this->states[strtoupper($order->delivery['state'])];

if ($this->sstate == '') {

$this->sstate = $order->delivery[state];

}

$process_button_string .= tep_draw_hidden_field('sstate', $this->sstate);

} else {

$process_button_string .= tep_draw_hidden_field('sstate', $order->delivery[state]);

}

return $process_button_string;

}

 

function before_process() {

global $_POST, $_SERVER, $order, $cart, $db, $lp_response_array, $lp_order_id, $lpOrderID;

 

require_once(DIR_FS_CATALOG . DIR_WS_MODULES . 'payment/linkpoint_api/lphp.php');

 

 

$order->info['cc_type'] = $_POST['cc_type'];

$order->info['cc_owner'] = $_POST['cc_owner'];

$order->info['cc_cvv'] = $_POST['cc_cvv'];

 

$mylphp = new lphp;

 

// Build Info to send to Gateway

 

$myorder["host"] = MODULE_PAYMENT_LINKPOINT_API_SERVER;

$myorder["port"] = "1129";

$myorder["keyfile"]=(DIR_FS_CATALOG. DIR_WS_MODULES . 'payment/linkpoint_api/' . MODULE_PAYMENT_LINKPOINT_API_LOGIN . '.pem');

$myorder["configfile"] = MODULE_PAYMENT_LINKPOINT_API_LOGIN; // Store number

 

$myorder["ordertype"] = strtoupper(MODULE_PAYMENT_LINKPOINT_API_AUTHORIZATION_MODE);

 

switch (MODULE_PAYMENT_LINKPOINT_API_TRANSACTION_MODE_RESPONSE) {

case "Live": $myorder["result"] = "LIVE"; break;

case "Test": $myorder["result"] = "GOOD"; break;

case "Decline": $myorder["result"] = "DECLINE"; break;

}

 

$myorder["transactionorigin"] = "ECI"; // For credit card retail txns, set to RETAIL, for Mail order/telephone order, set to MOTO, for e-commerce, leave out or set to ECI

// $myorder["oid"] = ""; // Order ID number must be unique. If not set, gateway will assign one.

$myorder["ponumber"] = "1002"; // Needed for business credit cards

$myorder["taxexempt"] = "Y"; // Needed for business credit cards

$myorder["terminaltype"] = "UNSPECIFIED"; // Set terminaltype to POS for an electronic cash register or integrated POS system, STANDALONE for a point-of-sale credit card terminal, UNATTENDED for a self-service station, or UNSPECIFIED for e-commerce or other applications

$myorder["ip"] = $_SERVER['REMOTE_ADDR'];

 

// $myorder["subtotal"] = $order->info['subtotal'];

$myorder["tax"] = '0.00'; //$order->info['tax'];

// $myorder["shipping"] = $order->info['shipping_cost'];

$grantotal = number_format($order->info['total'], 2);

//in version 1.3 we are only going to pre-auth $1.00

//$myorder["chargetotal"] = str_replace(",", "", $grantotal);

$myorder["chargetotal"] = "1.00";

 

// CARD INFO

$myorder["cardnumber"] = $_POST['cc_number'];

$myorder["cardexpmonth"] = $_POST['cc_expires_month'];

$myorder["cardexpyear"] = $_POST['cc_expires_year'];

if (empty($_POST['cc_cvv'])) {

$myorder["cvmindicator"] = "not_provided";

}

else {

$myorder["cvmindicator"] = "provided";

}

$myorder["cvmvalue"] = $_POST['cc_cvv'];

 

// BILLING INFO

$myorder["userid"] = $_POST['userid'];

$myorder["name"] = $this->filterLinkPoint($order->billing['firstname'] . ' ' . $order->billing['lastname']);

$myorder["company"] = $this->filterLinkPoint($order->billing['company']);

$myorder["address1"] = $this->filterLinkPoint($order->billing['street_address']);

$myorder["address2"] = $this->filterLinkPoint($order->billing['suburb']);

$myorder["city"] = $this->filterLinkPoint($order->billing['city']);

$myorder["state"] = $this->filterLinkPoint($_POST['bstate']);

$myorder["country"] = $this->filterLinkPoint($order->billing['country']['iso_code_2']);

$myorder["phone"] = $this->filterLinkPoint($order->customer['telephone']);

// $myorder["email"] = $order->customer['email_address']; //Prevents email address from being sent to linkpoint because they will use it to send an automated receipt to the customer that is uncessary based on the osCommerce system

$myorder["addrnum"] = $this->filterLinkPoint($order->billing['street_address']); // Required for AVS. If not provided, transactions will downgrade.

$myorder["zip"] = $this->filterLinkPoint($order->billing['postcode']); // Required for AVS. If not provided, transactions will downgrade.

 

// SHIPPING INFO

$myorder["sname"] = $this->filterLinkPoint($order->delivery['firstname'] . ' ' . $order->delivery['lastname']);

$myorder["saddress1"] = $this->filterLinkPoint($order->delivery['street_address']);

$myorder["saddress2"] = $this->filterLinkPoint($order->delivery['suburb']);

$myorder["scity"] = $this->filterLinkPoint($order->delivery['city']);

$myorder["sstate"] = $this->filterLinkPoint($_POST['sstate']);

$myorder["szip"] = $this->filterLinkPoint($order->delivery['postcode']);

$myorder["scountry"] = $this->filterLinkPoint($order->delivery['country']['iso_code_2']);

 

// description needs to be limited to 100 chars

for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {

$api = htmlentities($this->filterLinkPoint($order->products[$i]['name']), ENT_QUOTES, 'UTF-8');

if (strlen($api) > '100') {

$descrip = substr($api, 0, 100);

} else {

$descrip = $api;

}

$iprice = number_format($order->products[$i]['price'], 2);

$items = array (

'id' => $order->products[$i]['id'],

'description' => $descrip,

'quantity' => $order->products[$i]['qty'],

'price' => str_replace(",", "", $iprice)

);

$myorder["items"][$i] = $items;

}

 

// MISC

// $myorder["comments"] = "Repeat customer. Ship immediately.";

$myorder["debugging"] = strtolower(MODULE_PAYMENT_LINKPOINT_API_DEBUG); // for development only - not intended for production use

 

//BACKUP TRANSACTION BEGIN PREAUTH CODE!

$realorder=$myorder;

//added in 1.3 set the real order charge total to the full amount

$myorder["ordertype"] = "PREAUTH"; //make sure this is a preauth

 

//BEGIN MAIL OUTBOUND DATA v1.3

$debugoutputorder=$myorder;

unset($debugoutputorder["cardnumber"]);

unset($debugoutputorder["cvmvalue"]);

unset($debugoutputorder["cardexpmonth"]);

unset($debugoutputorder["cardexpyear"]);

mail(STORE_OWNER_EMAIL_ADDRESS, "CC DEBUG OUTBOUND PREAUTH ".date('r'), print_r($debugoutputorder,true));

//END MAIL OUTBOUND DATA v1.3

 

 

// Send PREAUTH transaction.

$result = $mylphp->curl_process($myorder); // use curl methods

//restore the grand total

 

$lpOrderID="Auth: ".$result["r_ordernum"].", AVS: ".$result["r_avs"];

 

//mail inbound data v1.3

mail(STORE_OWNER_EMAIL_ADDRESS, "CC DEBUG INBOUND PREAUTH ".date('r'), print_r($result,true));

 

$r = print_r($result, true);

file_put_contents('result.text', $r . 'test');

//perform verification work

if($result["r_avs"][1]=="N" || $result["r_avs"][3]=="N" || $result["r_avs"][3]=="S" || $result["r_approved"] != "APPROVED") {

$myerrdisplay='';

if($result["r_approved"] != "APPROVED") {

$newerr=split(":",$result["r_error"]);

 

//Check if their was a 4th colon delimited section present.

if(isset($newerr[3])){

//Make sure it has at least 4 characters

if(strlen($newerr[3])>3){

//what happened w/ Address

if($newerr[3][0]=="N"){

$myerrdisplay.='Address did not match. ';

}elseif($newerr[3][0]=="Y"){

$myerrdisplay.='Address Verified. ';

}else{

$myerrdisplay.='Address OK. ';

}

 

//what happened w/ Zip

if($newerr[3][1]=="N"){

$myerrdisplay.='Zip did not match. ';

} elseif($newerr[3][1]=="Y"){

$myerrdisplay.='Zip Verified. ';

} else {

$myerrdisplay.='Zip OK. ';

}

 

//what happened w/ CVV

//1.3 - Added Test for r_avs=S to Change CVV verification to reject no CVV as well as incorrect CVV. Module would previously accept good or no CVV and reject bad CVV.

if($newerr[3][3]=="N"){

$myerrdisplay.='CVV or Expiration did not match. ';

}elseif($newerr[3][3]=="S"){

$myerrdisplay.='CVV Not Provided. ';

}elseif($newerr[3][3]=="Y"){

$myerrdisplay.='CVV and Expiration Verified. ';

}else{

$myerrdisplay.='CVV and Expiration OK. ';

}

}

}

 

//what happened w/ Approval

if(strstr($result['r_error'], 'R:Referral')){

$myerrdisplay.='Card not approved, please contact your bank for detailed information or use another card. This transaction has issued a referral code. ';

} elseif(strstr($result['r_error'], 'Duplicate transaction')){

$myerrdisplay.='Duplicate Transaction, please wait 1 minute and try again. ';

} else {

$myerrdisplay.='Card not approved, please contact your bank for detailed information or use another card. ';

}

}else{

//what happened w/ Address

if($result["r_avs"][0]=="N"){

$myerrdisplay.='Address did not match. ';

}elseif($result["r_avs"][0]=="Y"){

$myerrdisplay.='Address Verified. ';

}else{

$myerrdisplay.='Address OK. ';

}

 

//what happened w/ Zip

if($result["r_avs"][1]=="N"){

$myerrdisplay.='Zip did not match. ';

} elseif($result["r_avs"][1]=="Y") {

$myerrdisplay.='Zip Verified. ';

} else {

$myerrdisplay.='Zip OK. ';

}

 

//what happened w/ CVV

//1.3 - Added Test for r_avs=S to Change CVV verification to reject no CVV as well as incorrect CVV. Module would previously accept good or no CVV and reject bad CVV.

if($result["r_avs"][3]=="N") {

$myerrdisplay.='CVV or Expiration did not match. ';

} elseif($result["r_avs"][3]=="S") {

$myerrdisplay.='CVV Not Provided. ';

} elseif($result["r_avs"][3]=="Y") {

$myerrdisplay.='CVV and Expiration Verified. ';

} else {

$myerrdisplay.='CVV and Expiration OK. ';

}

 

$myerrdisplay.='Card approved. ';

}

 

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=PREAUTHORIZATION FAILED - ' . urlencode($myerrdisplay. ' Please correct the listed problems and try again or contact us by phone to process this order.'), 'SSL', true, false));

}

 

 

//CHANGE FOR 1.3

//build the real order

$realorder["chargetotal"] = str_replace(",", "", $grantotal);

$realorder["ordertype"] = "SALE";

 

//BEGIN MAIL OUTBOUND DATA v1.3

$debugoutputorder=$realorder;

unset($debugoutputorder["cardnumber"]);

unset($debugoutputorder["cvmvalue"]);

unset($debugoutputorder["cardexpmonth"]);

unset($debugoutputorder["cardexpyear"]);

mail(STORE_OWNER_EMAIL_ADDRESS, "CC DEBUG OUTBOUND SALE ".date('r'), print_r($debugoutputorder,true));

//END MAIL OUTBOUND DATA v1.3

 

 

// Send the SALE transaction.

$result = $mylphp->curl_process($realorder); // use curl methods

 

$lpOrderID.=", Sale: ".$result["r_ordernum"];

 

//mail inbound data v1.3

mail(STORE_OWNER_EMAIL_ADDRESS, "CC DEBUG INBOUND SALE ".date('r'), print_r($result,true));

 

// - SGS-000001: D:Declined:P:

//- SGS-005005: Duplicate transaction.

// Begin Transaction Status does not = APPROVED

 

if ($myorder['debugging'] == 'true') {

exit;

}

 

if ($result["r_approved"] != "APPROVED" && strstr($result['r_error'], 'D:Declined')) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . ' - ' . urlencode(MODULE_PAYMENT_LINKPOINT_API_TEXT_DECLINED_MESSAGE), 'SSL', true, false));

}

if ($result["r_approved"] != "APPROVED" && strstr($result['r_error'], 'R:Referral')) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . ' - ' . urlencode(MODULE_PAYMENT_LINKPOINT_API_TEXT_DECLINED_MESSAGE), 'SSL', true, false));

}

if ($result["r_approved"] != "APPROVED" && strstr($result['r_error'], 'Duplicate transaction')) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . ' - ' . urlencode(MODULE_PAYMENT_LINKPOINT_API_TEXT_DUPLICATE_MESSAGE), 'SSL', true, false));

}

if ($result["r_approved"] != "APPROVED" && strstr($result['r_error'], 'SGS')) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . ' - ' . urlencode($result["r_error"]), 'SSL', true, false));

}

if ($result["r_approved"] != "APPROVED" ) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . ' - ' . urlencode(MODULE_PAYMENT_LINKPOINT_API_TEXT_ERROR_MESSAGE), 'SSL', true, false));

}

// End Transaction Status does not = APPROVED

}

 

function after_process() {

return false;

}

 

function get_error() {

global $_GET;

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

'error' => stripslashes(urldecode($_GET['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_LINKPOINT_API_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 Linkpoint API module', 'MODULE_PAYMENT_LINKPOINT_API_STATUS', 'True', 'Do you want to accept Linkpoint 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 ('Store Number', 'MODULE_PAYMENT_LINKPOINT_API_LOGIN', '000001', 'The 6 or 7 digit store number for LinkPoint. For Yourpay accounts you must enter your 10 digit store number.', '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 ('LinkPoint Transaction Mode', 'MODULE_PAYMENT_LINKPOINT_API_TRANSACTION_MODE_RESPONSE', 'Live', '<strong>Live:</strong> Use for live transactions<br /><strong>Test:</strong> Use for test transactions', '6', '0', 'tep_cfg_select_option(array(\'Live\', \'Test\'), ', 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 ('Authorization Type', 'MODULE_PAYMENT_LINKPOINT_API_AUTHORIZATION_MODE', 'Preauth', 'Preauth will reserve the funds on the credit card. Sale will immediately charge the card.', '6', '0', 'tep_cfg_select_option(array(\'Preauth\', \'Sale\'), ', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('LinkPoint server', 'MODULE_PAYMENT_LINKPOINT_API_SERVER', 'secure.linkpt.net', 'LinkPoint secure server', '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 ('Debugging', 'MODULE_PAYMENT_LINKPOINT_API_DEBUG', 'False', 'Only use for troubleshooting errors.', '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 ('Sort order of display.', 'MODULE_PAYMENT_LINKPOINT_API_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_LINKPOINT_API_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_LINKPOINT_API_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())");

}

 

function remove() {

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

}

 

function keys() {

return array( 'MODULE_PAYMENT_LINKPOINT_API_STATUS', 'MODULE_PAYMENT_LINKPOINT_API_LOGIN', 'MODULE_PAYMENT_LINKPOINT_API_TRANSACTION_MODE_RESPONSE', 'MODULE_PAYMENT_LINKPOINT_API_AUTHORIZATION_MODE', 'MODULE_PAYMENT_LINKPOINT_API_SERVER', 'MODULE_PAYMENT_LINKPOINT_API_DEBUG', 'MODULE_PAYMENT_LINKPOINT_API_SORT_ORDER', 'MODULE_PAYMENT_LINKPOINT_API_ZONE', 'MODULE_PAYMENT_LINKPOINT_API_ORDER_STATUS_ID');

}

 

function _state_list() {

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

'ALASKA' => 'AK' ,

'ARIZONA' => 'AZ' ,

'ARKANSAS' => 'AR' ,

'CALIFORNIA' => 'CA' ,

'COLORADO' => 'CO' ,

'CONNECTICUT' => 'CT' ,

'DELAWARE' => 'DE' ,

'DISTRICT OF COLUMBIA' => 'DC' ,

'FLORIDA' => 'FL' ,

'GEORGIA' => 'GA' ,

'HAWAII' => 'HI' ,

'IDAHO' => 'ID' ,

'ILLINOIS' => 'IL' ,

'INDIANA' => 'IN' ,

'IOWA' => 'IA' ,

'KANSAS' => 'KS' ,

'KENTUCKY' => 'KY' ,

'LOUISIANA' => 'LA' ,

'MAINE' => 'ME' ,

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

'OHIO' => 'OH' ,

'OKLAHOMA' => 'OK' ,

'OREGON' => 'OR' ,

'PENNSYLVANIA' => 'PA' ,

'RHODE ISLAND' => 'RI' ,

'SOUTH CAROLINA' => 'SC' ,

'SOUTH DAKOTA' => 'SD' ,

'TENNESSEE' => 'TN' ,

'TEXAS' => 'TX' ,

'UTAH' => 'UT' ,

'VERMONT' => 'VT' ,

'VIRGINIA' => 'VA' ,

'WASHINGTON' => 'WA' ,

'WEST VIRGINIA' => 'WV' ,

'WISCONSIN' => 'WI' ,

'WEST VIRGINIA' => 'WV' ,

'WYOMING' => 'WY');

return $list;

}

}

?>

Share this post


Link to post
Share on other sites

Fatal error: Cannot use string offset as an array in.... is a result of not being able to connect to the server. Most likely the ports are blocked by your hosting provider.

 

The reason for this error is:

 

$results is supposed to be an array. However, when it can't establish a connection to linkpoint the results returned "FAILURECould not connect." thus returning a variable value instead of an array value. On line 478 its expecting to read the variable as an array, and fails. Hope this saves every one time.

 

YOUR ONLY SOLUTION: Switch to the LinkPoint Connect Module or Switch Hosting Companies or Get your hosting company to open the port 1129 (Good luck with that):

LinkPoint Connect Module: http://addons.oscommerce.com/info/2423

Edited by adamluz

Share this post


Link to post
Share on other sites

Quick question if anybody still looks here.

 

I have this app installed all works great. Need a little help with the popup image tho. When you click on it it says there is an error and nothing happens.

 

you can see it here and http://theniknakshop.com/shop

 

Be advised this shop is live so if you place an order it will be processed.

Thanks for any help

Share this post


Link to post
Share on other sites

Quick question if anybody still looks here.

 

I have this app installed all works great. Need a little help with the popup image tho. When you click on it it says there is an error and nothing happens.

 

you can see it here and http://theniknakshop.com/shop

 

Be advised this shop is live so if you place an order it will be processed.

Thanks for any help

 

Ok figured this one out myself. Was simply missing the javascript function needed to open windows.

 

Now if someone could tell me how to convert it so that it pops up in the lightbox form I would be most gratefull.

Share this post


Link to post
Share on other sites

Fatal error: Cannot use string offset as an array in.... is a result of not being able to connect to the server. Most likely the ports are blocked by your hosting provider.

 

The reason for this error is:

 

$results is supposed to be an array. However, when it can't establish a connection to linkpoint the results returned "FAILURECould not connect." thus returning a variable value instead of an array value. On line 478 its expecting to read the variable as an array, and fails. Hope this saves every one time.

 

YOUR ONLY SOLUTION: Switch to the LinkPoint Connect Module or Switch Hosting Companies or Get your hosting company to open the port 1129 (Good luck with that):

LinkPoint Connect Module: http://addons.oscommerce.com/info/2423

 

Thanks for this!! Saved me hours. My host opened the port for me and all is well.

Share this post


Link to post
Share on other sites

I'm getting (out of nowhere):

- SGS-020006: Please contact merchant services.

 

 

I contacted Linkpoint/First Data and they said everything checked out OK on their end. They told me to re-download and re-upload them PEM file which i did, and it didnt fix anything. Google searches turn up something about a change in address with the merchant bank? I did move 6 months ago but i never notified first data or linkpoint of this change. My statement is coming to my actual address here in my new location, however on the phone the address they had me verify was my OLD address. The tech support guy said even if that was mismatched it would still work because he's testing my current pem file and it works.

 

So where is the missing link here? Everything was fine last week. Nothings changed since then....seems to have stopped working wednesday (last order). Dreamhost says they didnt do anything and dont see any record of changes, and port 1129 is open.

 

my only option now is to call back linkpoint for the 4th time today and tell them to change my address and generate me a new PEM file?

Edited by shellyky

Share this post


Link to post
Share on other sites

THis fix worked for me.

 

You need to modify the lphp.php file.

\catalog\includes\modules\payment\linkpoint_api\lphp.php

Search for "setopt" and remove the pound symbol in front of the 2 lines.

# curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);

# curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);

 

If you have debug set to true, make sure you go back into the linkpoint_api.php file and disable debug.

 

Hope this works for everyone. :lol:

 

Brad; my hero - 4 years later and your fix worked for me, too, on linkpoint_api.php, vers 67, Now I just need to find the post about turning off the dang CC Debug emails again but that's "happy" work in comparison :D

Share this post


Link to post
Share on other sites

I installed the linkpoint API and now when i test it i get a blank page at checkout_process.php. i tried reinatlling the module but didn't help. i am on godaddy and have a dedicated server. Please help.

Share this post


Link to post
Share on other sites

I too am getting a blank page after following the instructions to a T. Port 1129 has been opened, all of the files in their proper place, the PEM file uploaded, in live mode, debug off, etc.

 

The following is from the server error log... any suggestions???

 

Thanks for looking.

 

[Tue Oct 05 11:54:29 2010] [error] [client xx.xx.xx.xx] PHP Warning: linkpoint_api::require() [<a href='function.linkpoint-api-require'>function.linkpoint-api-require</a>]: open_basedir restriction in effect.

 

File(/www/xxx/httpdocs/catalog/includes/modules/payment/linkpoint_api/lphp.php) is not within the allowed path(s): (/var/www/vhosts/xxx.com/httpdocs:/tmp) in /var/www/vhosts/xxx.com/httpdocs/catalog/includes/modules/payment/linkpoint_api.php on line 358, referer: https://www.xxx.com/catalog/checkout_confirmation.php

 

[Tue Oct 05 11:54:29 2010] [error] [client xx.xx.xx.xx] PHP Warning: linkpoint_api::require(/www/xxx/httpdocs/catalog/includes/modules/payment/linkpoint_api/lphp.php) [<a href='function.linkpoint-api-require'>function.linkpoint-api-require</a>]: failed to open stream: Operation not permitted in /var/www/vhosts/xxx.com/httpdocs/catalog/includes/modules/payment/linkpoint_api.php on line 358, referer: https://www.xxx.com/catalog/checkout_confirmation.php

 

[Tue Oct 05 11:54:29 2010] [error] [client xx.xx.xx.xx] PHP Fatal error: linkpoint_api::require() [<a href='function.require'>function.require</a>]: Failed opening required '/www/xxx/httpdocs/catalog/includes/modules/payment/linkpoint_api/lphp.php' (include_path='.:') in /var/www/vhosts/xxx.com/httpdocs/catalog/includes/modules/payment/linkpoint_api.php on line 358, referer: https://www.xxx.com/catalog/checkout_confirmation.php


Roy

Share this post


Link to post
Share on other sites

I too am getting a blank page after following the instructions to a T. Port 1129 has been opened, all of the files in their proper place, the PEM file uploaded, in live mode, debug off, etc.

 

The following is from the server error log... any suggestions???

 

Thanks for looking.

 

[Tue Oct 05 11:54:29 2010] [error] [client xx.xx.xx.xx] PHP Warning: linkpoint_api::require() [<a href='function.linkpoint-api-require'>function.linkpoint-api-require</a>]: open_basedir restriction in effect.

 

File(/www/xxx/httpdocs/catalog/includes/modules/payment/linkpoint_api/lphp.php) is not within the allowed path(s): (/var/www/vhosts/xxx.com/httpdocs:/tmp) in /var/www/vhosts/xxx.com/httpdocs/catalog/includes/modules/payment/linkpoint_api.php on line 358, referer: https://www.xxx.com/catalog/checkout_confirmation.php

 

[Tue Oct 05 11:54:29 2010] [error] [client xx.xx.xx.xx] PHP Warning: linkpoint_api::require(/www/xxx/httpdocs/catalog/includes/modules/payment/linkpoint_api/lphp.php) [<a href='function.linkpoint-api-require'>function.linkpoint-api-require</a>]: failed to open stream: Operation not permitted in /var/www/vhosts/xxx.com/httpdocs/catalog/includes/modules/payment/linkpoint_api.php on line 358, referer: https://www.xxx.com/catalog/checkout_confirmation.php

 

[Tue Oct 05 11:54:29 2010] [error] [client xx.xx.xx.xx] PHP Fatal error: linkpoint_api::require() [<a href='function.require'>function.require</a>]: Failed opening required '/www/xxx/httpdocs/catalog/includes/modules/payment/linkpoint_api/lphp.php' (include_path='.:') in /var/www/vhosts/xxx.com/httpdocs/catalog/includes/modules/payment/linkpoint_api.php on line 358, referer: https://www.xxx.com/catalog/checkout_confirmation.php

 

Problem solved! The issue was with the osCommerce configure.php file. Some time back we updated our servers and the variable for document_root was never changed. Apparently neither osCommerce nor any of the modifications that we employ ever used the variable.

 

If you are getting a blank page... check your error logs and look at configure.php.

 

Good Luck!


Roy

Share this post


Link to post
Share on other sites

I found the quick way to do it. I modified the code in checkout_processing.php. I put in blanks for all credit card related fields.

 

That is good news, glad to hear you got it working. It would probably help others here on the forum if you could post the exact code changes you made and the result that your changes had (ie, did you X out all 16 digits or just the middle 8 or first 12?).

 

I have searched the support thread for this contribution but have not found a resolution to the issue of storing credit card information. realhotstuff mentioned modifying the code in checkout_processing.php but that file does not exist in my installation of osCommerce - checkout_process.php does exist but I don't understand what he is suggesting.

 

PCI Compliance aside, I don't think that storing credit card information on your server is a wise choice. Has anyone figured this out?


Roy

Share this post


Link to post
Share on other sites

I just spent a day or so trying to get the Linkpoint API working - it just wouldn't communicate. I even switched to new hosting that would allow port 1129 to be opened, made sure that cURL was enabled, messed with a million test transactions, etc. Turns out that it was a simple fix - I had been using plugnpay, but my merchant services discontinued it and moved to Linkpoint - and part of the plugnpay install was a modification to the includes/classes/cc_validation.php file. I reverted back to the original and now all is good. I found this by looking at the error log that was being generated in my public_html directory.

 

Wow, what a pain! I hope that this post can help someone else!

 

Tony

Share this post


Link to post
Share on other sites

So after many hours on the phone with Linkpoint, I finally have the Linkpoint API module working in test mode. Two questions:

 

1. Are there credit card numbers to test the "LIVE" mode, or is it completely unnecessary because test and live modes work exactly the same?

2. I do not want to store my customers credit card information. As soon as the order is processed, I want to remove that information from my database. In searching for answers to errors, I came across a thread detailing how to remove that information. Now that I am actually searching for that thread, I can't find it. Can anyone help?

 

Thanks so much to iofast for this contribution. On a personal note, iofast, is your avatar from Fallout?

Share this post


Link to post
Share on other sites

Breezing through these posts, it seems a lot of folks may want the credit card number not recorded to their orders or database. Easy fix!

 

/checkout_process.php

Find-->

'cc_number' => $order->info['cc_number'],

 

Change to-->

// default; stored whole card in db: 'cc_number' => $order->info['cc_number'],
                                    'cc_number' => substr($order->info['cc_number'], -4),

 

This will then show only the last 4 numbers of the Card for matching purposes.

Cheers!


define('PROJECTS', 'Something that goes on forever!');

Share this post


Link to post
Share on other sites

Can someone please help me understand

 

 

 

at curl_process, incoming data:

host = secure.linkpt.net

port = 1129

keyfile = /home6/wassabis/public_html/includes/modules/payment/linkpoint_api/264940.pem

configfile = 264940

ordertype = PREAUTH

result = GOOD

transactionorigin = ECI

ponumber = 1002

taxexempt = Y

terminaltype = UNSPECIFIED

ip = 173.171.115.175

tax = 0.00

chargetotal = 1.00

cardnumber = 4111111111111111

cardexpmonth = 02

cardexpyear = 13

cvmindicator = provided

cvmvalue = 458

userid = 1

name = William Ernst

company =

address1 = 12927 Lake Tree Lane

address2 =

city = Hudson

state = FL

country = US

phone = 727-505-1758

addrnum = 12927 Lake Tree Lane

zip = 34669

sname = William Ernst

saddress1 = 12927 Lake Tree Lane

saddress2 =

scity = Hudson

sstate = FL

szip = 34669

scountry = US

 

Warning: htmlspecialchars() expects parameter 1 to be string, array given in /home6/wassabis/public_html/includes/modules/payment/linkpoint_api/lphp.php on line 343

items =

debugging = true

 

sending xml string:

<order><orderoptions><ordertype>PREAUTH</ordertype><result>GOOD</result></orderoptions><creditcard><cardnumber>4111111111111111</cardnumber><cardexpmonth>02</cardexpmonth><cardexpyear>13</cardexpyear><cvmvalue>458</cvmvalue><cvmindicator>provided</cvmindicator></creditcard><billing><name>William Ernst</name><company></company><address1>12927 Lake Tree Lane</address1><address2></address2><city>Hudson</city><state>FL</state><zip>34669</zip><country>US</country><userid>1</userid><phone>727-505-1758</phone><addrnum>12927 Lake Tree Lane</addrnum></billing><shipping><name>William Ernst</name><address1>12927 Lake Tree Lane</address1><address2></address2><city>Hudson</city><state>FL</state><zip>34669</zip><country>US</country></shipping><transactiondetails><ponumber>1002</ponumber><taxexempt>Y</taxexempt><terminaltype>UNSPECIFIED</terminaltype><ip>173.171.115.175</ip><transactionorigin>ECI</transactionorigin></transactiondetails><merchantinfo><configfile>264940</configfile><keyfile>/home6/wassabis/public_html/includes/modules/payment/linkpoint_api/264940264940.pem</keyfile><host>secure.linkpt.net</host><port>1129</port></merchantinfo><payment><chargetotal>1.00</chargetotal><tax>0.00</tax></payment> <items> <item> <id>29</id> <description>test purchase</description> <quantity>1</quantity> <price>0.01</price> </item> </items> </order>

 

 

Fatal error: Cannot use string offset as an array in /home6/wassabis/public_html/includes/modules/payment/linkpoint_api.php on line 945

 

 

This fatal error is my main concern^^

 

here is the code:

 

<?php

 

/**

 

*

 

* @author Jared De Blander <jared@iofast.com>

 

* @author James Ballenger <james@iofast.com>

 

* @copyright © 2008

 

* @version $Rev: 67 $

 

* @internal $Id: linkpoint_api.php 67 2008-10-21 16:37:43Z jared0x90 $

 

* @link http://code.google.com/p/jared0x90-php/source/browse/trunk/osCommerce/catalog/includes/modules/payment/linkpoint_api.php

 

*

 

* osCommerce, Open Source E-Commerce Solutions

 

* http://www.oscommerce.com

 

* Copyright © 2003 osCommerce

 

* Released under the GNU General Public License Version 3

 

*

 

* ********* TEST CARDS *********

 

* For testing purposes, you can use any of the card numbers listed below. The

 

* test card numbers will not result in any charges to the card. Use these card

 

* numbers with any expiration date in the future.

 

*

 

* - Visa Level 2 - 4275330012345675 (replies with a referral message)

 

* - JCB - 3566007770003510

 

* - Discover - 6011000993010978

 

* - MasterCard - 5424180279791765

 

* - Visa - 4005550000000019 or 4111111111111111

 

*

 

* It should be noted that 4005550000000019 does not reply with a referral message

 

* on a PREAUTH and in fact gets approved. Only when a SALE is ran does it return

 

* a referral. The other cards we have tested return the same preauth/sale messages

 

* and this one is unique in its behavior.

 

*

 

* - MasterCard Level 2 - 5404980000008386

 

* - Diners - 36555565010005

 

* - Amex - 372700997251009

 

*

 

*

 

* Extended by Jared De Blander and James Ballenger of www.iofast.com

 

*

 

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

 

*

 

* ***** PLEASE READ *****

 

* __ __

 

* ____ / /__ ____ _________ ________ ____ _____/ /

 

* / __ \/ / _ \/ __ `/ ___/ _ \ / ___/ _ \/ __ `/ __ /

 

* / /_/ / / __/ /_/ (__ ) __/ / / / __/ /_/ / /_/ /

 

* / .___/_/\___/\__,_/____/\___/ /_/ \___/\__,_/\__,_/

 

* /_/

 

*

 

* Due to the popularity of this file and the number of requests we receive for

 

* help we have added this short information section. Unfortunately we simply do

 

* not have the time to answer everyone and give one on one help as we both are

 

* full time employees for iofast and are typically working well beyond normal

 

* working hours to get our own work done.

 

*

 

* As most recently pointed out by "shellyky" on the osCommerce forum starting in

 

* version 1.2 we have forced email records of all CC authorizations/sales both

 

* outbound and inbound data. If you'd like to disable this simply search this file

 

* for the term mail( and comment out the lines. It is our preference to keep a

 

* detailed record of transactions in our email (with the vitals removed) so that

 

* we can quickly look up past transactions - gotta love GMail.

 

*

 

* If you would like to hire iofast to perform any kind of diagnostic, installation or

 

* code improvement work on this module or have other osCommerce or PHP related projects

 

* you'd like for us to take a look at feel free to contact us at sales@iofast.com. You can

 

* find our rates and other services at:

 

*

 

* http://www.iofast.com/iofast_services.php

 

*

 

* Most of the errors we see are related to incorrect installation, improper use/ copying

 

* of files into the correct paths, port 1129 not being open (many hosting companies block this)

 

* or not reading the directions to realize that "Secure Credit Card Transaction" is how the text

 

* will appear in the payment module section of the oscommerce website.

 

*

 

* The PEM file is also a file that people seem to corrupt or mess up pretty often. It's possible

 

* people are uploaded in ASCII mode or it has invalid permissions for your web server to be

 

* able to access it. Either way try uploading it again and check which transfer mode your

 

* FTP client is uploading this file in.

 

*

 

* Trying to use the linkpoint module in debug or test mode does not currently work.

 

* We plan to implement this in the future but at present all of our testing is performed with

 

* the linkpoint provided test cards and/or real credit cards and small order totals (for final

 

* validation).

 

*

 

* Lastly here are some useful links to the linkpoint website should you be interested

 

* in working on this module:

 

*

 

* LinkPoint API Documentation:

 

*

 

* http://www.linkpoint.com/support/sup_index.htm

 

*

 

* To go to the API guide directly (This could change 10/21/2008):

 

*

 

* http://www.linkpoint.com/product_solutions/internet/linkpointselectapi/LinkPointAPIv3_6.pdf

 

*

 

* LinkPoint API Downloads:

 

*

 

* http://www.linkpoint.com/viewcart/down_index.htm

 

*

 

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

 

*

 

* Version 1.3.4

 

* Changes/Fixes

 

* ----------------

 

* 1. Increaed verbosity in output.

 

* 2. Created new status messages for referral (states that there is a referral code)

 

* 3. Created new status message for duplcate transaction, tells customer to wait 1 minute and try again

 

* 4. Address, zip & cvv messages changed so that status OK means acceptec but not verified (such as an X code)

 

* Verified means Y (address and zip) or M (cvv and expiration)

 

* 5. Adds status of card accepted or not accepted

 

* 6. Checks if AVS info exists before attempting to verify against it.

 

* 7. Addition of the PLEASE READ section. I suggest you go read it.

 

*

 

* Version 1.3.3

 

* Changes/Fixes

 

* ----------------

 

* 1. Forced tax to a $0.00 value to assist with level 2 compliance.

 

*

 

* Version 1.3.2

 

* Changes/Fixes

 

* ----------------

 

* 1. Cleaned up the file a bit for posting to the SVN

 

*

 

* Version 1.3.1

 

* Changes/Fixes

 

* ----------------

 

* 1. Removed some of the unset commands to prevent processing transactions in

 

* a class less than level 2.

 

* 2. Now available on the Google Code SVN at the link above.

 

*

 

* Version 1.3

 

* Changes/Fixes

 

* ----------------

 

* 1. Changed to a $1.00 pre-auth and a full amount sale to prevent customers from

 

* accruing excessive holds on their cards from preauths that the bank approved

 

* but we chose to fail based on invalid card info.

 

*

 

* Version 1.2b Patch

 

* Changes/Fixes

 

* ----------------

 

* 1. More filtering on XML data. A line like richmond � + &, Virginia 123455

 

* � + will work after filtering. Linkpoint will fail transactions with �

 

* and & in the company name if these are not filtered.

 

*

 

* Version 1.2a Patch

 

* Changes/Fixes

 

* ----------------

 

* 1. Changed SALE transaction to POSTAUTH. SALE / PREAUTH creates 2 sets of

 

* 'charges' on a credit card even though the first charge (PREAUTH) is not

 

* actually completed. When speaking with LinkPoint initially they did not

 

* state that this methodology would create two seperate charges.

 

* 2. Mail outbound data w/ vital CC details removed to store owner for debugging.

 

* 3. RFC Time/Date stamp subject lines for inbound and outbound data emails

 

*

 

* Version 1.2 Patch

 

* Changes/Fixes

 

* ----------------

 

* 1. Most of the bulk code changes occur around lines 289-355.

 

* 2. Preauth verifictaion is now FORCED and CHECKED before a SALE is processed. If preauth passes, sale will be automatically processed. The linkpoint panel will show your preauth and sale events.

 

* 3. If preauth fails detailed error descriptions are given to the user based on the AVS/CVV & Expiration return code from the preauth.

 

* 4. Name is still pulled from BILLING info and is therefore pointless to have a card holder name so the text box was removed.

 

* 5. Commented out line 254 to prevent linkpoint from sending unecessary automated receipts to customers

 

* 6. Commented out line 71 and 74-77. The JavaScript to handle card name is not needed as it was never used.

 

* 7. CVV code is actually used now. This code was never being passed.

 

* 8. Store owner email address receives an email containing the preauth response values. See line 302 to change this.

 

* 9. Added a spot for you to put a CVV helper popup. Feel free to use the images from iofast.com. See line 108.

 

* 10. Filter & symbol in company name as it is not allowed by linkpoint. They claimed to be getting us a full list of disallowed symbols but never heard back from them.

 

* 11. Cleaned up and properly formatted most of the code using tab spacing.

 

**/

 

class linkpoint_api {

 

var $code, $title, $description, $enabled, $cc_type, $transtype, $transmode, $zipcode, $states, $bstate, $sstate;

 

// class constructor

 

function linkpoint_api() {

 

global $order;

 

$this->code = 'linkpoint_api';

 

$this->title = MODULE_PAYMENT_LINKPOINT_API_TEXT_TITLE;

 

$this->description = MODULE_PAYMENT_LINKPOINT_API_TEXT_DESCRIPTION;

 

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

 

$this->sort_order = MODULE_PAYMENT_LINKPOINT_API_SORT_ORDER;

 

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

 

if ((int)MODULE_PAYMENT_LINKPOINT_API_ORDER_STATUS_ID > 0) {

 

$this->order_status = MODULE_PAYMENT_LINKPOINT_API_ORDER_STATUS_ID;

 

}

 

if (is_object($order)) $this->update_status();

 

}

 

 

 

// class methods

 

function filterLinkPoint($strToFilter){

 

$strToFilter=str_replace("&", " and ", $strToFilter);

 

$strToFilter=str_replace("�", "u", $strToFilter);

 

 

 

return $strToFilter;

 

}

 

 

 

//in string check

 

function in_string($haystack,$needle){

 

if(stristr($haystack, $needle) === FALSE){

 

return false;

 

}else{

 

return true;

 

}

 

}

 

 

 

function update_status() {

 

global $order;

 

if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_LINKPOINT_API_ZONE > 0) ) {

 

$check_flag = false;

 

$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_LINKPOINT_API_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");

 

while ($check = tep_db_fetch_array($check_query)) {

 

if ($check['zone_id'] < 1) {

 

$check_flag = true;

 

break;

 

} elseif ($check['zone_id'] == $order->billing['zone_id']) {

 

$check_flag = true;

 

break;

 

}

 

}

 

if ($check_flag == false) {

 

$this->enabled = false;

 

}

 

}

 

}

 

 

 

function javascript_validation() {

 

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

 

// ' var cc_owner = document.checkout_payment.linkpoint_api_cc_owner.value;' . "\n" .

 

' var cc_number = document.checkout_payment.linkpoint_api_cc_number.value;' . "\n" .

 

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

 

// ' error_message = error_message + "' . MODULE_PAYMENT_LINKPOINT_API_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_LINKPOINT_API_TEXT_JS_CC_NUMBER . '";' . "\n" .

 

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

 

' if (cc_number == "" || cc_number.length < 3) {' . "\n" .

 

' error_message = error_message + "' . MODULE_PAYMENT_LINKPOINT_API_TEXT_JS_CVV_NUMBER . '";' . "\n" .

 

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

 

' }' . "\n" .

 

' }' . "\n";

 

 

 

return $js;

 

}

 

 

 

function selection() {

 

global $order;

 

 

 

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

 

$expires_month[] = array('id' => sprintf('%02d', $i), 'text' => strftime('%m - %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)));

 

}

 

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

 

'module' => $this->title,

 

'fields' => array(array('title' => '<img src="'.DIR_WS_IMAGES.'cclogos.gif"><br><br>',

 

// 'field' => '<br><br><br>'.tep_draw_input_field('linkpoint_api_cc_owner', $order->billing['firstname'] . ' ' . $order->billing['lastname'])),

 

'field' => ''),

 

array('title' => MODULE_PAYMENT_LINKPOINT_API_TEXT_CREDIT_CARD_NUMBER,

 

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

 

array('title' => MODULE_PAYMENT_LINKPOINT_API_TEXT_CREDIT_CARD_EXPIRES,

 

'field' => tep_draw_pull_down_menu('linkpoint_api_cc_expires_month', $expires_month) . ' ' . tep_draw_pull_down_menu('linkpoint_api_cc_expires_year', $expires_year)),

 

array('title' => MODULE_PAYMENT_LINKPOINT_API_TEXT_CREDIT_CARD_CHECK_VALUE,

 

// 'field' => tep_draw_input_field('linkpoint_api_cc_cvm', '', 'size="4" maxlength="4"') . '  (last 3 or 4 digits on back of credit card)<br>' . '  </small>'),

 

'field' => tep_draw_input_field('linkpoint_api_cc_cvm', '', 'size="4" maxlength="4"') . '<img src="spacer.gif" width="13" height="1"><a href="javascript:popupWindow(\''.DIR_WS_IMAGES.'cvv2.html\')" class="articleLink"><img src="'.DIR_WS_IMAGES.'cvv.gif" title="Visa/Mastercard" alt="Visa/Mastercard" align="top" border="0"><img src="spacer.gif" width="5" height="1" border="0"><img src="'.DIR_WS_IMAGES.'cvv-amex.gif" align="top" alt="American Express" title="American Express" border="0"><img src="spacer.gif" width="15" height="1" border="0">Where?</a>')));

 

 

 

return $selection;

 

}

 

 

 

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['linkpoint_api_cc_number'], $HTTP_POST_VARS['linkpoint_api_cc_expires_month'], $HTTP_POST_VARS['linkpoint_api_cc_expires_year'],$HTTP_POST_VARS['linkpoint_api_cc_cvm']);

 

$error = '';

 

switch ($result) {

 

case -1:

 

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

 

break;

 

case -2:

 

case -3:

 

case -4:

 

$error = TEXT_CCVAL_ERROR_INVALID_DATE;

 

break;

 

case false:

 

$error = TEXT_CCVAL_ERROR_INVALID_NUMBER;

 

break;

 

}

 

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

 

$payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode($error) . '&linkpoint_api_cc_expires_month=' . $HTTP_POST_VARS['linkpoint_api_cc_expires_month'] . '&linkpoint_api_cc_expires_year=' . $HTTP_POST_VARS['linkpoint_api_cc_expires_year'] . '&linkpoint_api_cc_cvm=' . $HTTP_POST_VARS['linkpoint_api_cc_cvm'];

 

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

 

}

 

$this->cc_card_type = $cc_validation->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_cvm = $HTTP_POST_VARS['linkpoint_api_cc_cvm'];

 

$this->cc_nocvm = $HTTP_POST_VARS['linkpoint_api_cc_nocvm'];

 

}

 

 

 

function confirmation() {

 

global $HTTP_POST_VARS, $order;

 

$confirmation = array('title' => $this->title . ': ' . $this->cc_card_type,

 

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

 

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

 

array('title' => MODULE_PAYMENT_LINKPOINT_API_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_LINKPOINT_API_TEXT_CREDIT_CARD_EXPIRES,

 

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

 

return $confirmation;

 

}

 

 

 

function process_button() {

 

global $HTTP_SERVER_VARS, $order, $customer_id;

 

$sequence = rand(1, 1000);

 

$process_button_string = tep_draw_hidden_field('cc_owner', $_POST['cc_owner']) .

 

tep_draw_hidden_field('cc_expires', $this->cc_expiry_month . substr($this->cc_expiry_year, -2)) .

 

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

 

tep_draw_hidden_field('cc_expires_year', substr($this->cc_expiry_year, -2)) .

 

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

 

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

 

tep_draw_hidden_field('userid', $customer_id) .

 

tep_draw_hidden_field('cc_cvv', $this->cc_cvm);

 

// tep_draw_hidden_field('cc_cvv', $_POST['cc_cvmvalue']);

 

 

 

if ($order->billing['country']['iso_code_2'] == 'US') {

 

$this->bstate = $this->states[strtoupper($order->billing['state'])];

 

if ($this->bstate == '') {

 

$this->bstate = $order->billing[state];

 

}

 

$process_button_string .= tep_draw_hidden_field('bstate', $this->bstate);

 

} else {

 

$process_button_string .= tep_draw_hidden_field('bstate', $order->billing[state]);

 

}

 

 

 

if ($order->delivery['country']['iso_code_2'] == 'US') {

 

$this->sstate = $this->states[strtoupper($order->delivery['state'])];

 

if ($this->sstate == '') {

 

$this->sstate = $order->delivery[state];

 

}

 

$process_button_string .= tep_draw_hidden_field('sstate', $this->sstate);

 

} else {

 

$process_button_string .= tep_draw_hidden_field('sstate', $order->delivery[state]);

 

}

 

return $process_button_string;

 

}

 

 

 

function before_process() {

 

global $_POST, $_SERVER, $order, $cart, $db, $lp_response_array, $lp_order_id, $lpOrderID;

 

 

 

require(DIR_FS_CATALOG . DIR_WS_MODULES . 'payment/linkpoint_api/lphp.php');

 

 

 

$order->info['cc_type'] = $_POST['cc_type'];

 

$order->info['cc_owner'] = $_POST['cc_owner'];

 

$order->info['cc_cvv'] = $_POST['cc_cvv'];

 

 

 

$mylphp = new lphp;

 

 

 

// Build Info to send to Gateway

 

 

 

$myorder["host"] = MODULE_PAYMENT_LINKPOINT_API_SERVER;

 

$myorder["port"] = "1129";

 

$myorder["keyfile"]=(DIR_FS_CATALOG. DIR_WS_MODULES . 'payment/linkpoint_api/' . MODULE_PAYMENT_LINKPOINT_API_LOGIN . '264940.pem');

 

$myorder["configfile"] = MODULE_PAYMENT_LINKPOINT_API_LOGIN; // Store number

 

 

 

$myorder["ordertype"] = strtoupper(MODULE_PAYMENT_LINKPOINT_API_AUTHORIZATION_MODE);

 

 

 

switch (MODULE_PAYMENT_LINKPOINT_API_TRANSACTION_MODE_RESPONSE) {

 

case "Live": $myorder["result"] = "LIVE"; break;

 

case "Test": $myorder["result"] = "GOOD"; break;

 

case "Decline": $myorder["result"] = "DECLINE"; break;

 

}

 

 

 

$myorder["transactionorigin"] = "ECI"; // For credit card retail txns, set to RETAIL, for Mail order/telephone order, set to MOTO, for e-commerce, leave out or set to ECI

 

// $myorder["oid"] = ""; // Order ID number must be unique. If not set, gateway will assign one.

 

$myorder["ponumber"] = "1002"; // Needed for business credit cards

 

$myorder["taxexempt"] = "Y"; // Needed for business credit cards

 

$myorder["terminaltype"] = "UNSPECIFIED"; // Set terminaltype to POS for an electronic cash register or integrated POS system, STANDALONE for a point-of-sale credit card terminal, UNATTENDED for a self-service station, or UNSPECIFIED for e-commerce or other applications

 

$myorder["ip"] = $_SERVER['REMOTE_ADDR'];

 

 

 

// $myorder["subtotal"] = $order->info['subtotal'];

 

$myorder["tax"] = '0.00'; //$order->info['tax'];

 

// $myorder["shipping"] = $order->info['shipping_cost'];

 

$grantotal = number_format($order->info['total'], 2);

 

//in version 1.3 we are only going to pre-auth $1.00

 

//$myorder["chargetotal"] = str_replace(",", "", $grantotal);

 

$myorder["chargetotal"] = "1.00";

 

 

 

// CARD INFO

 

$myorder["cardnumber"] = $_POST['cc_number'];

 

$myorder["cardexpmonth"] = $_POST['cc_expires_month'];

 

$myorder["cardexpyear"] = $_POST['cc_expires_year'];

 

if (empty($_POST['cc_cvv'])) {

 

$myorder["cvmindicator"] = "not_provided";

 

}

 

else {

 

$myorder["cvmindicator"] = "provided";

 

}

 

$myorder["cvmvalue"] = $_POST['cc_cvv'];

 

 

 

// BILLING INFO

 

$myorder["userid"] = $_POST['userid'];

 

$myorder["name"] = $this->filterLinkPoint($order->billing['firstname'] . ' ' . $order->billing['lastname']);

 

$myorder["company"] = $this->filterLinkPoint($order->billing['company']);

 

$myorder["address1"] = $this->filterLinkPoint($order->billing['street_address']);

 

$myorder["address2"] = $this->filterLinkPoint($order->billing['suburb']);

 

$myorder["city"] = $this->filterLinkPoint($order->billing['city']);

 

$myorder["state"] = $this->filterLinkPoint($_POST['bstate']);

 

$myorder["country"] = $this->filterLinkPoint($order->billing['country']['iso_code_2']);

 

$myorder["phone"] = $this->filterLinkPoint($order->customer['telephone']);

 

// $myorder["email"] = $order->customer['email_address']; //Prevents email address from being sent to linkpoint because they will use it to send an automated receipt to the customer that is uncessary based on the osCommerce system

 

$myorder["addrnum"] = $this->filterLinkPoint($order->billing['street_address']); // Required for AVS. If not provided, transactions will downgrade.

 

$myorder["zip"] = $this->filterLinkPoint($order->billing['postcode']); // Required for AVS. If not provided, transactions will downgrade.

 

 

 

// SHIPPING INFO

 

$myorder["sname"] = $this->filterLinkPoint($order->delivery['firstname'] . ' ' . $order->delivery['lastname']);

 

$myorder["saddress1"] = $this->filterLinkPoint($order->delivery['street_address']);

 

$myorder["saddress2"] = $this->filterLinkPoint($order->delivery['suburb']);

 

$myorder["scity"] = $this->filterLinkPoint($order->delivery['city']);

 

$myorder["sstate"] = $this->filterLinkPoint($_POST['sstate']);

 

$myorder["szip"] = $this->filterLinkPoint($order->delivery['postcode']);

 

$myorder["scountry"] = $this->filterLinkPoint($order->delivery['country']['iso_code_2']);

 

 

 

// description needs to be limited to 100 chars

 

for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {

 

$api = htmlentities($this->filterLinkPoint($order->products[$i]['name']), ENT_QUOTES, 'UTF-8');

 

if (strlen($api) > '100') {

 

$descrip = substr($api, 0, 100);

 

} else {

 

$descrip = $api;

 

}

 

$iprice = number_format($order->products[$i]['price'], 2);

 

$items = array (

 

'id' => $order->products[$i]['id'],

 

'description' => $descrip,

 

'quantity' => $order->products[$i]['qty'],

 

'price' => str_replace(",", "", $iprice)

 

);

 

$myorder["items"][$i] = $items;

 

}

 

 

 

// MISC

 

// $myorder["comments"] = "Repeat customer. Ship immediately.";

 

$myorder["debugging"] = strtolower(MODULE_PAYMENT_LINKPOINT_API_DEBUG); // for development only - not intended for production use

 

 

 

//BACKUP TRANSACTION BEGIN PREAUTH CODE!

 

$realorder=$myorder;

 

//added in 1.3 set the real order charge total to the full amount

 

$myorder["ordertype"] = "PREAUTH"; //make sure this is a preauth

 

 

 

//BEGIN MAIL OUTBOUND DATA v1.3

 

$debugoutputorder=$myorder;

 

unset($debugoutputorder["cardnumber"]);

 

unset($debugoutputorder["cvmvalue"]);

 

unset($debugoutputorder["cardexpmonth"]);

 

unset($debugoutputorder["cardexpyear"]);

 

mail(STORE_OWNER_EMAIL_ADDRESS, "CC DEBUG OUTBOUND PREAUTH ".date('r'), print_r($debugoutputorder,true));

 

//END MAIL OUTBOUND DATA v1.3

 

 

 

 

 

// Send PREAUTH transaction.

 

$result = $mylphp->curl_process($myorder); // use curl methods

 

//restore the grand total

 

 

 

$lpOrderID="Auth: ".$result["r_ordernum"].", AVS: ".$result["r_avs"];

 

 

 

//mail inbound data v1.3

 

mail(STORE_OWNER_EMAIL_ADDRESS, "CC DEBUG INBOUND PREAUTH ".date('r'), print_r($result,true));

 

 

 

//perform verification work

 

if($result["r_avs"][1]=="N" || $result["r_avs"][3]=="N" || $result["r_avs"][3]=="S" || $result["r_approved"] != "APPROVED") {

$myerrdisplay='';

 

if($result["r_approved"] != "APPROVED") {

 

$newerr=split(":",$result["r_error"]);

 

 

 

//Check if their was a 4th colon delimited section present.

 

if(isset($newerr[3])){

 

//Make sure it has at least 4 characters

 

if(strlen($newerr[3])>3){

 

//what happened w/ Address

 

if($newerr[3][0]=="N"){

 

$myerrdisplay.='Address did not match. ';

 

}elseif($newerr[3][0]=="Y"){

 

$myerrdisplay.='Address Verified. ';

 

}else{

 

$myerrdisplay.='Address OK. ';

 

}

 

 

 

//what happened w/ Zip

 

if($newerr[3][1]=="N"){

 

$myerrdisplay.='Zip did not match. ';

 

} elseif($newerr[3][1]=="Y"){

 

$myerrdisplay.='Zip Verified. ';

 

} else {

 

$myerrdisplay.='Zip OK. ';

 

}

 

 

 

//what happened w/ CVV

 

//1.3 - Added Test for r_avs=S to Change CVV verification to reject no CVV as well as incorrect CVV. Module would previously accept good or no CVV and reject bad CVV.

 

if($newerr[3][3]=="N"){

 

$myerrdisplay.='CVV or Expiration did not match. ';

 

}elseif($newerr[3][3]=="S"){

 

$myerrdisplay.='CVV Not Provided. ';

 

}elseif($newerr[3][3]=="Y"){

 

$myerrdisplay.='CVV and Expiration Verified. ';

 

}else{

 

$myerrdisplay.='CVV and Expiration OK. ';

 

}

 

}

 

}

 

 

 

//what happened w/ Approval

 

if(strstr($result['r_error'], 'R:Referral')){

 

$myerrdisplay.='Card not approved, please contact your bank for detailed information or use another card. This transaction has issued a referral code. ';

 

} elseif(strstr($result['r_error'], 'Duplicate transaction')){

 

$myerrdisplay.='Duplicate Transaction, please wait 1 minute and try again. ';

 

} else {

 

$myerrdisplay.='Card not approved, please contact your bank for detailed information or use another card. ';

 

}

 

}else{

 

//what happened w/ Address

 

if($result["r_avs"][0]=="N"){

 

$myerrdisplay.='Address did not match. ';

 

}elseif($result["r_avs"][0]=="Y"){

 

$myerrdisplay.='Address Verified. ';

 

}else{

 

$myerrdisplay.='Address OK. ';

 

}

 

 

 

//what happened w/ Zip

 

if($result["r_avs"][1]=="N"){

 

$myerrdisplay.='Zip did not match. ';

 

} elseif($result["r_avs"][1]=="Y") {

 

$myerrdisplay.='Zip Verified. ';

 

} else {

 

$myerrdisplay.='Zip OK. ';

 

}

 

 

 

//what happened w/ CVV

 

//1.3 - Added Test for r_avs=S to Change CVV verification to reject no CVV as well as incorrect CVV. Module would previously accept good or no CVV and reject bad CVV.

 

if($result["r_avs"][3]=="N") {

 

$myerrdisplay.='CVV or Expiration did not match. ';

 

} elseif($result["r_avs"][3]=="S") {

 

$myerrdisplay.='CVV Not Provided. ';

 

} elseif($result["r_avs"][3]=="Y") {

 

$myerrdisplay.='CVV and Expiration Verified. ';

 

} else {

 

$myerrdisplay.='CVV and Expiration OK. ';

 

}

 

 

 

$myerrdisplay.='Card approved. ';

 

}

 

 

 

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=PREAUTHORIZATION FAILED - ' . urlencode($myerrdisplay. ' Please correct the listed problems and try again or contact us by phone to process this order.'), 'SSL', true, false));

 

}

 

 

 

 

 

//CHANGE FOR 1.3

 

//build the real order

 

$realorder["chargetotal"] = str_replace(",", "", $grantotal);

 

$realorder["ordertype"] = "SALE";

 

 

 

//BEGIN MAIL OUTBOUND DATA v1.3

 

$debugoutputorder=$realorder;

 

unset($debugoutputorder["cardnumber"]);

 

unset($debugoutputorder["cvmvalue"]);

 

unset($debugoutputorder["cardexpmonth"]);

 

unset($debugoutputorder["cardexpyear"]);

 

mail(STORE_OWNER_EMAIL_ADDRESS, "CC DEBUG OUTBOUND SALE ".date('r'), print_r($debugoutputorder,true));

 

//END MAIL OUTBOUND DATA v1.3

 

 

 

 

 

// Send the SALE transaction.

 

$result = $mylphp->curl_process($realorder); // use curl methods

 

 

 

$lpOrderID.=", Sale: ".$result["r_ordernum"];

 

 

 

//mail inbound data v1.3

 

mail(STORE_OWNER_EMAIL_ADDRESS, "CC DEBUG INBOUND SALE ".date('r'), print_r($result,true));

 

 

 

// - SGS-000001: D:Declined:P:

 

//- SGS-005005: Duplicate transaction.

 

// Begin Transaction Status does not = APPROVED

 

 

 

if ($myorder['debugging'] == 'true') {

 

exit;

 

}

 

 

 

if ($result["r_approved"] != "APPROVED" && strstr($result['r_error'], 'D:Declined')) {

 

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . ' - ' . urlencode(MODULE_PAYMENT_LINKPOINT_API_TEXT_DECLINED_MESSAGE), 'SSL', true, false));

 

}

 

if ($result["r_approved"] != "APPROVED" && strstr($result['r_error'], 'R:Referral')) {

 

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . ' - ' . urlencode(MODULE_PAYMENT_LINKPOINT_API_TEXT_DECLINED_MESSAGE), 'SSL', true, false));

 

}

 

if ($result["r_approved"] != "APPROVED" && strstr($result['r_error'], 'Duplicate transaction')) {

 

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . ' - ' . urlencode(MODULE_PAYMENT_LINKPOINT_API_TEXT_DUPLICATE_MESSAGE), 'SSL', true, false));

 

}

 

if ($result["r_approved"] != "APPROVED" && strstr($result['r_error'], 'SGS')) {

 

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . ' - ' . urlencode($result["r_error"]), 'SSL', true, false));

 

}

 

if ($result["r_approved"] != "APPROVED" ) {

 

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . ' - ' . urlencode(MODULE_PAYMENT_LINKPOINT_API_TEXT_ERROR_MESSAGE), 'SSL', true, false));

 

}

 

// End Transaction Status does not = APPROVED

 

}

 

 

 

function after_process() {

 

return false;

 

}

 

 

 

function get_error() {

 

global $_GET;

 

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

 

'error' => stripslashes(urldecode($_GET['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_LINKPOINT_API_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 Linkpoint API module', 'MODULE_PAYMENT_LINKPOINT_API_STATUS', 'True', 'Do you want to accept Linkpoint 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 ('Store Number', 'MODULE_PAYMENT_LINKPOINT_API_LOGIN', '000001', 'The 6 or 7 digit store number for LinkPoint. For Yourpay accounts you must enter your 10 digit store number.', '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 ('LinkPoint Transaction Mode', 'MODULE_PAYMENT_LINKPOINT_API_TRANSACTION_MODE_RESPONSE', 'Live', '<strong>Live:</strong> Use for live transactions<br /><strong>Test:</strong> Use for test transactions', '6', '0', 'tep_cfg_select_option(array(\'Live\', \'Test\'), ', 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 ('Authorization Type', 'MODULE_PAYMENT_LINKPOINT_API_AUTHORIZATION_MODE', 'Preauth', 'Preauth will reserve the funds on the credit card. Sale will immediately charge the card.', '6', '0', 'tep_cfg_select_option(array(\'Preauth\', \'Sale\'), ', now())");

 

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('LinkPoint server', 'MODULE_PAYMENT_LINKPOINT_API_SERVER', 'secure.linkpt.net', 'LinkPoint secure server', '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 ('Debugging', 'MODULE_PAYMENT_LINKPOINT_API_DEBUG', 'False', 'Only use for troubleshooting errors.', '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 ('Sort order of display.', 'MODULE_PAYMENT_LINKPOINT_API_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");

 

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_LINKPOINT_API_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");

 

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_LINKPOINT_API_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())");

 

}

 

 

 

function remove() {

 

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

 

}

 

 

 

function keys() {

 

return array( 'MODULE_PAYMENT_LINKPOINT_API_STATUS', 'MODULE_PAYMENT_LINKPOINT_API_LOGIN', 'MODULE_PAYMENT_LINKPOINT_API_TRANSACTION_MODE_RESPONSE', 'MODULE_PAYMENT_LINKPOINT_API_AUTHORIZATION_MODE', 'MODULE_PAYMENT_LINKPOINT_API_SERVER', 'MODULE_PAYMENT_LINKPOINT_API_DEBUG', 'MODULE_PAYMENT_LINKPOINT_API_SORT_ORDER', 'MODULE_PAYMENT_LINKPOINT_API_ZONE', 'MODULE_PAYMENT_LINKPOINT_API_ORDER_STATUS_ID');

 

}

 

 

 

function _state_list() {

 

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

 

'ALASKA' => 'AK' ,

 

'ARIZONA' => 'AZ' ,

 

'ARKANSAS' => 'AR' ,

 

'CALIFORNIA' => 'CA' ,

 

'COLORADO' => 'CO' ,

 

'CONNECTICUT' => 'CT' ,

 

'DELAWARE' => 'DE' ,

 

'DISTRICT OF COLUMBIA' => 'DC' ,

 

'FLORIDA' => 'FL' ,

 

'GEORGIA' => 'GA' ,

 

'HAWAII' => 'HI' ,

 

'IDAHO' => 'ID' ,

 

'ILLINOIS' => 'IL' ,

 

'INDIANA' => 'IN' ,

 

'IOWA' => 'IA' ,

 

'KANSAS' => 'KS' ,

 

'KENTUCKY' => 'KY' ,

 

'LOUISIANA' => 'LA' ,

 

'MAINE' => 'ME' ,

 

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

 

'OHIO' => 'OH' ,

 

'OKLAHOMA' => 'OK' ,

 

'OREGON' => 'OR' ,

 

'PENNSYLVANIA' => 'PA' ,

 

'RHODE ISLAND' => 'RI' ,

 

'SOUTH CAROLINA' => 'SC' ,

 

'SOUTH DAKOTA' => 'SD' ,

 

'TENNESSEE' => 'TN' ,

 

'TEXAS' => 'TX' ,

 

'UTAH' => 'UT' ,

 

'VERMONT' => 'VT' ,

 

'VIRGINIA' => 'VA' ,

 

'WASHINGTON' => 'WA' ,

 

'WEST VIRGINIA' => 'WV' ,

 

'WISCONSIN' => 'WI' ,

 

'WEST VIRGINIA' => 'WV' ,

 

'WYOMING' => 'WY');

 

return $list;

 

}

 

}

 

?>

Share this post


Link to post
Share on other sites

I have the linkpoint api installe. My clients customers get the following code when checking out.

 

From Client: When trying to order on-line, I get to the final step of confirmation after giving credit card info, and instead of confirmation that order is complete, I get error message:

 

Fatal error: Cannot use string offset as an array in/home/content/59/7142359/html/includes/modules/payment/linkpoint_api.php on line 472

 

The PEM file is installed correctly. I need to get this fixed ASAP!! Any help would be great!

 

I am using GoDaddy as a hosting company, I am on a shared hosting and do not have the ability to change the port to port 1129. Is there any other issues or ways around this ARRAY ISSUE. here is the coding for around line 472: Bold is line 472

 

//perform verification work

if($result["r_avs"][1]=="N" || $result["r_avs"][3]=="N" || $result["r_avs"][3]=="S" || $result["r_approved"] != "APPROVED") {

$myerrdisplay='';

if($result["r_approved"] != "APPROVED") {

$newerr=split(":",$result["r_error"]);

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×