Exemplo n.º 1
0
function done_transaction($oid, $vpnid)
{
    $ret = order_dopayment($oid);
    if ($ret === false) {
        pay_error(CANTFINISH);
        die;
    }
    /// 支付成功,开通服务并显示成功信息
    $sql = "SELECT * FROM service WHERE id IN (SELECT serviceid FROM `order` WHERE id={$oid})";
    $res = db_query($sql);
    if ($res === false) {
        pay_error(_("Can not find service correlate to order.id={$oid}, payment token={$token}"));
        die;
    }
    $service = db_fetch_array($res);
    /// 查找对应的 VPN 帐号
    $vpnid = (int) $vpnid;
    $vpns = db_quick_fetch('vpnaccount', "WHERE id={$vpnid}");
    if (count($vpns) <= 0) {
        vpn_log("No vpnid {$vpnid} found for order {$oid}");
        return false;
    }
    $vpn = $vpns[0];
    /// 下面的代码和 account_new.php 中的代码一致
    /// 3. 账户余额足够,开通帐号
    vpn_renew($vpn['username'], $service['duration'], $service['radiusgroup']);
    /// 4. 发货(在 raidus 中设置帐号),并扣款
    order_delivery($oid);
    return true;
}
Exemplo n.º 2
0
function confirm_main()
{
    $oid = @$_GET['orderid'];
    if (order_dopayment($oid) == false) {
        confirm_error(_('Payment fail, please contact us for help'));
        return false;
    } else {
        $smarty->assign('url', "order_delivery.php?orderid={$oid}");
        $smarty->display('paypal_confirm.html');
        return true;
    }
}