예제 #1
1
 function bill_checkout($amount, $invoice, $currency_iso, $acct_fields, $total_recurring = false, $recurr_bill_arr = false)
 {
     # Validate currency
     if (!$this->validate_currency($currency_iso)) {
         return false;
     }
     $ret = false;
     if (!$this->validate_card_details($ret)) {
         return false;
     }
     # Linkpoint Class
     include_once PATH_PLUGINS . 'checkout/CLASS_LINKPOINT/lphp.php';
     $mylphp = new lphp();
     $myorder["host"] = "secure.linkpt.net";
     $myorder["port"] = "1129";
     $myorder["keyfile"] = PATH_PLUGINS . 'checkout/CLASS_LINKPOINT/' . $this->cfg["cert"];
     $myorder["configfile"] = $this->cfg["account"];
     $myorder["ordertype"] = "SALE";
     $myorder["cardnumber"] = $this->billing["cc_no"];
     $myorder["cardexpmonth"] = $this->billing["exp_month"];
     $myorder["cardexpyear"] = $this->billing["exp_year"];
     $myorder["cvmindicator"] = "provided";
     $myorder["cvmvalue"] = $this->billing["ccv"];
     $myorder["addrnum"] = $this->account["address1"];
     $myorder["zip"] = $this->account["zip"];
     $myorder["chargetotal"] = $amount;
     $myorder["name"] = $this->account['first_name'] . ' ' . $this->account['last_name'];
     $myorder["company"] = $this->account['company'];
     $myorder["address1"] = $this->account['address1'];
     $myorder["address2"] = $this->account['address2'];
     $myorder["city"] = $this->account['city'];
     $myorder["state"] = $this->account['state'];
     $myorder["email"] = $acct_fields['email'];
     $myorderp["ip"] = USER_IP;
     $myorder["comments"] = "Invoice {$invoice}";
     #if($this->cfg['mode'] 	== "1")
     #$myorder["result"]   	= "GOOD"; 	# For a test, set result to GOOD, DECLINE, or DUPLICATE
     #if($this->cfg['mode'] 	== "1")
     #$myorder["debugging"]	= true;
     #$myorder["cbin"]		= false; // use binary curl?
     # 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") {
         $ret['status'] = 0;
         $ret['msg'] = 'The information provided is invalid or has declined';
     } else {
         $ret['status'] = 1;
         $ret['avs'] = $result['r_code'];
         $ret['transaction_id'] = $result['r_ordernum'];
     }
     if ($ret['status'] == 1) {
         return $ret;
     } else {
         global $VAR;
         @($VAR['msg'] = $ret["msg"]);
         return false;
     }
 }
예제 #2
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);
}
예제 #3
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;
 }
예제 #4
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);
    }
}
예제 #5
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;
 }
예제 #6
0
            $string .= $val;
        }
        return $string;
    } else {
        return false;
    }
}
?>
<div id="status_change">
    <div class="modal-form">
        <?php 
//--------------------pre authentication ---------------------//
require_once "../secure/firstdata/lphp.php";
require_once '/var/www/tmconfig/dev/linkpoint_settings.php';
//linkpoint config file...
$mylphp = new lphp();
$check_home_billing = $_POST['hidden_check'];
$orderId = getNextLogId();
$myorder["oid"] = $orderId[0];
$myorder["ordertype"] = "preauth";
$myorder["result"] = "live";
# form data card info
$myorder["cardnumber"] = $_POST["cardnumber"];
$myorder["cardexpmonth"] = $_POST["cardexpmonth"];
$myorder["cardexpyear"] = $_POST["cardexpyear"];
$myorder["chargetotal"] = $_POST["chargetotal"];
$myorder["cvmvalue"] = $_POST["cvmvalue"];
# BILLING INFO
if (isset($_SESSION['consumer']['itconsumername'])) {
    $myorder["name"] = $_SESSION['consumer']['itconsumername'];
} else {
예제 #7
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>';
     }
 }
예제 #9
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']);
     }
 }
예제 #10
0
		Depending on your server setup, this script may need to
		be placed in the cgi-bin directory, and the path in the
		calling file PHP_FORM_MAX.html may need to be adjusted
		accordingly.

		NOTE: older versions of PHP and in cases where the PHP.INI
		entry is NOT "register_globals = Off", form data can be
		accessed simply by using the form-field name as a varaible
		name, eg. $myorder["host"] = $host, instead of using the 
		global $_POST[] array as we do here. Passing form fields 
		as demonstrated here provides a higher level of security.

------------------------------------------------------------------------------------>
*/
	include"lphp.php";
	$mylphp=new lphp;

	# constants
	$myorder["host"]       = "secure.linkpt.net";
	$myorder["port"]       = "1129";
	$myorder["keyfile"]    = "./YOURCERT.pem"; # Change this to the name and location of your certificate file 
	$myorder["configfile"] = "1234567";        # Change this to your store number 

	# transaction details
	$myorder["ordertype"]         = $_POST["ordertype"];
	$myorder["result"]            = $_POST["result"];
	$myorder["transactionorigin"] = $_POST["transactionorigin"];
	$myorder["oid"]               = $_POST["oid"];
	$myorder["ponumber"]          = $_POST["ponumber"];
	$myorder["taxexempt"]         = $_POST["taxexempt"];
	$myorder["terminaltype"]      = $_POST["terminaltype"];
예제 #11
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
 }
예제 #12
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;
 }
예제 #13
0
   Note: if you are using the shared object LIBLPHP.SO and are getting
   PHP warings "Function registration failed..." while processing batches,
   you can add this entry to your php.ini file: 
			extension=liblphp.so
   and then comment out the lines to load the library at LIBLPHP.PHP 
   module at about line # 57.

# Copyright 2003 LinkPoint International, Inc. All Rights Reserved.
#
# This software is the proprietary information of LinkPoint International, Inc.  
# Use is subject to license terms.

\***********************************************************************/
include "lphp.php";
$mylphp = new lphp();
$myorder["host"] = "secure.linkpt.net";
$myorder["port"] = "1129";
$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["result"] = "good";
# For a test, set result to GOOD, DECLINE, or DUPLICATE
//	$myorder["debugging"] = "true";
# build array of individual orders
$order0 = array('chargetotal' => '1.11', 'cardnumber' => '4111-1111-1111-1111', 'cardexpmonth' => '01', 'cardexpyear' => '04', 'addrnum' => '123', 'zip' => '12345');
$myorder["orders"][0] = $order0;
# put array into hash
$order1 = array('chargetotal' => '2.22', 'cardnumber' => '4111-1111-1111-1111', 'cardexpmonth' => '01', 'cardexpyear' => '02', 'addrnum' => '123', 'zip' => '23456');
예제 #14
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;
 }
예제 #15
0
<?php

/**********************************************************************\

	PREAUTH.php - Minimum Required Fields for a PreAuth

	Copyright 2003 LinkPoint International, Inc. All Rights Reserved.

	This software is the proprietary information of LinkPoint International, Inc.  
	Use is subject to license terms.

\***********************************************************************/
include "lphp.php";
$mylphp = new lphp();
$myorder["host"] = "secure.linkpt.net";
$myorder["port"] = "1129";
$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
예제 #16
0
 /**
  *
  * @param string $action
  * @param number $money
  * @param array  $parameters
  *
  * @return Merchant_Billing_Response
  */
 private function commit($action, $money, $parameters = array())
 {
     $url = $this->is_test() ? self::TEST_URL : self::LIVE_URL;
     if ($action != 'VOID') {
         $parameters['chargetotal'] = $money;
     }
     /* Request a test response */
     $parameters['result'] = $this->is_test() ? 'GOOD' : 'LIVE';
     $mylphp = new lphp();
     $post_data = $this->post_data($action, $parameters);
     $post_data = $mylphp->buildXML($post_data);
     $response = $this->parse($this->ssl_post($url, $post_data, array('pem' => $this->options['pem'])));
     $test_mode = $this->is_test();
     return new Merchant_Billing_Response($this->success_from($response), $this->message_from($response), get_object_vars($response), array('test' => $test_mode, 'avs_result' => $this->avs_result_from($response), 'cvv_result' => $response->r_avs));
 }
예제 #17
0
 /**
  * This function sends request and receives response from
  * the processor
  */
 public function doDirectPayment(&$params)
 {
     if ($params['is_recur'] == TRUE) {
         CRM_Core_Error::fatal(ts('%1 - recurring payments not implemented', array(1 => $paymentProcessor)));
     }
     if (!defined('CURLOPT_SSLCERT')) {
         CRM_Core_Error::fatal(ts('%1 - Gateway requires curl with SSL support', array(1 => $paymentProcessor)));
     }
     /**********************************************************
      * Create the array of variables to be sent to the processor from the $params array
      * passed into this function
      **********************************************************/
     $requestFields = self::mapProcessorFieldstoParams($params);
     /**********************************************************
      * create FirstData request object
      **********************************************************/
     require_once 'FirstData/lphp.php';
     //  $mylphp=new lphp;
     /**********************************************************
      * define variables for connecting with the gateway
      **********************************************************/
     # Name and location of certificate file
     $key = $this->_paymentProcessor['password'];
     # Your store number
     $requestFields["configfile"] = $this->_paymentProcessor['user_name'];
     $port = "1129";
     $host = $this->_paymentProcessor['url_site'] . ":" . $port . "/LSGSXML";
     //----------------------------------------------------------------------------------------------------
     // Check to see if we have a duplicate before we send
     //----------------------------------------------------------------------------------------------------
     if ($this->checkDupe($params['invoiceID'], CRM_Utils_Array::value('contributionID', $params))) {
         return self::errorExit(9003, 'It appears that this transaction is a duplicate.  Have you already submitted the form once?  If so there may have been a connection problem.  Check your email for a receipt from eWAY.  If you do not receive a receipt within 2 hours you can try your transaction again.  If you continue to have problems please contact the site administrator.');
     }
     //----------------------------------------------------------------------------------------------------
     // Convert to XML using function provided by payment processor
     //----------------------------------------------------------------------------------------------------
     $requestxml = lphp::buildXML($requestFields);
     /*----------------------------------------------------------------------------------------------------
       // Send to the payment information using cURL
       /----------------------------------------------------------------------------------------------------
        */
     $ch = curl_init($host);
     if (!$ch) {
         return self::errorExit(9004, 'Could not initiate connection to payment gateway');
     }
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $requestxml);
     curl_setopt($ch, CURLOPT_SSLCERT, $key);
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL') ? 2 : 0);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL'));
     // return the result on success, FALSE on failure
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_TIMEOUT, 36000);
     // ensures any Location headers are followed
     if (ini_get('open_basedir') == '' && ini_get('safe_mode') == 'Off') {
         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
     }
     // Send the data out over the wire
     //--------------------------------
     $responseData = curl_exec($ch);
     //----------------------------------------------------------------------------------------------------
     // See if we had a curl error - if so tell 'em and bail out
     //
     // NOTE: curl_error does not return a logical value (see its documentation), but
     //       a string, which is empty when there was no error.
     //----------------------------------------------------------------------------------------------------
     if (curl_errno($ch) > 0 || strlen(curl_error($ch)) > 0) {
         $errorNum = curl_errno($ch);
         $errorDesc = curl_error($ch);
         // Paranoia - in the unlikley event that 'curl' errno fails
         if ($errorNum == 0) {
             $errorNum = 9005;
         }
         // Paranoia - in the unlikley event that 'curl' error fails
         if (strlen($errorDesc) == 0) {
             $errorDesc = "Connection to payment gateway failed";
         }
         if ($errorNum == 60) {
             return self::errorExit($errorNum, "Curl error - " . $errorDesc . " Try this link for more information http://curl.haxx.se/docs/sslcerts.html");
         }
         return self::errorExit($errorNum, "Curl error - " . $errorDesc . " your key is located at " . $key . " the url is " . $host . " xml is " . $requestxml . " processor response = " . $processorResponse);
     }
     //----------------------------------------------------------------------------------------------------
     // If null data returned - tell 'em and bail out
     //
     // NOTE: You will not necessarily get a string back, if the request failed for
     //       any reason, the return value will be the boolean false.
     //----------------------------------------------------------------------------------------------------
     if ($responseData === FALSE || strlen($responseData) == 0) {
         return self::errorExit(9006, "Error: Connection to payment gateway failed - no data returned.");
     }
     //----------------------------------------------------------------------------------------------------
     // If gateway returned no data - tell 'em and bail out
     //----------------------------------------------------------------------------------------------------
     if (empty($responseData)) {
         return self::errorExit(9007, "Error: No data returned from payment gateway.");
     }
     //----------------------------------------------------------------------------------------------------
     // Success so far - close the curl and check the data
     //----------------------------------------------------------------------------------------------------
     curl_close($ch);
     //----------------------------------------------------------------------------------------------------
     // Payment successfully sent to gateway - process the response now
     //----------------------------------------------------------------------------------------------------
     //
     $processorResponse = lphp::decodeXML($responseData);
     // transaction failed, print the reason
     if ($processorResponse["r_approved"] != "APPROVED") {
         return self::errorExit(9009, "Error: [" . $processorResponse['r_error'] . "] - from payment processor");
     } else {
         //-----------------------------------------------------------------------------------------------------
         // Cross-Check - the unique 'TrxnReference' we sent out should match the just received 'TrxnReference'
         //
         // this section not used as the processor doesn't appear to pass back our invoice no. Code in eWay model if
         // used later
         //-----------------------------------------------------------------------------------------------------
         //=============
         // Success !
         //=============
         $params['trxn_result_code'] = $processorResponse['r_message'];
         $params['trxn_id'] = $processorResponse['r_ref'];
         CRM_Core_Error::debug_log_message("r_authresponse " . $processorResponse['r_authresponse']);
         CRM_Core_Error::debug_log_message("r_code " . $processorResponse['r_code']);
         CRM_Core_Error::debug_log_message("r_tdate " . $processorResponse['r_tdate']);
         CRM_Core_Error::debug_log_message("r_avs " . $processorResponse['r_avs']);
         CRM_Core_Error::debug_log_message("r_ordernum " . $processorResponse['r_ordernum']);
         CRM_Core_Error::debug_log_message("r_error " . $processorResponse['r_error']);
         CRM_Core_Error::debug_log_message("csp " . $processorResponse['r_csp']);
         CRM_Core_Error::debug_log_message("r_message " . $processorResponse['r_message']);
         CRM_Core_Error::debug_log_message("r_ref " . $processorResponse['r_ref']);
         CRM_Core_Error::debug_log_message("r_time " . $processorResponse['r_time']);
         return $params;
     }
 }
예제 #18
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
 }