예제 #1
0
$SRC = getParameter('SRC');
$Amount = getParameter('Amount');
$CheckSum = getParameter('CheckSum');
$ApprovalCode = getParameter('ApprovalCode');
$BankResponseCode = getParameter('BankResponseCode');
$BatchNumber = getParameter('BatchNumber');
$Code = "abcd1234";
$chkstr = $MerchantNumber . $OrderNumber . $PRC . $SRC . $Code . $Amount;
$chkstr = md5($chkstr);
//--購物車
$shopping_car = new order($conn, PREFIX . "shopping_car", PREFIX . "shopping_car_list", PREFIX . "products");
//判斷交易狀態
if ($PRC == "0" && $SRC == "0") {
    //-- 回傳成功,但結果有可能遭竄改,因此需和編碼內容比較
    if (strtolower($chkstr) == strtolower($CheckSum)) {
        $shopping_car->paycheck($OrderNumber);
        //alert('付款成功!!','../member.php?act=order');
        echo '<br>' . $chkstr;
        echo '<br>' . $CheckSum;
        //echo '<br>交易成功';
        echo '<br>訂單編號 : ' . $OrderNumber;
        echo ' <br>交易金額 : ' . $Amount;
        echo ' <br>授權碼  : ' . $ApprovalCode;
        echo ' <br>銀行回傳碼: ' . $BankResponseCode;
        echo '<br>批次號碼  :' . $BatchNumber;
    } else {
        //-- 資料遭竄改
        echo '交易結果有誤,請與我們聯絡!';
    }
} else {
    if ($PRC == "34" && $SRC == "171") {
예제 #2
0
<?php

include_once "../../includes/main_inc.php";
$member_key = 'Aa10270601';
//--商家密碼
/*
$_POST["Td"] = '140368101519';
$_POST["web"] = 'S1405270206';
$_POST["buysafeno"] = 'abcd1234';
$_POST["MN"] = 1500;
$_POST["errcode"] = 00;
$_POST["ChkValue"] = strtoupper(sha1($_POST["web"].$member_key.$_POST["buysafeno"].$_POST["MN"].$_POST["errcode"]));
*/
if ($_POST) {
    /**資料記憶*/
    $data["data"] = 'ok==>' . json_encode($_POST);
    $data["create_date"] = date("Y-m-d H:i:s");
    $avalue = $conn->AutoExecute(PREFIX . 'temp', $data, "INSERT");
    //--購物車
    $shopping_car = new order($conn, PREFIX . "shopping_car", PREFIX . "shopping_car_list", PREFIX . "products");
    if ($_POST["errcode"] * 1 == 0) {
        if ($_POST["ChkValue"] == strtoupper(sha1($_POST["web"] . $member_key . $_POST["buysafeno"] . $_POST["MN"] . $_POST["errcode"]))) {
            $shopping_car->paycheck($_POST["Td"]);
            alert('付款成功!!', '../member.php?act=order');
        }
    }
}
예제 #3
0
    // check whether the payment_status is Completed
    if ($_POST['payment_status'] == "Completed" || $_POST['payment_status'] == "Pending") {
        // check that txn_id has not been previously processed
        $temp = $conn->GetRow("SELECT * FROM " . PREFIX . "shopping_car WHERE txn_id='" . $_POST['txn_id'] . "'");
        if (!$temp) {
            //賣家Paypal帳號
            if ($_POST['test_ipn'] == 1) {
                //snadbox 測試
                $account = "*****@*****.**";
            } else {
                //live 正式
                $account = "*****@*****.**";
            }
            // check that receiver_email is your PayPal email $_POST['item_number']
            if ($_POST['receiver_email'] == $account) {
                $shopping_car->paycheck($_POST['item_number']);
            }
        }
    }
    if (DEBUG == true) {
        error_log(date('[Y-m-d H:i e] ') . "Verified IPN: {$req} " . PHP_EOL, 3, LOG_FILE);
    }
} else {
    if (strcmp($res, "INVALID") == 0) {
        // log for manual investigation
        // Add business logic here which deals with invalid IPN messages
        if (DEBUG == true) {
            error_log(date('[Y-m-d H:i e] ') . "Invalid IPN: {$req}" . PHP_EOL, 3, LOG_FILE);
        }
    }
}
예제 #4
0
<?php

$temp_nowurl = explode('includes', __FILE__);
include_once $temp_nowurl[0] . "includes/main_inc.php";
if ($_GET['sn_id'] !== '00000000') {
    if (strlen($_GET['sn_id']) > 8) {
        //-判斷是否取貨付款
        $shopping_car = new order($conn, PREFIX . "shopping_car", PREFIX . "shopping_car_list", PREFIX . "products");
        $shopping_car->paycheck($_GET['order_id']);
        alert('訂單 ' . $_GET['order_id'] . ' 已完成取貨付款申請!!', '');
    } else {
        //--超商取貨
        $shopping_car = new order($conn, PREFIX . "shopping_car", PREFIX . "shopping_car_list", PREFIX . "products");
        $order = $shopping_car->getorder(" where order_no='" . $_GET['order_id'] . "'");
        $indata['MerchantNumber'] = '1';
        $shopping_car->update($indata, $order['id']);
        //$shopping_car->paycheck($_GET['order_id']);
        alert('訂單' . $_GET['order_id'] . '已完成超商取貨申請!!\\r\\n 到店編號 [ ' . $_GET['sn_id'] . ' ]', '/');
    }
}
예제 #5
0
echo "data<br>";
print_r($data);
echo 'POST LIST';
echo "<pre>"; 
print_r($_POST); 
echo "</pre>";
*/
//判斷交易狀態 -- 回傳成功,但結果有可能遭竄改,因此需和編碼內
if ($_POST['RtnCode'] == "1" && $_POST['CheckMacValue']) {
    //調整ksort排序規則--依自然排序法(大小寫不敏感)
    ksort($data, SORT_NATURAL | SORT_FLAG_CASE);
    //取得 Mac Value
    echo 'CHKCODE=';
    echo $chkstr = _getMacValue($hash_key, $hash_iv, $data);
    echo '<br>';
    //比較安全碼
    if (strtoupper($chkstr) == $_POST['CheckMacValue']) {
        $shopping_car->paycheck($_POST['MerchantTradeNo']);
        echo '1|OK';
    } else {
        echo '0|ErrorMessage';
    }
} else {
    echo '0|ErrorMessage';
}
/*
$info=ob_get_contents(); //得到緩衝區的內容並且賦值給$info
$file=fopen('output.html','w'); //打開文件info.txt
fwrite($file,$info); //寫入信息到info.txt
fclose($file); //關閉文件info.txt 
*/
예제 #6
0
<?php

$temp_nowurl = explode('includes', __FILE__);
include_once $temp_nowurl[0] . "includes/main_inc.php";
$member_id = '8089009467';
//特店代號
$member_key = 'EOVVASTMGPBIWUFQEKOREYEHSUJRN1EB';
$shopping_car = new order($conn, PREFIX . "shopping_car", PREFIX . "shopping_car_list", PREFIX . "products");
echo 'test';
if ($_GET['RC'] === '00') {
    //--購物車
    $data = $_GET;
    $temp_key_str = $data['RC'] . '&' . $data['MID'] . '&' . $data['ONO'] . '&' . $data['LTD'] . '&' . $data['LTT'] . '&' . $data['RRN'] . '&' . $data['AIR'] . '&' . $data['AN'] . '&' . $member_key;
    if (strtolower(md5($temp_key_str)) === $data['M']) {
        $shopping_car->paycheck($data["ONO"]);
        alert('付款成功!!', '../../member.php?act=order');
    } else {
        echo '驗證比對失敗!!';
    }
} else {
    switch ($_GET["RC"]) {
        case "G6":
            alert('金流已交易失敗,請重新建立訂單交易!!', '../../member.php?act=order');
            break;
        case "G0":
            alert('金流方系統維護中!!', '../../member.php?act=order');
            break;
        default:
            alert('交易失敗!!', '../../member.php?act=order');
            break;
    }