예제 #1
0
function linkpoint_capture($params)
{
    include_once dirname(__FILE__) . "/../../includes/lphp.php";
    $mylphp = new lphp();
    if ($params['testmode'] == "on") {
        $myorder['host'] = "staging.linkpt.net";
        $myorder['result'] = "GOOD";
    } else {
        $myorder['host'] = "secure.linkpt.net";
        $myorder['result'] = "LIVE";
    }
    $myorder['port'] = "1129";
    $myorder['keyfile'] = $params['keyfile'];
    $myorder['configfile'] = $params['storenumber'];
    $myorder['ordertype'] = "SALE";
    $myorder['transactionorigin'] = "ECI";
    $myorder['terminaltype'] = "UNSPECIFIED";
    $myorder['chargetotal'] = $params['amount'];
    $address1Tokens = explode(" ", $params['clientdetails']['address1']);
    if (is_numeric($address1Tokens[0])) {
        $myorder['addrnum'] = $address1Tokens[0];
    }
    $myorder['zip'] = $params['postcode'];
    $myorder['cardnumber'] = $params['cardnum'];
    $myorder['cardexpmonth'] = substr($params['cardexp'], 0, 2);
    $myorder['cardexpyear'] = substr($params['cardexp'], 2, 2);
    $myorder['cvmvalue'] = $params['cccvv'];
    if (0 < strlen($myorder['cvmvalue'])) {
        $myorder['cvmindicator'] = "provided";
    }
    $myorder['ip'] = $_SERVER['REMOTE_ADDR'];
    $myorder['name'] = $params['clientdetails']['firstname'] . " " . $params['clientdetails']['lastname'];
    $myorder['address1'] = $params['clientdetails']['address1'];
    $myorder['city'] = $params['clientdetails']['city'];
    $myorder['state'] = $params['clientdetails']['state'];
    $myorder['country'] = $params['clientdetails']['country'];
    $myorder['phone'] = $params['clientdetails']['phonenumber'];
    $myorder['fax'] = "";
    $myorder['zip'] = $params['clientdetails']['postcode'];
    $myorder['debugging'] = "false";
    $result = $mylphp->curl_process($myorder);
    $desc = "Action => Capture\nClient => " . $params['clientdetails']['firstname'] . " " . $params['clientdetails']['lastname'] . ("\nResult => " . $result . "\n") . $mylphp->debugstr;
    foreach ($result as $errorkey => $errorvalue) {
        if ($errorkey != "cardnumber" && $errorkey != "cvmvalue") {
            $desc .= "" . $errorkey . " => " . $errorvalue . "\n";
            continue;
        }
    }
    if ($result['r_message'] === "APPROVED") {
        return array("status" => "success", "transid" => $result['r_ordernum'], "rawdata" => $desc);
    }
    return array("status" => "declined", "rawdata" => $desc);
}
예제 #2
0
$myorder["keyfile"] = "./YOURCERT.pem";
# Change this to the name and location of your certificate file
$myorder["configfile"] = "1234567";
# Change this to your store number
$myorder["ordertype"] = "PREAUTH";
$myorder["chargetotal"] = "12.99";
$myorder["cardnumber"] = "4111-1111-1111-1111";
$myorder["cardexpmonth"] = "03";
$myorder["cardexpyear"] = "05";
$myorder["addrnum"] = "123";
# Required for AVS. If not provided, transactions will downgrade.
$myorder["zip"] = "12345";
# Required for AVS. If not provided, transactions will downgrade.
# Send transaction. Use one of two possible methods  #
//	$result = $mylphp->process($myorder);       # use shared library model
$result = $mylphp->curl_process($myorder);
# use curl methods
if ($result["r_approved"] != "APPROVED") {
    print "Status: {$result['r_approved']}\n";
    print "Error: {$result['r_error']}\n";
} else {
    // success
    print "Status: {$result['r_approved']}\n";
    print "Code: {$result['r_code']}\n";
    print "OID: {$result['r_ordernum']}\n\n";
}
/*
	# Look at returned hash & use the elements you need  #
	while (list($key, $value) = each($result))
	{
		echo "$key = $value\n"; 
예제 #3
0
function gateway_linkpoint($seperator, $sessionid)
{
    global $wpdb;
    $transact_url = get_option('transact_url');
    $purchase_log_sql = "SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `sessionid`= '" . $sessionid . "' LIMIT 1";
    $purchase_log = $wpdb->get_results($purchase_log_sql, ARRAY_A);
    $purchase_log = $purchase_log[0];
    //Get provided user info
    //Here starts most of the changes implemented into linkpoint for passing userinfo
    $usersql = "SELECT\n\t\t`" . WPSC_TABLE_SUBMITED_FORM_DATA . "`.value,\n\t\t`" . WPSC_TABLE_CHECKOUT_FORMS . "`.`name`,\n\t\t`" . WPSC_TABLE_CHECKOUT_FORMS . "`.`unique_name` FROM\n\t\t`" . WPSC_TABLE_CHECKOUT_FORMS . "` LEFT JOIN\n\t\t`" . WPSC_TABLE_SUBMITED_FORM_DATA . "` ON\n\t\t`" . WPSC_TABLE_CHECKOUT_FORMS . "`.id =\n\t\t`" . WPSC_TABLE_SUBMITED_FORM_DATA . "`.`form_id` WHERE\n\t\t`" . WPSC_TABLE_SUBMITED_FORM_DATA . "`.`log_id`=" . $purchase_log['id'] . " ORDER BY `" . WPSC_TABLE_CHECKOUT_FORMS . "`.`checkout_order`";
    $userinfo = $wpdb->get_results($usersql, ARRAY_A);
    foreach ((array) $userinfo as $key => $value) {
        if ($value['unique_name'] == 'billingfirstname' && $value['value'] != '') {
            $myorder1['FIRSTNAME'] = $value['value'];
        }
        if ($value['unique_name'] == 'billinglastname' && $value['value'] != '') {
            $myorder1['LASTNAME'] = $value['value'];
        }
        if ($value['unique_name'] == 'billingemail' && $value['value'] != '') {
            $myorder1['EMAIL'] = $value['value'];
        }
        if ($value['unique_name'] == 'billingphone' && $value['value'] != '') {
            $myorder1['PHONENUM'] = $value['value'];
        }
        if ($value['unique_name'] == 'billingaddress' && $value['value'] != '') {
            $myorder1['STREET'] = $value['value'];
        }
        if ($value['unique_name'] == 'billingcity' && $value['value'] != '') {
            $myorder1['CITY'] = $value['value'];
        }
        if ($value['unique_name'] == 'billingstate' && $value['value'] != '') {
            $sql = "SELECT `code` FROM `" . WPSC_TABLE_REGION_TAX . "` WHERE `id` ='" . $value['value'] . "' LIMIT 1";
            $myorder1['STATE'] = $wpdb->get_var($sql);
        } else {
            //	$data['STATE']='CA';
        }
        if ($value['unique_name'] == 'billingcountry' && $value['value'] != '') {
            $value['value'] = maybe_unserialize($value['value']);
            if ($value['value'][0] == 'UK') {
                $myorder1['COUNTRYCODE'] = 'GB';
            } else {
                $myorder1['COUNTRYCODE'] = $value['value'][0];
            }
            if (is_numeric($value['value'][1])) {
                $sql = "SELECT `code` FROM `" . WPSC_TABLE_REGION_TAX . "` WHERE `id` ='" . $value['value'][1] . "' LIMIT 1";
                $myorder1['STATE'] = $wpdb->get_var($sql);
            }
        }
        if ($value['unique_name'] == 'billingpostcode' && $value['value'] != '') {
            $myorder1['ZIP'] = $value['value'];
        }
        if ($value['unique_name'] == 'shippingfirstname' && $value['value'] != '') {
            $myorder1['SHIPTONAME1'] = $value['value'];
        } else {
            //	$myorder1['SHIPTONAME1']	= '';
        }
        if ($value['unique_name'] == 'shippinglastname' && $value['value'] != '') {
            $myorder1['SHIPTONAME2'] = $value['value'];
        } else {
            //	$myorder1['SHIPTONAME2']	= '';
        }
        if ($value['unique_name'] == 'shippingaddress' && $value['value'] != '') {
            $myorder1['SHIPTOSTREET'] = $value['value'];
        }
        if ($value['unique_name'] == 'shippingcity' && $value['value'] != '') {
            $myorder1['SHIPTOCITY'] = $value['value'];
        }
        //$data['SHIPTOCITY'] = 'CA';
        if ($value['unique_name'] == 'shippingstate' && $value['value'] != '') {
            //	$data['SHIPTOSTATE'] = $value['value'];
            $sql = "SELECT `code` FROM `" . WPSC_TABLE_REGION_TAX . "` WHERE `id` ='" . $value['value'] . "' LIMIT 1";
            $myorder1['SHIPTOSTATE'] = $wpdb->get_var($sql);
        } else {
        }
        if ($value['unique_name'] == 'shippingcountry' && $value['value'] != '') {
            $value['value'] = maybe_unserialize($value['value']);
            if (is_array($value['value'])) {
                if ($value['value'][0] == 'UK') {
                    $myorder1['SHIPTOCOUNTRY'] = 'GB';
                } else {
                    $myorder1['SHIPTOCOUNTRY'] = $value['value'][0];
                }
                if (is_numeric($value['value'][1])) {
                    $sql = "SELECT `code` FROM `" . WPSC_TABLE_REGION_TAX . "` WHERE `id` ='" . $value['value'][1] . "' LIMIT 1";
                    $myorder1['SHIPTOSTATE'] = $wpdb->get_var($sql);
                }
            } else {
                $myorder1['SHIPTOCOUNTRY'] = $value['value'];
            }
        }
        if ($value['unique_name'] == 'shippingpostcode' && $value['value'] != '') {
            $myorder1['SHIPTOZIP'] = $value['value'];
        }
    }
    //Here ends most of the changes implemented into linkpoint
    $store = get_option('linkpoint_store_number');
    $linkpoint = new lphp();
    $myorder["host"] = "secure.linkpt.net";
    $myorder["port"] = "1129";
    $myorder["keyfile"] = WPSC_GOLD_FILE_PATH . "/merchants/linkpointpem/" . $store . ".pem";
    $myorder["configfile"] = $store;
    //	# CREDIT CARD INFO
    //if (get_option('linkpoint_test')=='0') {
    $myorder["ordertype"] = "SALE";
    $myorder["cardnumber"] = $_POST['card_number'];
    /* see note below ( submit_linkpoint() )on using the linkpoint test account this way
    	} else {
    		$myorder["result"] = "GOOD";
    		$myorder["cardnumber"] = "4111-1111-1111-1111";
    		$myorder["cardexpmonth"] = "01";
    		$myorder["cardexpyear"] = "11";
    		$myorder["cvmvalue"] = "111";
    	}
    */
    $myorder["cardexpmonth"] = $_POST['ExpiryMonth'];
    $myorder["cardexpyear"] = $_POST['ExpiryYear'];
    $myorder["cvmvalue"] = $_POST['cvmvalue'];
    //	# BILLING INFO
    $myorder["name"] = $myorder1['FIRSTNAME'] . ' ' . $myorder1['LASTNAME'];
    //	$myorder["billingcompany"]  = $_POST["company"];
    $myorder["address"] = $myorder1['STREET'];
    //	$myorder["address2"] = ' ';//$_POST["address2"];
    $myorder["city"] = $myorder1['CITY'];
    $myorder["state"] = $myorder1['STATE'];
    $myorder["country"] = $myorder1['COUNTRYCODE'];
    $myorder["phone"] = $myorder1['PHONENUM'];
    $myorder["email"] = $myorder1['EMAIL'];
    //	$myorder["addrnum"]  = $_POST["addrnum"];
    $myorder["zip"] = $myorder1['ZIP'];
    //	# SHIPPING INFO
    $myorder["sname"] = $myorder1['SHIPTONAME1'] . ' ' . $myorder1['SHIPTONAME2'];
    $myorder["saddress1"] = $myorder1['SHIPTOSTREET'];
    $myorder["saddress2"] = ' ';
    //$_POST["saddress2"];
    $myorder["scity"] = $myorder1['SHIPTOCITY'];
    $myorder["sstate"] = $myorder1['SHIPTOSTATE'];
    $myorder["szip"] = $myorder1['SHIPTOZIP'];
    $myorder["scountry"] = $myorder1['SHIPTOCOUNTRY'];
    //	# ORDER INFO
    $myorder["chargetotal"] = $purchase_log['totalprice'];
    //	exit('<pre>'.print_r($myorder,true).'</pre>');
    $responce = $linkpoint->curl_process($myorder);
    //	exit('<pre>'.print_r($responce,true).'</pre>');
    if ($responce["r_approved"] != "APPROVED") {
        $message .= "<h3>" . __('Please Check the Payment Results', 'wpsc_gold_cart') . "</h3>";
        $message .= __('Your transaction was not successful.', 'wpsc_gold_cart') . "<br /><br />";
        $errors = wpsc_get_customer_meta('checkout_misc_error_messages');
        if (!is_array($errors)) {
            $errors[] = $message;
        }
        wpsc_update_customer_meta('checkout_misc_error_messages', $errors);
    } else {
        $purchase_log = new WPSC_Purchase_Log($sessionid, 'sessionid');
        $purchase_log->set('processed', WPSC_Purchase_Log::ACCEPTED_PAYMENT);
        $purchase_log->save();
        header("Location: " . $transact_url . $seperator . "sessionid=" . $sessionid);
        exit;
        //transaction_results($sessionid, true);
    }
}
예제 #4
0
 /**
  * Send transaction to gateway
  */
 function _sendRequest($myorder)
 {
     $myorder["host"] = "secure.linkpt.net";
     if (MODULE_PAYMENT_LINKPOINT_API_TRANSACTION_MODE == 'DevelopersTest') {
         $myorder["host"] = "staging.linkpt.net";
     }
     $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;
     // This is your store number
     // set to ECI and UNSPECIFIED for ecommerce transactions:
     $myorder["transactionorigin"] = "ECI";
     $myorder["terminaltype"] = "UNSPECIFIED";
     // debug - for testing communication only
     if (MODULE_PAYMENT_LINKPOINT_API_DEBUG != 'Off') {
     }
     if (MODULE_PAYMENT_LINKPOINT_API_CODE_DEBUG == 'debug') {
         $myorder["debugging"] = "true";
         // for development only - not intended for production use
         $myorder["debug"] = "true";
         // for development only - not intended for production use
         $myorder["webspace"] = "true";
         // for development only - not intended for production use
     }
     include DIR_FS_CATALOG . DIR_WS_MODULES . 'payment/linkpoint_api/class.linkpoint_api.php';
     $mylphp = new lphp();
     // Send transaction, using cURL
     $result = $mylphp->curl_process($myorder);
     // do debug output
     $errorMessage = date('M-d-Y h:i:s') . "\n=================================\n\n" . ($mylphp->commError != '' ? $mylphp->commError . "\n\n" : '') . 'Response Code: ' . $result["r_approved"] . ' ' . $result["r_error"] . "\n\n=================================\n\n" . 'Sending to Gateway: ' . "\n" . $mylphp->sendData . "\n\n" . 'Result: ' . substr(print_r($result, true), 5) . "\n\n";
     if ($mylphp->commError != '') {
         $errorMessage .= $mylphp->commError . "\n" . 'CURL info: ' . print_r($mylphp->commInfo, true) . "\n";
     }
     if (CURL_PROXY_REQUIRED == 'True') {
         $errorMessage .= 'Using CURL Proxy: [' . CURL_PROXY_SERVER_DETAILS . ']  with Proxy Tunnel: ' . ($proxy_tunnel_flag ? 'On' : 'Off') . "\n";
     }
     $failure = !is_array($result) || $result["r_approved"] != "APPROVED" ? true : false;
     // handle logging
     if (strstr(MODULE_PAYMENT_LINKPOINT_API_DEBUG, 'Log')) {
         $this->_log($errorMessage, $myorder["oid"] . ($failure ? '_FAILED' : ''));
         //      $this->_log($errorMessage . print_r($myorder, true) . print_r($mylphp->xmlString, true), $myorder["oid"] . ($failure ? '_FAILED' : ''));
     }
     if (strstr(MODULE_PAYMENT_LINKPOINT_API_DEBUG, 'Email') || $failure && strstr(MODULE_PAYMENT_LINKPOINT_API_DEBUG, 'Alert')) {
         zen_mail(STORE_NAME, STORE_OWNER_EMAIL_ADDRESS, 'Linkpoint Debug Data' . ($failure ? ' - FAILURE' : ''), $errorMessage, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, array('EMAIL_MESSAGE_HTML' => nl2br($errorMessage)), 'debug');
     }
     //DEBUG ONLY:$this->_log($errorMessage /*. print_r($myorder, true) . print_r($mylphp->xmlString, true)*/, $myorder["oid"]);
     if ($myorder['debugging'] == 'true') {
         exit;
     }
     return $result;
 }
예제 #5
0
function espresso_process_firstdata($payment_data)
{
    global $wpdb;
    $attendee_id = $payment_data['attendee_id'];
    $registration_id = espresso_registration_id($attendee_id);
    $sql = "SELECT ea.amount_pd, ed.event_name FROM " . EVENTS_ATTENDEE_TABLE . " ea ";
    $sql .= "JOIN " . EVENTS_DETAIL_TABLE . " ed ";
    $sql .= "ON ed.id = ea.event_id ";
    $sql .= " WHERE registration_id = '" . $registration_id . "' ";
    $sql .= " ORDER BY ea.id ASC LIMIT 1";
    $r = $wpdb->get_row($sql);
    if (!$r || $wpdb->num_rows == 0) {
        exit("Looks like something went wrong.  Please try again or notify the website administrator.");
    }
    $firstdata_settings = get_option('event_espresso_firstdata_settings');
    $pem_file = EVENT_ESPRESSO_PLUGINFULLPATH . "gateways/firstdata/" . $firstdata_settings['firstdata_store_id'] . ".pem";
    if (file_exists(EVENT_ESPRESSO_GATEWAY_DIR . "firstdata/" . $firstdata_settings['firstdata_store_id'] . ".pem")) {
        $pem_file = EVENT_ESPRESSO_GATEWAY_DIR . "firstdata/" . $firstdata_settings['firstdata_store_id'] . ".pem";
    }
    if (empty($firstdata_settings['use_verify_peer'])) {
        $firstdata_settings['use_verify_peer'] = false;
    }
    include "lphp.php";
    $mylphp = new lphp();
    $myorder['verify_peer'] = $firstdata_settings['use_verify_peer'];
    $myorder["debugging"] = $firstdata_settings['use_sandbox'];
    $myorder["host"] = $myorder["debugging"] ? "staging.linkpt.net" : "secure.linkpt.net";
    $myorder["port"] = "1129";
    $myorder["keyfile"] = $pem_file;
    # Change this to the name and location of your certificate file
    $myorder["configfile"] = $firstdata_settings['firstdata_store_id'];
    # Change this to your store number
    $myorder["ordertype"] = "SALE";
    $myorder["result"] = "LIVE";
    # For a test, set result to GOOD, DECLINE, or DUPLICATE
    $myorder["cardnumber"] = $_POST['card_num'];
    $myorder["cardexpmonth"] = $_POST['expmonth'];
    $myorder["cardexpyear"] = $_POST['expyear'];
    $myorder["chargetotal"] = $r->amount_pd;
    $myorder["name"] = $_POST['first_name'] . ' ' . $_POST['last_name'];
    $myorder["address1"] = $_POST['address'];
    $myorder["city"] = $_POST["city"];
    $myorder["state"] = $_POST["state"];
    $myorder["email"] = $_POST["email"];
    /**
     * It looks like firstdata requires addrnum, the beginning
     * number of the address.  On their test forms, they have a specific
     * field for this.  I am just going to grab the address, split it and grab
     * index 0.  Will see how this goes before adding a new field.  If can't split the
     * address, will pass it full.
     */
    $addrnum = $_POST['address'];
    $temp_address = explode(" ", $_POST['address']);
    if (count($temp_address > 0)) {
        $addrnum = $temp_address[0];
    }
    $myorder["addrnum"] = $addrnum;
    $myorder["zip"] = $_POST["zip"];
    $payment_data['txn_type'] = 'FirstData';
    $payment_data['payment_status'] = "Incomplete";
    $payment_data['txn_id'] = 0;
    $payment_data['txn_details'] = serialize($_REQUEST);
    $result = $mylphp->curl_process($myorder);
    # use curl methods
    if ($myorder["debugging"]) {
        echo "<p>var_dump of order data:</p> ";
        var_dump($myorder);
        echo "<br />";
        echo "<p>var_dump of result:</p> ";
        var_dump($result);
        echo '<h3 style="color:#ff0000;" title="Payments will not be processed">' . __('End of Debugging / Sandbox output (this will go away when you switch to live transactions)', 'event_espresso') . '</h3>';
    }
    if (!empty($result)) {
        $payment_data['txn_details'] = serialize($result);
        $payment_data['txn_id'] = $result["r_ordernum"];
        if ($result["r_approved"] != "APPROVED" && $result["r_approved"] != "DECLINED") {
            if ($result['r_approved'] != '<') {
                echo "<br />Status: " . $result['r_approved'];
            }
            if ($result['r_error'] != '<') {
                echo "<br />Error: " . $result['r_error'];
            }
            echo "<br />";
        } elseif ($result["r_approved"] == "DECLINED") {
            $payment_data['payment_status'] = 'Payment Declined';
        } else {
            // success
            $payment_data['payment_status'] = 'Completed';
        }
    }
    add_action('action_hook_espresso_email_after_payment', 'espresso_email_after_payment');
    return $payment_data;
}
 function firstdata_process()
 {
     global $event_details, $cart_totals;
     $event_id = $event_details['ID'];
     $regis_id = $this->erm->get_regis_id();
     $post_ID = $this->erm->get_regis_post_id();
     $this->ecm->setup_event_details($event_id);
     $_totals = $this->erm->calculate_cart_totals(true);
     $gateway_info = $this->erm->get_gateway_info();
     $host = "staging.linkpt.net";
     if ($gateway_info['_epl_sandbox'] == 0) {
         $host = "secure.linkpt.net";
     }
     //$pem_file = get_attached_file( $gateway_info['_epl_pem_file'] );
     $pem_file = epl_upload_dir_path() . "firstdata/{$gateway_info['_epl_user']}.pem";
     $payment_amount = epl_get_element_m('pay_deposit', 'money_totals', $cart_totals) == 1 ? epl_get_element_m('min_deposit', 'money_totals', $cart_totals, $cart_totals['money_totals']['grand_total']) : $cart_totals['money_totals']['grand_total'];
     $this->epl->load_file('libraries/gateways/firstdata/lphp.php');
     $_tolphp = array();
     $lphp = new lphp();
     //$_tolphp["debugging"] = ($gateway_info['_epl_sandbox'] == 10); //set to true to see debug message
     $_tolphp["host"] = $host;
     $_tolphp["port"] = "1129";
     $_tolphp["keyfile"] = $pem_file;
     $_tolphp["configfile"] = $gateway_info['_epl_user'];
     $_tolphp["ordertype"] = "SALE";
     $_tolphp["result"] = "LIVE";
     # LIVE for live, for test set to GOOD, DECLINE, DUPLICATE
     $_tolphp["cardnumber"] = $_POST['_epl_cc_num'];
     $_tolphp["cardexpmonth"] = date('m', strtotime($_POST['_epl_cc_exp_month']));
     $_tolphp["cardexpyear"] = substr($_POST['_epl_cc_exp_year'], 0 - 2);
     $_tolphp["chargetotal"] = epl_get_balance_due();
     $_tolphp["name"] = $_POST['_epl_cc_first_name'] . ' ' . $_POST['_epl_cc_last_name'];
     $_tolphp["address1"] = $_POST['_epl_cc_address'];
     $_tolphp["city"] = $_POST["_epl_cc_city"];
     $_tolphp["state"] = $_POST["_epl_cc_state"];
     $_tolphp["zip"] = $_POST["_epl_cc_zip"];
     $_tolphp["phone"] = epl_get_element('_epl_cc_phone', $_POST, '');
     $_tolphp["email"] = epl_get_element('_epl_cc_email', $_POST, '');
     $addrnum = $_POST['_epl_cc_address'];
     $temp_address = explode(" ", $_POST['_epl_cc_address']);
     if (count($temp_address) > 0) {
         $addrnum = $temp_address[0];
     }
     $_tolphp["addrnum"] = $addrnum;
     $result = $lphp->curl_process($_tolphp);
     if (is_array($result) && $result['r_approved'] == 'APPROVED') {
         // Payment successful
         $data['post_ID'] = $post_ID;
         $data['_epl_grand_total'] = $cart_totals['money_totals']['grand_total'];
         $data['_epl_payment_amount'] = $cart_totals['money_totals']['grand_total'];
         $data['_epl_payment_date'] = current_time('mysql');
         $data['_epl_payment_method'] = $this->erm->get_payment_profile_id();
         $data['_epl_transaction_id'] = $result['r_ref'];
         $data['_epl_prediscount_total'] = epl_get_element('pre_discount_total', $cart_totals['money_totals'], 0);
         $data['_epl_discount_amount'] = epl_get_element('discount_amount', $cart_totals['money_totals'], 0);
         $data = apply_filters('epl_firstdata_response_data', $data, $result);
         $this->erm->update_payment_data($data);
         return true;
     } else {
         return '<div class="epl_error">ERROR: ' . $result['r_error'] . '</div>';
     }
 }
예제 #7
0
	$myorder["items"][item1]["description"] = $_POST["description"];
	$myorder["items"][item1]["quantity"]    = $_POST["quantity"];
	$myorder["items"][item1]["price"]       = $_POST["price"];

	$myorder["items"][item1]["option1"]["name"]  = $_POST["name1"];
	$myorder["items"][item1]["option1"]["value"] = $_POST["value1"];
	$myorder["items"][item1]["option2"]["name"]  = $_POST["name2"];
	$myorder["items"][item1]["option2"]["value"] = $_POST["value2"];

	if ($_POST["debugging"])
		$myorder["debugging"]="true";


#   Send transaction. Use one of two possible methods 
//	$result = $mylphp->process($myorder);       # use shared library model
	$result = $mylphp->curl_process($myorder);  # use curl methods


	if ($result["r_approved"] != "APPROVED")    // transaction failed, print the reason
	{
		print "Status:  $result[r_approved]<br>\n";
		print "Error:  $result[r_error]<br><br>\n";
	}
	else	// success
	{		
		print "Status: $result[r_approved]<br>\n";
		print "Transaction Code: $result[r_code]<br><br>\n";
	}

# if verbose output has been checked,
# print complete server response to a table
예제 #8
0
 function onTP_Processpayment($data)
 {
     if (JVERSION >= '1.6.0') {
         include JPATH_SITE . '/plugins/payment/linkpoint/linkpoint/lib/lphp.php';
     } else {
         include JPATH_SITE . '/plugins/payment/linkpoint/lib/lphp.php';
     }
     if (JVERSION >= '1.6.0') {
         $pemfilepath = JPATH_SITE . '/plugins/payment/linkpoint/linkpoint/staging_cert.pem';
     } else {
         $pemfilepath = JPATH_SITE . '/plugins/payment/linkpoint/staging_cert.pem';
     }
     $plgPaymentLinkpointHelper = new plgPaymentLinkpointHelper();
     $host = $plgPaymentLinkpointHelper->buildLinkpointUrl();
     $orderid = $data['oid'];
     $mylphp = new lphp();
     $order["host"] = $host;
     $order["port"] = $this->port;
     $order["keyfile"] = $pemfilepath;
     $order["configfile"] = $this->store_id;
     $order["ordertype"] = "SALE";
     $testmode = $this->params->get('testmode', '1');
     if ($testmode == 1) {
         $order["result"] = "GOOD";
         # For test transactions, set to GOOD, DECLINE, or DUPLICATE
     } else {
         $order["result"] = "LIVE";
     }
     $order["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
     $order["oid"] = $data['oid'];
     # Order ID number must be unique. If not set, gateway will assign one.
     // Transaction Details
     $order["chargetotal"] = $data['chargetotal'];
     //Card Info
     $order["cardnumber"] = $data['creditcard_number'];
     $order["cardexpmonth"] = str_pad($data['expire_month'], 2, "0", STR_PAD_LEFT);
     $order["cardexpyear"] = substr($data['expire_year'], 2);
     $order["cvmvalue"] = $data['creditcard_code'];
     $order["debug"] = "true";
     # for development only - not intended for production use
     $raw_data = $mylphp->curl_process($order);
     # use curl methods
     $status = $this->translateResponse($raw_data['r_approved']);
     //Error Handling
     $error = array();
     $error['code'] = $raw_data['r_code'];
     $error['desc'] = $raw_data['r_message '];
     $result = array('transaction_id' => md5($data['oid']), 'order_id' => $data['oid'], 'status' => $status, 'total_paid_amt' => $data["chargetotal"], 'raw_data' => $raw_data, 'error' => $error, 'return' => $data['return']);
     return $result;
 }
예제 #9
0
 function process_payment($order_number, $order_total, &$d)
 {
     global $vmLogger;
     // We must include the yourpay/linkpoint api file.
     require CLASSPATH . "payment/lphp.php";
     // Declare new linkpoint php class
     $mylphp = new lphp();
     global $vendor_mail, $vendor_currency, $VM_LANG, $database;
     $ps_vendor_id = $_SESSION["ps_vendor_id"];
     $auth = $_SESSION['auth'];
     $ps_checkout = new ps_checkout();
     require_once CLASSPATH . "payment/" . $this->classname . ".cfg.php";
     // Get user billing information
     $dbbt = new ps_DB();
     $qt = "SELECT * FROM `#__{vm}_user_info` WHERE user_id='" . $auth["user_id"] . "' AND address_type='BT'";
     $dbbt->query($qt);
     $dbbt->next_record();
     $user_info_id = $dbbt->f("user_info_id");
     if ($user_info_id != $d["ship_to_info_id"]) {
         // Get user billing information
         $dbst = new ps_DB();
         $qt = "SELECT * FROM #__{vm}_user_info WHERE user_info_id='" . $d["ship_to_info_id"] . "' AND address_type='ST'";
         $dbst->query($qt);
         $dbst->next_record();
     } else {
         $dbst = $dbbt;
     }
     // Start gathering the information needed for the XML transaction
     $cuname = substr($dbbt->f("first_name"), 0, 25) . " " . substr($dbbt->f("last_name"), 0, 25);
     // The following should be static for linkpoint, if not, change to the specified host (secure/staging.linkpt.net)
     $myorder["host"] = "secure.linkpt.net";
     $myorder["port"] = "1129";
     $myorder["keyfile"] = LP_KEYFILE;
     $myorder["configfile"] = LP_LOGIN;
     //Atlanticom Mod - Adding substitution for ampersand sign to correct
     //XML rejection of linkpoint transactions including same (usually in company name).
     $myorder["name"] = str_replace("&", "", $cuname);
     $myorder["company"] = str_replace("&", "", substr($dbbt->f("company"), 0, 50));
     $myorder["address1"] = str_replace("&", "", substr($dbbt->f("address_1"), 0, 60));
     $myorder["address2"] = str_replace("&", "", substr($dbbt->f("address_2"), 0, 60));
     $myorder["city"] = str_replace("&", "", substr($dbbt->f("city"), 0, 40));
     $myorder["state"] = str_replace("&", "", substr($dbbt->f("state"), 0, 40));
     $myorder["zip"] = str_replace("&", "", substr($dbbt->f("zip"), 0, 20));
     $myorder["country"] = str_replace("&", "", substr($dbbt->f("country"), 0, 60));
     $myorder["phone"] = str_replace("&", "", substr($dbbt->f("phone_1"), 0, 25));
     $myorder["fax"] = str_replace("&", "", substr($dbbt->f("fax"), 0, 25));
     $myorder["email"] = str_replace("&", "", $dbbt->f("email"));
     //End Atlanticom Mod
     $myorder["cardnumber"] = $_SESSION['ccdata']['order_payment_number'];
     $myorder["cardexpmonth"] = $_SESSION['ccdata']['order_payment_expire_month'];
     $myorder["cardexpyear"] = substr($_SESSION['ccdata']['order_payment_expire_year'], 2, 2);
     $myorder["cvmindicator"] = "provided";
     $myorder["cvmvalue"] = $_SESSION['ccdata']['credit_card_code'];
     $myorder["chargetotal"] = $order_total;
     //Atlanticom Mod: Let's anticipate the next order_id (an auto increment field) that will be used for this
     //payment if it is successful, and what the heck... let's append the word WEB to it.
     // Get last attempt
     $dbLP = new ps_DB();
     $qt = "SELECT * FROM #__{vm}_linkpoint WHERE Id=1";
     $dbLP->query($qt);
     $dbLP->next_record();
     $LP_LastAttempt = $dbLP->f("LastAttempt");
     $LP_LastAttemptParts = explode("-", $LP_LastAttempt);
     if ($LP_LastAttemptParts[2] == "") {
         $LP_next_suffix = "a";
     } else {
         $this_char = ord($LP_LastAttemptParts[2]);
         $LP_next_suffix = chr($this_char + 1);
     }
     $dbord = new ps_DB();
     $qord = "SELECT MAX(order_id)+1 As expected_order_id FROM #__{vm}_orders";
     $dbord->query($qord);
     $dbord->next_record();
     $expected_order_id = $dbord->f("expected_order_id");
     //has this order # already been attempted and failed?
     if ($LP_LastAttemptParts[1] == $expected_order_id) {
         //we need to increment the attempt.
         $this_order_id = "WEB-" . $expected_order_id . "-" . $LP_next_suffix;
     } else {
         //it's a new order number
         $this_order_id = "WEB-" . $expected_order_id;
     }
     $myorder["oid"] = $this_order_id;
     //save this attempt to the database
     $q = "UPDATE #__{vm}_linkpoint SET LastAttempt = '" . $this_order_id . "' WHERE Id=1";
     $dbLP->query($q);
     //old code
     // Working on a fix for this orderid, this process seems to send "Duplicate transaction"
     // if the user made a typo the first time they entered their card number.  All in all, it works
     // but their could ba a change.
     // $myorder["oid"] = $order_number; // need to clean this up, no offence Soeren, but those order numbers are a mess.
     //end old code
     //END MOD
     // Debugging - Let me see the output.
     //$myorder["debugging"]="true";
     // debugging (can move this block around to force result)
     //			$vmLogger->err( "Credit Card Processing Under Test" );
     //			$d["order_payment_log"] = "Credit Card Processing Under Test";
     //			$d["order_payment_log"] .= "Please Call In Your Order";
     //			$d["order_payment_trans_id"] = "test1";
     //			return False;
     if (LP_RECURRING == "YES") {
         //if we are doing recurring billing, and the payments are not processed imedeately, we should run a Pre-Auth
         // This is mostly if you are offering a customer x ammount of free days for a service, if you are charging the card
         // at this time, you can uncomment the following 2 lines Pre-Auth part .
         if (LP_PREAUTH == "YES") {
             $myorder["ordertype"] = "PREAUTH";
             // Process the PREAUTH
             $result = $mylphp->curl_process($myorder);
             if ($result["r_approved"] != "APPROVED") {
                 // transaction failed, print the reason
                 $vmLogger->err($result["r_error"]);
                 $d["order_payment_log"] = $result["r_error"];
                 $d["order_payment_log"] .= $result["r_message"];
                 $d["order_payment_trans_id"] = $result["r_ordernum"];
                 return False;
             }
         }
         $myorder["action"] = "SUBMIT";
         $myorder["installments"] = -1;
         $myorder["periodicity"] = monthly;
         // We will give them 30 days free.
         $myorder["startdate"] = date(Ymd, time() + 2592000);
         $myorder["threshold"] = 3;
         $myorder["ordertype"] = "SALE";
         // If everything worked out fine, then process the order here and leave the class.  Saved by the Bell
         $result = $mylphp->curl_process($myorder);
         if ($result["r_approved"] != "APPROVED") {
             $vmLogger->err($result["r_error"]);
             $d["order_payment_log"] = $result["r_error"];
             $d["order_payment_log"] .= $result["r_message"];
             $d["order_payment_trans_id"] = $result["r_ordernum"];
             return False;
         } else {
             $d["order_payment_log"] = $VM_LANG->_('PHPSHOP_PAYMENT_TRANSACTION_SUCCESS') . ": ";
             $d["order_payment_log"] = $result["r_approved"];
             // Catch Transaction ID
             $d["order_payment_trans_id"] = $result["r_ordernum"];
             return True;
         }
     } else {
         // Not recurring, just plain old sale.
         $myorder["ordertype"] = "SALE";
         // If everything worked out fine, then process the order.
         $result = $mylphp->curl_process($myorder);
         if ($result["r_approved"] != "APPROVED") {
             $vmLogger->err($result["r_error"] . "\n" . $result["r_message"]);
             $d["order_payment_log"] = $result["r_error"];
             $d["order_payment_log"] .= $result["r_message"];
             $d["order_payment_trans_id"] = $result["r_ordernum"];
             return False;
         } else {
             $d["order_payment_log"] = $VM_LANG->_('PHPSHOP_PAYMENT_TRANSACTION_SUCCESS') . ": ";
             $d["order_payment_log"] = $result["r_approved"];
             // Catch Transaction ID
             $d["order_payment_trans_id"] = $result["r_ordernum"];
             return True;
         }
     }
     //close recurring or normal
 }
예제 #10
0
 function onTP_Processpayment($data, $vars = array())
 {
     $isValid = true;
     $error = array();
     $error['code'] = '';
     $error['desc'] = '';
     include dirname(__FILE__) . '/linkpoint/lib/lphp.php';
     $pemfilepath = dirname(__FILE__) . '/linkpoint/staging_cert.pem';
     $plgPaymentLinkpointHelper = new plgPaymentLinkpointHelper();
     $host = $plgPaymentLinkpointHelper->buildLinkpointUrl();
     $orderid = $data['oid'];
     $mylphp = new lphp();
     $order["host"] = $host;
     $order["port"] = $this->port;
     $order["keyfile"] = $pemfilepath;
     $order["configfile"] = $this->store_id;
     $order["ordertype"] = "SALE";
     $testmode = $this->params->get('testmode', '1');
     if ($testmode == 1) {
         $order["result"] = "GOOD";
         # For test transactions, set to GOOD, DECLINE, or DUPLICATE
     } else {
         $order["result"] = "LIVE";
     }
     $order["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
     $order["oid"] = $data['oid'];
     # Order ID number must be unique. If not set, gateway will assign one.
     // Transaction Details
     $order["chargetotal"] = $data['chargetotal'];
     //Card Info
     $order["cardnumber"] = $data['creditcard_number'];
     $order["cardexpmonth"] = str_pad($data['expire_month'], 2, "0", STR_PAD_LEFT);
     $order["cardexpyear"] = substr($data['expire_year'], 2);
     $order["cvmvalue"] = $data['creditcard_code'];
     $order["debug"] = "true";
     # for development only - not intended for production use
     $raw_data = $mylphp->curl_process($order);
     # use curl methods
     //3.compare response order id and send order id in notify URL
     $res_orderid = '';
     $res_orderid = $data['oid'];
     if ($isValid) {
         if (!empty($vars) && $res_orderid != $vars->order_id) {
             $isValid = false;
             $error['desc'] = "ORDER_MISMATCH" . "Invalid ORDERID; notify order_is " . $vars->order_id . ", and response " . $res_orderid;
         }
     }
     // amount check
     if ($isValid) {
         if (!empty($vars)) {
             // Check that the amount is correct
             $order_amount = (double) $vars->amount;
             $retrunamount = (double) $data["chargetotal"];
             $epsilon = 0.01;
             if ($order_amount - $retrunamount > $epsilon) {
                 $raw_data['r_approved'] = 'ERROR';
                 // change response status to ERROR FOR AMOUNT ONLY
                 $isValid = false;
                 $error['desc'] .= "ORDER_AMOUNT_MISTMATCH - order amount= " . $order_amount . ' response order amount = ' . $retrunamount;
             }
         }
     }
     // translet response
     $status = $this->translateResponse($raw_data['r_approved']);
     //Error Handling
     $error = array();
     $error['code'] .= $raw_data['r_code'];
     $error['desc'] .= $raw_data['r_message '];
     $result = array('transaction_id' => md5($data['oid']), 'order_id' => $data['oid'], 'status' => $status, 'total_paid_amt' => $data["chargetotal"], 'raw_data' => $raw_data, 'error' => $error, 'return' => $data['return']);
     return $result;
 }
예제 #11
0
 function ipn(&$BL)
 {
     if ($_POST['pp'] == "linkpointapi") {
         $this->item_number = $_POST['item_number'];
         $this->transaction_id = 0;
         $this->payment_status = '';
         $mylphp = new lphp();
         $pp_vals = $BL->pp_vals->getByKey("linkpointapi");
         $temp = $BL->orphan_orders->hasAnyOne(array("WHERE `item_number`=" . intval($this->item_number)));
         $O_order = array();
         foreach ($BL->orphan_order_datas->find(array("WHERE `orphan_order_id`=" . intval($temp['orphanorder_id']))) as $data) {
             $O_order[$data['orphan_order_field']] = $data['orphan_order_value'];
         }
         if (count($O_order)) {
             $amount = number_format($O_order['gross_amount'], 2);
             # CARD INFO
             $myorder["cardnumber"] = $_POST['cardnumber'];
             $myorder["cardexpmonth"] = $_POST['cardexpmonth'];
             $myorder["cardexpyear"] = $_POST['cardexpyear'];
             $myorder["cvmindicator"] = "provided";
             $myorder["cvmvalue"] = $_POST['cvmvalue'];
         } else {
             $invoice = $BL->invoices->get("WHERE `invoice_no`=" . intval($this->item_number));
             $amount = number_format($invoice[0]['gross_amount'], 2);
             # CARD INFO
             $myorder["cardnumber"] = $_POST['lpapi_cardnumber'];
             $myorder["cardexpmonth"] = $_POST['lpapi_cardexpmonth'];
             $myorder["cardexpyear"] = $_POST['lpapi_cardexpyear'];
             $myorder["cvmindicator"] = "provided";
             $myorder["cvmvalue"] = $_POST['lpapi_cvmvalue'];
         }
         # BILLING INFO
         $myorder["name"] = $_POST["name"];
         $myorder["company"] = isset($_POST["company"]) ? $_POST["company"] : $_POST["name"];
         $myorder["address1"] = $_POST["address"];
         $myorder["city"] = $_POST["city"];
         $myorder["state"] = $_POST["state"];
         $myorder["country"] = $_POST["country"];
         $myorder["phone"] = isset($_POST["phone"]) ? $_POST["phone"] : $_POST["telephone"];
         $myorder["fax"] = isset($_POST["fax"]) ? $_POST["fax"] : $_POST["telephone"];
         $myorder["email"] = $_POST["email"];
         $myorder["zip"] = $_POST["zip"];
         $myorder["host"] = "secure.linkpt.net";
         $myorder["port"] = "1129";
         $myorder["keyfile"] = $pp_vals['lpapi_pemfile'];
         $myorder["configfile"] = $pp_vals['lpapi_storenumber'];
         $myorder["ordertype"] = "SALE";
         $myorder["result"] = "LIVE";
         # For test transactions, set to GOOD, DECLINE, or DUPLICATE
         $myorder["transactionorigin"] = "MOTO";
         # 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"] = $this->item_number;
         # Order ID number must be unique. If not set, gateway will assign one.
         $myorder["chargetotal"] = $amount;
         # ITEMS AND OPTIONS
         $myorder["items"]["item1"]["id"] = $this->item_number;
         $myorder["items"]["item1"]["description"] = $_POST['item_name'];
         $myorder["items"]["item1"]["quantity"] = "1";
         $myorder["items"]["item1"]["price"] = $amount;
         $myorder["debugging"] = "false";
         # for development only - not intended for production use
         if ($this->demo_mode) {
             $myorder["debugging"] = "true";
         }
         # Send transaction. Use one of two possible methods  #
         $result = $mylphp->curl_process($myorder);
         # use curl methods
         $this->payment_status = $result["r_approved"];
         $this->transaction_id = $result["r_code"];
         if (!empty($this->item_number) && !empty($this->transaction_id) && $this->payment_status == "APPROVED") {
             $BL->invoices->processTransaction($this->item_number, $this->transaction_id);
             return true;
         }
     }
     return false;
 }
예제 #12
0
 public function run(Am_Paysystem_Result $result)
 {
     require_once dirname(__FILE__) . "/lphp.php";
     $mylphp = new lphp();
     $myorder["host"] = $this->getPlugin()->getConfig('testing') ? "staging.linkpt.net" : "secure.linkpt.net";
     $myorder["port"] = "1129";
     $myorder["keyfile"] = dirname(APPLICATION_CONFIG) . '/' . $this->getPlugin()->getConfig('keyfile');
     $myorder["configfile"] = $this->getPlugin()->getConfig('id');
     $myorder["ordertype"] = "SALE";
     $myorder["result"] = $this->getPlugin()->getConfig('testing') ? "GOOD" : "LIVE";
     # For a test, set result to GOOD, DECLINE, or DUPLICATE
     $myorder["cardnumber"] = $this->cc->cc_number;
     $myorder["cardexpmonth"] = $this->cc->getExpire('%1$02d');
     $myorder["cardexpyear"] = $this->cc->getExpire('%2$02d');
     $myorder["chargetotal"] = $this->doFirst ? $this->invoice->first_total : $this->invoice->second_total;
     $myorder["addrnum"] = preg_replace('/^D/', '', $this->cc->cc_street);
     $myorder["zip"] = $this->cc->cc_zip;
     if ($this->cc->getCvv()) {
         $myorder["cvmindicator"] = "provided";
         $myorder["cvmvalue"] = $this->cc->getCvv();
     }
     //if ($this->getPlugin()->getConfig('testing'))
     //    $myorder["debugging"] = "true";  # for development only - not intended for production use
     // uncomment it to get debug info to screen!
     $log = $this->getInvoiceLog();
     $log->add($mylphp->buildXML($myorder));
     $this->ret = $mylphp->curl_process($myorder);
     $log->add(print_r($this->ret, true));
     if ($this->ret['r_approved'] == 'APPROVED') {
         $result->setSuccess($this);
         $this->processValidated();
     } else {
         $result->setFailed(___("Payment failed") . ":" . $this->ret['r_error']);
     }
 }
예제 #13
0
 function before_process()
 {
     global $_POST, $_SERVER, $order, $cart, $db, $lp_response_array, $lp_order_id;
     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 . '.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"]         = $order->info['tax'];
     //	$myorder["shipping"]    = $order->info['shipping_cost'];
     $grantotal = number_format($order->info['total'], 2);
     $myorder["chargetotal"] = str_replace(",", "", $grantotal);
     // 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"] = $order->billing['firstname'] . ' ' . $order->billing['lastname'];
     $myorder["company"] = $this->filterLinkPoint($order->billing['company']);
     $myorder["address1"] = $order->billing['street_address'];
     $myorder["address2"] = $order->billing['suburb'];
     $myorder["city"] = $order->billing['city'];
     $myorder["state"] = $_POST['bstate'];
     $myorder["country"] = $order->billing['country']['iso_code_2'];
     $myorder["phone"] = $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"] = $order->billing['street_address'];
     // Required for AVS. If not provided, transactions will downgrade.
     $myorder["zip"] = $order->billing['postcode'];
     // Required for AVS. If not provided, transactions will downgrade.
     // SHIPPING INFO
     $myorder["sname"] = $order->delivery['firstname'] . ' ' . $order->delivery['lastname'];
     $myorder["saddress1"] = $order->delivery['street_address'];
     $myorder["saddress2"] = $order->delivery['suburb'];
     $myorder["scity"] = $order->delivery['city'];
     $myorder["sstate"] = $_POST['sstate'];
     $myorder["szip"] = $order->delivery['postcode'];
     $myorder["scountry"] = $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;
     $myorder["ordertype"] = "PREAUTH";
     //make sure this is a preauth
     //BEGIN MAIL OUTBOUND DATA change for 1.2a
     $debugoutputorder = $myorder;
     $debugoutputorder["cardnumber"] = "REMOVED";
     $debugoutputorder["cvmvalue"] = "REMOVED";
     $debugoutputorder["cardexpmonth"] = "REMOVED";
     $debugoutputorder["cardexpyear"] = "REMOVED";
     $myoutput = '';
     while (list($key, $value) = each($debugoutputorder)) {
         $myoutput .= "{$key} = {$value}\n";
     }
     $myoutput .= "\n\nItems\n--------\n\n";
     for ($i = 0, $n = sizeof($debugoutputorder["items"]); $i < $n; $i++) {
         while (list($key, $value) = each($debugoutputorder["items"][$i])) {
             $myoutput .= "{$key} = {$value}\n";
         }
         $myoutput .= "\n";
     }
     mail(STORE_OWNER_EMAIL_ADDRESS, "CC DEBUG OUTBOUND " . date('r'), $myoutput);
     //END MAIL OUTBOUND DATA
     // Send PREAUTH transaction.
     $result = $mylphp->curl_process($myorder);
     // use curl methods
     $myresult = '';
     while (list($key, $value) = each($result)) {
         $myresult .= "{$key} = {$value}\n";
     }
     mail(STORE_OWNER_EMAIL_ADDRESS, "CC DEBUG INBOUND " . date('r'), $myresult);
     //perform verification work
     if ($result["r_avs"][0] == "N" || $result["r_avs"][1] == "N" || $result["r_avs"][3] == "N" || $result["r_approved"] == "DECLINED") {
         $myerrdisplay = '';
         if ($result["r_approved"] == "DECLINED") {
             $newerr = split(":", $result["r_error"]);
             //what happened w/ Address
             if ($newerr[3][0] == "N") {
                 $myerrdisplay .= 'Address did not match. ';
             } else {
                 $myerrdisplay .= 'Address verified. ';
             }
             //what happened w/ Zip
             if ($newerr[3][1] == "N") {
                 $myerrdisplay .= 'Zip did not match. ';
             } else {
                 $myerrdisplay .= 'Zip verified. ';
             }
             //what happened w/ CVV
             if ($newerr[3][3] == "N") {
                 $myerrdisplay .= 'CVV or Expiration did not match. ';
             } else {
                 $myerrdisplay .= 'CVV and Expiration verified. ';
             }
         } else {
             //what happened w/ Address
             if ($result["r_avs"][0] == "N") {
                 $myerrdisplay .= 'Address did not match. ';
             } else {
                 $myerrdisplay .= 'Address verified. ';
             }
             //what happened w/ Zip
             if ($result["r_avs"][1] == "N") {
                 $myerrdisplay .= 'Zip did not match. ';
             } else {
                 $myerrdisplay .= 'Zip verified. ';
             }
             //what happened w/ CVV
             if ($result["r_avs"][3] == "N") {
                 $myerrdisplay .= 'CVV or Expiration did not match. ';
             } else {
                 $myerrdisplay .= 'CVV and Expiration verified. ';
             }
         }
         tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=PREAUTHORIZATION FAILED - ' . urlencode($myerrdisplay . ' Please contact us by phone to process this order.'), 'SSL', true, false));
     }
     //if OK do this stuff
     $realorder["ordertype"] = "POSTAUTH";
     //CHANGE FOR 1.2a
     $realorder["oid"] = $result["r_ordernum"];
     //CHANGE FOR 1.2a
     // Send the SALE transaction.
     $result = $mylphp->curl_process($realorder);
     // use curl methods
     // - 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
 }