當前位置: 首頁>>代碼示例>>PHP>>正文


PHP hikashopPaymentPlugin::onBeforeOrderCreate方法代碼示例

本文整理匯總了PHP中hikashopPaymentPlugin::onBeforeOrderCreate方法的典型用法代碼示例。如果您正苦於以下問題:PHP hikashopPaymentPlugin::onBeforeOrderCreate方法的具體用法?PHP hikashopPaymentPlugin::onBeforeOrderCreate怎麽用?PHP hikashopPaymentPlugin::onBeforeOrderCreate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在hikashopPaymentPlugin的用法示例。


在下文中一共展示了hikashopPaymentPlugin::onBeforeOrderCreate方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: onBeforeOrderCreate

 function onBeforeOrderCreate(&$order, &$do)
 {
     if (parent::onBeforeOrderCreate($order, $do) === true) {
         return true;
     }
     if (!function_exists('curl_init')) {
         $this->app->enqueueMessage('The eSelect payment plugin needs the CURL library installed but it seems that it is not available on your server. Please contact your web hosting to set it up.', 'error');
         $do = false;
         return false;
     }
     $this->ccLoad();
     ob_start();
     $dbg = '';
     $amount = number_format($order->cart->full_total->prices[0]->price_value_with_tax, 2, '.', '');
     require_once dirname(__FILE__) . DS . 'eselect_lib.php';
     $txnArray = array('type' => 'purchase', 'order_id' => uniqid(), 'cust_id' => $this->user->user_id, 'amount' => $amount, 'pan' => $this->cc_number, 'expdate' => $this->cc_month . $this->cc_year, 'crypt_type' => '7', 'dynamic_descriptor' => '');
     $mpgTxn = new mpgTransaction($txnArray);
     if ($this->payment_params->ask_ccv) {
         $cvdTemplate = array('cvd_indicator' => 1, 'cvd_value' => $this->cc_CCV);
         $mpgCvdInfo = new mpgCvdInfo($cvdTemplate);
         $mpgTxn->setCvdInfo($mpgCvdInfo);
     }
     $mpgRequest = new mpgRequest($mpgTxn);
     $mpgHttpPost = new mpgHttpsPost($this->payment_params->store_id, $this->payment_params->api_token, $mpgRequest, (int) $this->payment_params->debug != 0);
     $mpgResponse = $mpgHttpPost->getMpgResponse();
     $ret = $mpgResponse->getResponseCode();
     if ($ret !== null && $ret != 'null') {
         $ret = (int) $ret;
         if ($ret < 50 && $mpgResponse->getComplete() == 'true') {
             ob_get_clean();
             ob_start();
             $this->modifyOrder($order, $this->payment_params->verified_status, true, true);
         } else {
             $responseMsg = $mpgResponse->getMessage();
             if (!empty($responseMsg)) {
                 $this->app->enqueueMessage($responseMsg);
             } else {
                 $this->app->enqueueMessage('Eselect/Moneris Response Error');
             }
             $do = false;
         }
     } else {
         if (!empty($mpgHttpPost->curl_err)) {
             $this->app->enqueueMessage($mpgHttpPost->curl_err_msg);
         } else {
             $msg = $mpgResponse->getMessage();
             if (empty($msg)) {
                 $this->app->enqueueMessage('Eselect/Moneris Generic Error');
             } else {
                 $this->app->enqueueMessage('Eselect/Moneris: ' . $msg);
             }
         }
         $do = false;
     }
     if ($do == false) {
         return true;
     }
     $this->ccClear();
     return true;
 }
開發者ID:rodhoff,項目名稱:MNW,代碼行數:60,代碼來源:eselect.php

示例2: onBeforeOrderCreate

 function onBeforeOrderCreate(&$order, &$do)
 {
     if (parent::onBeforeOrderCreate($order, $do) === true) {
         return true;
     }
     if (empty($this->payment_params->twpg_id)) {
         $this->app->enqueueMessage('Модуль оплаты не настроен');
         $do = false;
     }
 }
開發者ID:itm-constantine,項目名稱:ubrr_hikashop,代碼行數:10,代碼來源:ubrir.php

示例3: onBeforeOrderCreate

 function onBeforeOrderCreate(&$order, &$do)
 {
     if (parent::onBeforeOrderCreate($order, $do) === true) {
         return true;
     }
     if (empty($this->payment_params->tpe) || empty($this->payment_params->societe) || empty($this->payment_params->key)) {
         $this->app->enqueueMessage('Please check your &quot;CM-CIC&quot; plugin configuration');
         $do = false;
     }
 }
開發者ID:rodhoff,項目名稱:MNW,代碼行數:10,代碼來源:cmcic.php

示例4: onBeforeOrderCreate

 function onBeforeOrderCreate(&$order, &$do)
 {
     if (parent::onBeforeOrderCreate($order, $do) === true) {
         return true;
     }
     if (empty($this->payment_params->secret_Key) || empty($this->payment_params->merchant_Key)) {
         $this->app->enqueueMessage('Please check your &quot;Amazon&quot; plugin configuration');
         $do = false;
     }
 }
開發者ID:rodhoff,項目名稱:MNW,代碼行數:10,代碼來源:amazon.php

示例5: onBeforeOrderCreate

 function onBeforeOrderCreate(&$order, &$do)
 {
     if (parent::onBeforeOrderCreate($order, $do) === true) {
         return true;
     }
     if ((empty($this->payment_params->email) || empty($this->payment_params->url)) && $this->plugin_data->payment_id == $order->order_payment_id) {
         $this->app->enqueueMessage('Please check your &quot;PayPal&quot; plugin configuration');
         $do = false;
     }
 }
開發者ID:rodhoff,項目名稱:MNW,代碼行數:10,代碼來源:paypal.php

示例6: onBeforeOrderCreate

 function onBeforeOrderCreate(&$order, &$do)
 {
     if (parent::onBeforeOrderCreate($order, $do) === true) {
         return true;
     }
     if (empty($this->payment_params->secret_key) || empty($this->payment_params->application_id)) {
         $this->app->enqueueMessage('Missing merchant identifier! Please check your &quot;Netgiro&quot; plugin configuration.');
         $do = false;
     }
 }
開發者ID:HikaShop,項目名稱:hikashoppayment-netgiro,代碼行數:10,代碼來源:netgiro.php

示例7: onBeforeOrderCreate

 function onBeforeOrderCreate(&$order, &$do)
 {
     if (parent::onBeforeOrderCreate($order, $do) === true) {
         return true;
     }
     if ($order->order_payment_method == 'purchaseorder') {
         $history = new stdClass();
         $history->type = 'purchase order';
         $history->notified = 0;
         $history->data = JText::_('PURCHASE_ORDER_NUMBER') . @$_SESSION['hikashop_purchase_order_number'];
         $this->modifyOrder($order, $this->payment_params->order_status, $history, false);
     }
 }
開發者ID:rodhoff,項目名稱:MNW,代碼行數:13,代碼來源:purchaseorder.php

示例8: onBeforeOrderCreate

 function onBeforeOrderCreate(&$order, &$do)
 {
     if (parent::onBeforeOrderCreate($order, $do) === true) {
         return true;
     }
     if (!function_exists('curl_init')) {
         $this->app->enqueueMessage('The Payment Express payment plugin needs the CURL library installed but it seems that it is not available on your server. Please contact your web hosting to set it up.', 'error');
         return false;
     }
     if (empty($this->payment_params->terminal_id) || empty($this->payment_params->secret_key)) {
         $this->app->enqueueMessage('Please check your &quot;WorldNet&quot; plugin configuration : the Terminal ID and the secret key need to be configured.');
         $do = false;
     }
 }
開發者ID:q0821,項目名稱:esportshop,代碼行數:14,代碼來源:worldnettps.php

示例9: onBeforeOrderCreate

 function onBeforeOrderCreate(&$order, &$do)
 {
     if (parent::onBeforeOrderCreate($order, $do) === true) {
         return true;
     }
     if ($this->payment_params->debug) {
         if (empty($this->payment_params->key)) {
             $this->app->enqueueMessage('Please fill out the field API Key on your plugin configuration');
             $do = false;
         }
         if (empty($this->payment_params->salt)) {
             $this->app->enqueueMessage('Please fill out the field Hash salt on your plugin configuration');
             $do = false;
         }
     }
 }
開發者ID:rodhoff,項目名稱:MNW,代碼行數:16,代碼來源:payuindia.php

示例10: onBeforeOrderCreate

 function onBeforeOrderCreate(&$order, &$do)
 {
     if (parent::onBeforeOrderCreate($order, $do) === true) {
         return true;
     }
     if (empty($this->payment_params->merchantid) || empty($this->payment_params->type) || empty($this->payment_params->secret)) {
         $this->app->enqueueMessage('Please check your Cardstream plugin configuration', 'error');
         $do = false;
     }
     /* if (!function_exists('curl_init')) {
            $this->app->enqueueMessage('The Cardstream direct integration requires the CURL library installed but it seems that it is not available on your server. Please contact your web hosting to set it up.', 'error');
            return false;
        } */
     if ($this->payment_params->type != 'direct') {
         return true;
     }
 }
開發者ID:cardstream,項目名稱:Hikashop,代碼行數:17,代碼來源:cardstream.php

示例11: onBeforeOrderCreate

 function onBeforeOrderCreate(&$order, &$do)
 {
     if (parent::onBeforeOrderCreate($order, $do) === true) {
         return true;
     }
     $this->ccLoad();
     if ($order->order_payment_method == 'creditcard') {
         $order->credit_card_info = $this;
         $obj = new stdClass();
         $obj->cc_number = substr($this->cc_number, 0, 8);
         $obj->cc_month = $this->cc_month;
         $obj->cc_year = $this->cc_year;
         $obj->cc_type = @$this->cc_type;
         $history = new stdClass();
         $history->type = 'credit card';
         $history->notified = 0;
         $history->data = base64_encode(serialize($obj));
         $this->modifyOrder($order, $this->payment_params->order_status, $history, false);
     }
 }
開發者ID:rodhoff,項目名稱:MNW,代碼行數:20,代碼來源:creditcard.php

示例12: onAfterOrderConfirm

    function onAfterOrderConfirm(&$order, &$methods, $method_id)
    {
        parent::onAfterOrderConfirm($order, $methods, $method_id);
        if (parent::onBeforeOrderCreate($order, $do) === true) {
            return true;
        }
        if (!function_exists('curl_init')) {
            $this->app->enqueueMessage('The Authorize.net payment plugin in AIM mode needs the CURL library installed but it seems that it is not available on your server. Please contact your web hosting to set it up.', 'error');
            $do = false;
            return false;
        }
        if (empty($this->payment_params->merchant_id)) {
            $this->app->enqueueMessage('You have to configure a customer merchant for the westpac plugin payment first : check your plugin\'s parameters, on your website backend', 'error');
            return false;
        }
        if (empty($this->payment_params->username)) {
            $this->app->enqueueMessage('You have to configure your username for the westpac plugin payment first : check your plugin\'s parameters,
			on your website backend', 'error');
            return false;
        }
        if (empty($this->payment_params->password)) {
            $this->app->enqueueMessage('You have to configure your password for the westpac plugin payment first : check your plugin\'s parameters,
			on your website backend', 'error');
            return false;
        }
        if (empty($this->payment_params->certFile) || $this->payment_params->certFile == '.pem expected') {
            $this->app->enqueueMessage('You have to define the certificat file path for the westpac Api plugin payment first : check your plugin\'s parameters,
			on your website backend', 'error');
            return false;
        }
        include dirname(__FILE__) . DS . 'westpacapi_qvalent.php';
        $capath = JPath::clean(HIKASHOP_ROOT . 'plugins' . DS . 'hikashoppayment' . DS . 'westpacApi' . DS . 'cacerts.crt');
        $initParams = "certificateFile=" . $this->payment_params->certFile . "&" . "caFile=" . $capath . "&" . 'logDirectory=' . HIKASHOP_ROOT . 'media' . DS . 'com_hikashop' . DS . 'upload' . DS . 'safe' . DS . 'logs' . DS;
        $paywayAPI = new Qvalent_PayWayAPI();
        $paywayAPI->initialise($initParams);
        $amount = round($order->cart->full_total->prices[0]->price_value_with_tax, 2) * 100;
        $this->ccLoad();
        $vars = array('order.type' => "capture", 'customer.merchant' => trim($this->payment_params->merchant_id), 'customer.username' => trim($this->payment_params->username), 'customer.password' => trim($this->payment_params->password), 'customer.orderNumber' => $order->order_id, 'customer.originalOrderNumber' => $order->order_id, 'card.PAN' => $this->cc_number, 'card.CVN' => $this->cc_CCV, 'card.expiryYear' => $this->cc_year, 'card.expiryMonth' => $this->cc_month, 'card.currency' => 'AUD', 'order.amount' => $amount, 'order.ECI' => 'SSL');
        if ($this->payment_params->testingmode) {
            $vars['customer.merchant'] = 'TEST';
        }
        if ($this->payment_params->debug) {
            $this->writeToLog("\n Data (vars) send to westpac in Api Mode: \n\n\n");
            $this->writeToLog(print_r($vars, true));
        }
        $requestText = $paywayAPI->formatRequestParameters($vars);
        $responseText = $paywayAPI->processCreditCard($requestText);
        $post_response = $paywayAPI->parseResponseParameters($responseText);
        if ($this->payment_params->debug) {
            $this->writeToLog("\n Data (post response) receive from westpac in Api Mode: \n\n\n");
            $this->writeToLog(print_r($post_response, true));
        }
        $this->ccClear();
        if ($post_response['response.summaryCode'] == '0') {
            $order_status = $this->payment_params->verified_status;
            $this->modifyOrder($order->order_id, $order_status, true, true);
            return $this->showPage('thankyou');
        } else {
            $order_status = $this->payment_params->invalid_status;
            $this->modifyOrder($order->order_id, $order_status, true, true);
            $cancel_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=order&task=cancel_order&order_id=' . $order->order_id . $this->url_itemid;
            $error = "Report by Westpac </br>Error : " . $post_response['response.text'];
            $this->app->redirect($cancel_url, $error);
            return true;
        }
    }
開發者ID:rodhoff,項目名稱:MNW,代碼行數:66,代碼來源:westpacapi.php

示例13: onBeforeOrderCreate

 function onBeforeOrderCreate(&$order, &$do)
 {
     if (parent::onBeforeOrderCreate($order, $do) === true) {
         return true;
     }
     if (!empty($this->payment_params->vpc_mode) && $this->payment_params->vpc_mode != 'dps') {
         return true;
     }
     if (!function_exists('curl_init')) {
         $this->app->enqueueMessage('The MIGS payment plugin needs the CURL library installed but it seems that it is not available on your server. Please contact your web hosting to set it up.', 'error');
         return false;
     }
     $this->ccLoad();
     if (!empty($this->payment_params->currency)) {
         $this->accepted_currencies = array(strtoupper($this->payment_params->currency));
     }
     ob_start();
     $dbg = '';
     $amount = round($order->cart->full_total->prices[0]->price_value_with_tax * 100);
     $order_id = uniqid('');
     $uuid = $order_id . '-1';
     $vars = array('vpc_Version' => '1', 'vpc_Command' => 'pay', 'vpc_AccessCode' => $this->payment_params->access_code, 'vpc_MerchTxnRef' => $uuid, 'vpc_Merchant' => $this->payment_params->merchant_id, 'vpc_OrderInfo' => $order_id, 'vpc_Amount' => $amount, 'vpc_CardNum' => $this->cc_number, 'vpc_CardExp' => $this->cc_year . $this->cc_month);
     if ($this->payment_params->ask_ccv) {
         $vars['vpc_CardSecurityCode'] = $this->cc_CCV;
     }
     $postdata = array();
     foreach ($vars as $k => $v) {
         $postdata[] = urlencode($k) . '=' . urlencode($v);
     }
     $postdata = implode('&', $postdata);
     $httpsHikashop = str_replace('http://', 'https://', HIKASHOP_LIVE);
     $url = 'https://migs.mastercard.com.au/vpcdps';
     if (!empty($this->payment_params->url)) {
         $url = rtrim($this->payment_params->url, '/');
         if (strpos($url, 'http') === false) {
             $url = 'https://' . $url;
         }
     }
     $session = curl_init($url);
     curl_setopt($session, CURLOPT_SSL_VERIFYPEER, 0);
     curl_setopt($session, CURLOPT_SSL_VERIFYHOST, 0);
     curl_setopt($session, CURLOPT_VERBOSE, 1);
     curl_setopt($session, CURLOPT_POST, 1);
     curl_setopt($session, CURLOPT_POSTFIELDS, $postdata);
     curl_setopt($session, CURLOPT_RETURNTRANSFER, 1);
     $ret = curl_exec($session);
     $error = curl_errno($session);
     $err_msg = curl_error($session);
     curl_close($session);
     if (!empty($ret)) {
         if ($this->payment_params->debug) {
             echo print_r($ret, true) . "\n\n\n";
         }
         $result = 0;
         if (strpos($ret, '&') !== false) {
             $res = explode('&', $ret);
             $ret = array();
             foreach ($res as $r) {
                 list($k, $v) = explode('=', $r, 2);
                 $ret[urldecode($k)] = urldecode($v);
             }
             $result = 1;
             $errorMsg = '';
             if ($ret['vpc_TxnResponseCode'] == 0 || $ret['vpc_TxnResponseCode'] == '0') {
                 $result = 2;
             } else {
                 $errorMsg = $this->getResponseMessage($ret['vpc_TxnResponseCode']);
             }
             $transactionId = @$ret['vpc_TransactionNo'];
             $approvalCode = @$ret['vpc_AuthorizeId'];
             $responseMsg = $ret['vpc_Message'];
         }
         if ($result > 0) {
             if ($result == 2) {
                 $do = true;
                 $dbg .= ob_get_clean();
                 if (!empty($dbg)) {
                     $dbg .= "\r\n";
                 }
                 ob_start();
                 $history = new stdClass();
                 $email = new stdClass();
                 $history->notified = 0;
                 $history->amount = number_format($order->cart->full_total->prices[0]->price_value_with_tax, 2, '.', '') . $this->accepted_currencies[0];
                 $history->data = $dbg . 'Authorization Code: ' . @$approvalCode . "\r\n" . 'Transaction ID: ' . @$transactionId;
                 $order_status = $this->payment_params->verified_status;
                 $url = HIKASHOP_LIVE . 'administrator/index.php?option=com_hikashop&ctrl=order&task=listing';
                 $order_text = "\r\n" . JText::sprintf('NOTIFICATION_OF_ORDER_ON_WEBSITE', '', HIKASHOP_LIVE);
                 $order_text .= "\r\n" . str_replace('<br/>', "\r\n", JText::sprintf('ACCESS_ORDER_WITH_LINK', $url));
                 $email->subject = JText::sprintf('PAYMENT_NOTIFICATION', 'MIGS', 'Accepted');
                 $email->body = str_replace('<br/>', "\r\n", JText::sprintf('PAYMENT_NOTIFICATION_STATUS', 'MIGS', 'Accepted')) . ' ' . JText::sprintf('ORDER_STATUS_CHANGED', $order_status) . "\r\n\r\n" . $order_text;
                 $this->modifyOrder($order, $order_status, $history, $email);
             } else {
                 if (!empty($responseMsg)) {
                     $this->app->enqueueMessage($responseMsg);
                 } else {
                     $this->app->enqueueMessage('Error');
                 }
                 if (!empty($errorMsg)) {
                     $this->app->enqueueMessage($errorMsg);
//.........這裏部分代碼省略.........
開發者ID:q0821,項目名稱:esportshop,代碼行數:101,代碼來源:migsvpc.php

示例14: onBeforeOrderCreate

 function onBeforeOrderCreate(&$order, &$do)
 {
     if (parent::onBeforeOrderCreate($order, $do) === true) {
         return true;
     }
     if ($this->payment_params->api != 'aim') {
         return true;
     }
     if (!function_exists('curl_init')) {
         $this->app->enqueueMessage('The Authorize.net payment plugin in AIM mode needs the CURL library installed but it seems that it is not available on your server. Please contact your web hosting to set it up.', 'error');
         $do = false;
         return false;
     }
     $vars = $this->_loadStandardVars($order);
     $vars["x_delim_data"] = "TRUE";
     $vars["x_delim_char"] = "|";
     $this->ccLoad();
     if ($this->payment_params->ask_ccv) {
         $vars["x_card_code"] = $this->cc_CCV;
     }
     $vars["x_card_num"] = $this->cc_number;
     $vars["x_exp_date"] = $this->cc_month . $this->cc_year;
     $vars["x_tran_key"] = $this->payment_params->transaction_key;
     $post_string = "";
     foreach ($vars as $key => $value) {
         if (is_array($value)) {
             foreach ($value as $v) {
                 $post_string .= $key . '=' . urlencode($v) . '&';
             }
         } else {
             $post_string .= $key . '=' . urlencode($value) . '&';
         }
     }
     $post_string = rtrim($post_string, '& ');
     $request = curl_init($this->payment_params->url);
     curl_setopt($request, CURLOPT_HEADER, 0);
     curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($request, CURLOPT_POSTFIELDS, $post_string);
     curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE);
     $post_response = curl_exec($request);
     if (empty($post_response)) {
         $this->app->enqueueMessage('The connection to the payment plateform did not succeed. It is often caused by the hosting company blocking external connections so you should contact him for further guidance. The cURL error message was: ' . curl_error($request), 'error');
         $do = false;
         return false;
     }
     curl_close($request);
     $response_array = explode("|", $post_response);
     $response_code = (int) @$response_array[0];
     $response_subcode = @$response_array[1];
     $response_reason_code = @$response_array[2];
     $response_reason_text = @$response_array[3];
     $transaction_id = @$response_array[6];
     $history = new stdClass();
     $history->notified = 0;
     $history->amount = round($order->cart->full_total->prices[0]->price_value_with_tax, 2) . 'USD';
     $history->data = '';
     if (!empty($transaction_id)) {
         $history->data = 'Authorize.net transaction id: ' . $transaction_id . "\r\n\r\n";
     }
     switch ($response_code) {
         case 2:
             $this->app->enqueueMessage(JText::_('TRANSACTION_DECLINED_WRONG_CARD'));
             $this->ccClear();
             $do = false;
             break;
         case 3:
         default:
             $this->app->enqueueMessage(JText::sprintf('TRANSACTION_PROCESSING_ERROR', $response_reason_code . ' ' . $response_reason_text));
             $this->ccClear();
             $do = false;
             break;
         case 1:
             $this->modifyOrder($order, $this->payment_params->verified_status, $history, false);
             break;
         case 4:
             $this->modifyOrder($order, $this->payment_params->pending_status, $history, false);
             break;
     }
     $this->vars = $vars;
     return true;
 }
開發者ID:rodhoff,項目名稱:MNW,代碼行數:81,代碼來源:authorize.php

示例15: onBeforeOrderCreate

 function onBeforeOrderCreate(&$order, &$do)
 {
     if (parent::onBeforeOrderCreate($order, $do) === true) {
         return true;
     }
     if (!function_exists('curl_init')) {
         $this->app->enqueueMessage('The Payment Express payment plugin needs the CURL library installed but it seems that it is not available on your server. Please contact your web hosting to set it up.', 'error');
         return false;
     }
     $this->ccLoad();
     ob_start();
     $dbg = '';
     $amount = number_format($order->cart->full_total->prices[0]->price_value_with_tax, 2, '.', '');
     $vars = '<Txn>';
     $vars .= '<PostUsername>' . $this->payment_params->username . '</PostUsername>';
     $vars .= '<PostPassword>' . $this->payment_params->password . '</PostPassword>';
     $vars .= '<Amount>' . $amount . '</Amount>';
     $vars .= '<InputCurrency>' . $this->currency->currency_code . '</InputCurrency>';
     if (!empty($this->cc_CCV)) {
         $vars .= '<Cvc2>' . $this->cc_CCV . '</Cvc2>';
     }
     if (!empty($this->cc_owner)) {
         $vars .= '<CardHolderName>' . $this->cc_owner . '</CardHolderName>';
     }
     $vars .= '<CardNumber>' . $this->cc_number . '</CardNumber>';
     $vars .= '<DateExpiry>' . $this->cc_month . $this->cc_year . '</DateExpiry>';
     $vars .= '<TxnType>Purchase</TxnType>';
     if (empty($order->order_number) && !empty($order->order_id)) {
         $order->order_number = hikashop_encode($order);
     }
     if (!empty($order->order_number)) {
         $vars .= '<MerchantReference>' . $order->order_number . '</MerchantReference>';
     }
     $vars .= '</Txn>';
     $domain = 'https://sec.paymentexpress.com/pxpost.aspx';
     $session = curl_init($domain);
     curl_setopt($session, CURLOPT_SSL_VERIFYPEER, 0);
     curl_setopt($session, CURLOPT_VERBOSE, 1);
     curl_setopt($session, CURLOPT_SSLVERSION, defined('CURL_SSLVERSION_TLSv1') ? CURL_SSLVERSION_TLSv1 : 1);
     curl_setopt($session, CURLOPT_POST, 1);
     curl_setopt($session, CURLOPT_POSTFIELDS, $vars);
     curl_setopt($session, CURLOPT_RETURNTRANSFER, 1);
     $ret = curl_exec($session);
     $error = curl_errno($session);
     $err_msg = curl_error($session);
     curl_close($session);
     if (!empty($ret)) {
         if ($this->payment_params->debug) {
             echo print_r($ret, true) . "\n\n\n";
         }
         $error_msg = '';
         if (preg_match('#<Success>([0-9])</Success>#', $ret, $res) !== false && $res[1]) {
             $approvalCode = '';
             if (preg_match('#<AuthCode>([0-9]+)</AuthCode>#', $ret, $res) !== false) {
                 $approvalCode = $res[1];
             }
             $transactionId = '';
             if (preg_match('#<TransactionId>([0-9]+)</TransactionId>#', $ret, $res) !== false) {
                 $transactionId = $res[1];
             }
             $do = true;
             $dbg .= ob_get_clean();
             if (!empty($dbg)) {
                 $dbg .= "\r\n";
             }
             ob_start();
             $history = new stdClass();
             $email = new stdClass();
             $history->notified = 0;
             $history->amount = $amount . $this->currency->currency_code;
             $history->data = $dbg . 'Authorization Code: ' . $approvalCode . "\r\n" . 'Transaction ID: ' . $transactionId;
             $order_status = $this->payment_params->verified_status;
             $url = HIKASHOP_LIVE . 'administrator/index.php?option=com_hikashop&ctrl=order&task=listing';
             $order_text = "\r\n" . JText::sprintf('NOTIFICATION_OF_ORDER_ON_WEBSITE', '', HIKASHOP_LIVE);
             $order_text .= "\r\n" . str_replace('<br/>', "\r\n", JText::sprintf('ACCESS_ORDER_WITH_LINK', $url));
             $email->subject = JText::sprintf('PAYMENT_NOTIFICATION', 'Payment express', 'Accepted');
             $email->body = str_replace('<br/>', "\r\n", JText::sprintf('PAYMENT_NOTIFICATION_STATUS', 'Payment express', 'Accepted')) . ' ' . JText::sprintf('ORDER_STATUS_CHANGED', $order_status) . "\r\n\r\n" . $order_text;
             $this->modifyorder($order, $order_status, $history, $email);
         } else {
             if (preg_match('#<ReCo>([0-9]+)</ReCo>#', $ret, $res)) {
                 $error = $res[1] . ' ';
             }
             if (preg_match('#<ResponseText>(.*)</ResponseText>#', $ret, $res)) {
                 $error_msg = $res[1] . ' ';
             }
             if (preg_match('#<HelpText>(.*)</HelpText>#', $ret, $res)) {
                 $error_msg .= $res[1];
             }
             $responseMsg = $error . $error_msg;
             if (!empty($responseMsg)) {
                 $this->app->enqueueMessage('Error : ' . $responseMsg);
             } else {
                 $this->app->enqueueMessage('Error');
             }
             $do = false;
         }
     } else {
         $this->app->enqueueMessage('There was an error during the connection with the Payment Express gateway');
         if ($this->payment_params->debug) {
             echo 'Curl Err [' . $error . '] : ' . $err_msg . "\n\n\n";
//.........這裏部分代碼省略.........
開發者ID:rodhoff,項目名稱:MNW,代碼行數:101,代碼來源:paymentexpress.php


注:本文中的hikashopPaymentPlugin::onBeforeOrderCreate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。