示例#1
0
<?php

include_once dirname(__FILE__) . '/../../config/config.inc.php';
include_once dirname(__FILE__) . '/../../init.php';
include_once dirname(__FILE__) . '/greenworld_tenpay.php';
include_once dirname(__FILE__) . '/../../classes/OrderHistory.php';
$checkTemp = new greenworld_tenpay();
// 商店設定在ECBank管理後台的交易加密私鑰
$key = $checkTemp->getEncryptionCode();
$amount = $checkTemp->getAmount(Tools::getValue("od_sob"));
// 組合字串
$serial = trim($_POST['proc_date'] . $_POST['proc_time'] . $_POST['tsr'] . $_POST['od_sob'] . $_POST['amt']);
$mac = trim($_POST['mac']);
// 回傳的交易驗證壓碼
// ECBank 驗證Web Service網址
// 取得驗證結果 (也可以使用curl)
$ws_url = 'https://ecbank.com.tw/web_service/get_outmac_valid_new.php';
// 串接驗證參數
$post_str = 'key=' . $key . '&serial=' . $serial . '&mac=' . $mac;
// 使用curl取得驗證結果
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $ws_url);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_str);
$strAuth = curl_exec($ch);
if (curl_errno($ch)) {
    $strAuth = false;
示例#2
0
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 * Description of linkGreenWorld 
 *
 * @author 李泓承
 */
include_once dirname(__FILE__) . '/../../config/config.inc.php';
include_once dirname(__FILE__) . '/../../header.php';
include_once dirname(__FILE__) . '/../../init.php';
include_once dirname(__FILE__) . '/greenworld_tenpay.php';
include_once dirname(__FILE__) . '/../../classes/OrderHistory.php';
session_start();
global $cookie;
$CheckPay = new greenworld_tenpay();
$authorized = false;
foreach (Module::getPaymentModules() as $module) {
    if ($module['name'] == $CheckPay->name) {
        $authorized = true;
        break;
    }
}
if (!$authorized) {
    die(Tools::displayError('This payment method is not available.'));
}
$customer = new Customer((int) $cart->id_customer);
$total = $cart->getOrderTotal(true, Cart::BOTH);
$inttotal = round($total);
$HomePage = Tools::getShopDomain(true, true) . __PS_BASE_URI__;
$order = new Order((int) $CheckPay->currentOrder);