Exemple #1
0
function pay_charge_tenpay($total_money, $charge_id, $title)
{
    global $INI;
    if ($total_money <= 0 || !$title) {
        return null;
    }
    $order_id = 'charge';
    $v_mid = $INI['tenpay']['mid'];
    $v_url = $INI['system']['wwwprefix'] . '/order/tenpay/return.php';
    $key = $INI['tenpay']['sec'];
    $v_oid = $charge_id;
    $v_amount = strval($total_money * 100);
    $v_moneytype = $INI['system']['currencyname'];
    $text = $v_amount . $v_moneytype . $v_oid . $v_mid . $v_url . $key;
    /* must */
    $sp_billno = $v_oid;
    $transaction_id = $v_mid . date('Ymd') . date('His') . rand(1000, 9999);
    $desc = mb_convert_encoding($title, 'GBK', 'UTF-8');
    /* end */
    $reqHandler = new PayRequestHandler();
    $reqHandler->init();
    $reqHandler->setKey($key);
    $reqHandler->setParameter("bargainor_id", $v_mid);
    $reqHandler->setParameter("cs", "GBK");
    $reqHandler->setParameter("sp_billno", $sp_billno);
    $reqHandler->setParameter("transaction_id", $transaction_id);
    $reqHandler->setParameter("total_fee", $v_amount);
    $reqHandler->setParameter("return_url", $v_url);
    $reqHandler->setParameter("desc", $desc);
    $reqHandler->setParameter("spbill_create_ip", Utility::GetRemoteIp());
    $reqUrl = $reqHandler->getRequestURL();
    if (is_post() && $_POST['paytype'] != 'tenpay') {
        $reqHandler->setParameter('bank_type', pay_getqqbank($_POST['paytype']));
        $reqUrl = $reqHandler->getRequestURL();
        redirect($reqUrl);
    }
    return render('block_pay_tenpay', array('order_id' => $order_id, 'reqUrl' => $reqUrl));
}
Exemple #2
0
    $desc = $title;
    /* end */
    $reqHandler = new PayRequestHandler();
    $reqHandler->init();
    $reqHandler->setKey($key);
    $reqHandler->setParameter("bargainor_id", $v_mid);
    $reqHandler->setParameter("cs", "UTF-8");
    $reqHandler->setParameter("sp_billno", $sp_billno);
    $reqHandler->setParameter("transaction_id", $transaction_id);
    $reqHandler->setParameter("total_fee", $v_amount);
    $reqHandler->setParameter("return_url", $v_url);
    $reqHandler->setParameter("desc", $desc);
    $reqHandler->setParameter("spbill_create_ip", Utility::GetRemoteIp());
    $reqUrl = $reqHandler->getRequestURL();
    if ($_POST['paytype'] != 'tenpay') {
        $reqHandler->setParameter('bank_type', pay_getqqbank($_POST['paytype']));
        $reqUrl = $reqHandler->getRequestURL();
        redirect($reqUrl);
    }
    include template('order_charge');
} else {
    if ($order_service == 'paypal') {
        $cmd = '_xclick';
        $business = $INI['paypal']['mid'];
        $location = $INI['paypal']['loc'];
        $item_number = "charge-{$login_user_id}-{$now}-{$randno}";
        $item_name = $title;
        $amount = $total_money;
        $quantity = 1;
        $post_url = "https://www.paypal.com/row/cgi-bin/webscr";
        $image_url = "";