예제 #1
0
function trade_notifycheck($type)
{
    global $_G;
    if ($type == 'credit' || $type == 'invite') {
        if (!DISCUZ_SECURITYCODE) {
            exit('Access Denied');
        }
        $resHandler = new ResponseHandler();
        $resHandler->setKey(DISCUZ_SECURITYCODE);
        $resHandler->setParameter("bankname", "");
    } else {
        if (!DISCUZ_TENPAY_OPENTRANS_KEY) {
            exit('Access Denied');
        }
        $resHandler = new MediPayResponseHandler();
        $resHandler->setKey(DISCUZ_TENPAY_OPENTRANS_KEY);
    }
    if ($type == 'credit' || $type == 'invite') {
        if ($resHandler->isTenpaySign() && DISCUZ_PARTNER == $_GET['partner']) {
            return array('validator' => !$_GET['trade_state'], 'order_no' => $_GET['out_trade_no'], 'trade_no' => $_GET['transaction_id'], 'price' => $_GET['total_fee'] / 100, 'bargainor_id' => $_GET['partner'], 'location' => true);
        }
    } elseif ($type == 'trade') {
        if ($resHandler->isTenpaySign()) {
            return array('validator' => $resHandler->getParameter('retcode') == '0', 'order_no' => $resHandler->getParameter('mch_vno'), 'trade_no' => $resHandler->getParameter('cft_tid'), 'price' => $resHandler->getParameter('total_fee') / 100.0, 'status' => $resHandler->getParameter('status'), 'location' => true);
        }
    } else {
        return array('validator' => FALSE, 'location' => 'forum.php?mod=memcp&action=credits&operation=addfunds&return=fail');
    }
}
예제 #2
0
<?php

require_once dirname(dirname(dirname(__FILE__))) . '/app.php';
/* 平台商密钥 */
$key = $INI['tenpay']['sec'];
/* 创建支付应答对象 */
$resHandler = new MediPayResponseHandler();
$resHandler->setKey($key);
//判断签名
if ($resHandler->isTenpaySign()) {
    //商家订单号
    $v_oid = $resHandler->getParameter("mch_vno");
    @(list($_, $order_id, $city_id, $_) = explode('-', $v_oid, 4));
    //金额,以分为单位
    $v_amount = moneyit($resHandler->getParameter("total_fee") * 0.01);
    //返回码
    $retcode = $resHandler->getParameter("retcode");
    //状态
    $status = $resHandler->getParameter("status");
    //返回码判断
    if ("0" == $retcode) {
        $order = Table::Fetch('order', $order_id);
        if ($order['state'] == 'pay') {
            Session::Set('notice', "购买成功!");
        }
    } else {
        Session::Set('notice', "支付失败!");
    }
}
redirect(WEB_ROOT . "/order/pay.php?id={$order_id}");
예제 #3
0
function trade_notifycheck($type)
{
    global $_G;
    if (DISCUZ_TENPAY_DIRECT && $type == 'credit') {
        $resHandler = new ResponseHandler();
        $resHandler->setKey(DISCUZ_SECURITYCODE);
        $resHandler->setParameter("pay_time", "");
    } else {
        $resHandler = new MediPayResponseHandler();
        $resHandler->setKey(DISCUZ_TENPAY_OPENTRANS_KEY);
    }
    if ($type == 'credit') {
        if (DISCUZ_TENPAY_DIRECT && $resHandler->isTenpaySign() && DISCUZ_PARTNER == $_G['gp_bargainor_id']) {
            return array('validator' => !$_G['gp_pay_result'], 'order_no' => $_G['gp_sp_billno'], 'trade_no' => $_G['gp_transaction_id'], 'price' => $_G['gp_total_fee'] / 100, 'bargainor_id' => $_G['gp_bargainor_id'], 'location' => true);
        } elseif (!DISCUZ_TENPAY_DIRECT && $resHandler->isTenpaySign()) {
            return array('validator' => $resHandler->getParameter('retcode') == '0', 'order_no' => $resHandler->getParameter('mch_vno'), 'trade_no' => $resHandler->getParameter('cft_tid'), 'price' => $resHandler->getParameter('total_fee') / 100.0, 'status' => $resHandler->getParameter('status'), 'location' => true);
        }
    } elseif ($type == 'trade') {
        if ($resHandler->isTenpaySign()) {
            return array('validator' => $resHandler->getParameter('retcode') == '0', 'order_no' => $resHandler->getParameter('mch_vno'), 'trade_no' => $resHandler->getParameter('cft_tid'), 'price' => $resHandler->getParameter('total_fee') / 100.0, 'status' => $resHandler->getParameter('status'), 'location' => true);
        }
    } else {
        return array('validator' => FALSE, 'location' => 'forum.php?mod=memcp&action=credits&operation=addfunds&return=fail');
    }
}