本文整理汇总了PHP中RequestHandler::getGateUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP RequestHandler::getGateUrl方法的具体用法?PHP RequestHandler::getGateUrl怎么用?PHP RequestHandler::getGateUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RequestHandler
的用法示例。
在下文中一共展示了RequestHandler::getGateUrl方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$this->CsdjUser->User_Login();
$id = (int) $this->uri->segment(4);
//订单ID
if ($id == 0) {
msg_url(L('pay_01'), spacelink('pay'));
}
$row = $this->CsdjDB->get_row('pay', '*', $id);
if (!$row || $row->uid != $_SESSION['cscms__id']) {
msg_url(L('pay_02'), spacelink('pay'));
}
require_once CSCMSPATH . "pay/tenpay/RequestHandler.class.php";
$partner = CS_Tenpay_ID;
$key = CS_Tenpay_Key;
$return_url = site_url('pay/tenpay/return_url');
$notify_url = site_url('pay/tenpay/notify_url');
/* 创建支付请求对象 */
$reqHandler = new RequestHandler();
$reqHandler->init();
$reqHandler->setKey($key);
$reqHandler->setGateUrl("https://gw.tenpay.com/gateway/pay.htm");
$reqHandler->setParameter("partner", $partner);
$reqHandler->setParameter("out_trade_no", $row->dingdan);
$reqHandler->setParameter("total_fee", $row->rmb);
//总金额
$reqHandler->setParameter("return_url", $return_url);
$reqHandler->setParameter("notify_url", $notify_url);
$reqHandler->setParameter("body", L('pay_03', array($_SESSION['cscms__name'])));
$reqHandler->setParameter("bank_type", "DEFAULT");
//银行类型,默认为财付通
//用户ip
$reqHandler->setParameter("spbill_create_ip", getip());
//客户端IP
$reqHandler->setParameter("fee_type", "1");
//币种
$reqHandler->setParameter("subject", L('pay_03', array($_SESSION['cscms__name'])));
//商品名称
//系统可选参数
$reqHandler->setParameter("sign_type", "MD5");
//签名方式,默认为MD5,可选RSA
$reqHandler->setParameter("service_version", "1.0");
//接口版本号
$reqHandler->setParameter("input_charset", "utf-8");
//字符集
$reqHandler->setParameter("sign_key_index", "1");
//密钥序号
//业务可选参数
$reqHandler->setParameter("attach", "");
//附件数据,原样返回就可以了
$reqHandler->setParameter("product_fee", "");
//商品费用
$reqHandler->setParameter("transport_fee", "0");
//物流费用
$reqHandler->setParameter("time_start", date("YmdHis"));
//订单生成时间
$reqHandler->setParameter("time_expire", "");
//订单失效时间
$reqHandler->setParameter("buyer_id", "");
//买方财付通帐号
$reqHandler->setParameter("goods_tag", "");
//商品标记
$reqHandler->setParameter("trade_mode", "1");
//交易模式 1.即时到帐模式,2.中介担保模式,3.后台选择
$reqHandler->setParameter("transport_desc", "");
//物流说明
$reqHandler->setParameter("trans_type", "1");
//交易类型
$reqHandler->setParameter("agentid", "");
//平台ID
$reqHandler->setParameter("agent_type", "");
//代理模式(0.无代理,1.表示卡易售模式,2.表示网店模式)
$reqHandler->setParameter("seller_id", "");
//卖家的商户号
//请求的URL
$reqUrl = $reqHandler->getRequestURL();
$debugInfo = $reqHandler->getDebugInfo();
echo '<form action="' . $reqHandler->getGateUrl() . '" name="form1" method="post">';
$params = $reqHandler->getAllParameters();
foreach ($params as $k => $v) {
echo "<input type=\"hidden\" name=\"{$k}\" value=\"{$v}\" />\n";
}
echo '<script language="javascript">document.form1.submit();</script></form>';
}
示例2:
/*
$debugInfo = $reqHandler->getDebugInfo();
echo "<br/>" . $reqUrl . "<br/>";
echo "<br/>" . $debugInfo . "<br/>";
*/
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<title>财付通即时到帐程序演示</title>
</head>
<body>
<br/><a href="<?php
echo $reqUrl;
?>
" target="_blank">财付通支付</a>
<form action="<?php
echo $reqHandler->getGateUrl();
?>
" method="post" target="_blank">
<?php
$params = $reqHandler->getAllParameters();
foreach ($params as $k => $v) {
echo "<input type=\"hidden\" name=\"{$k}\" value=\"{$v}\" />\n";
}
?>
<input type="submit" value="财付通支付">
</form>
</body>
</html>
示例3: get_payment_code
//.........这里部分代码省略.........
//'sys_id' => '542554970',
//'sp_suggestuser' => '1202822001' //财付通分配的商户号
);
//
$payLinks = '<form style="text-align:center;" action="https://www.tenpay.com/cgi-bin/v1.0/pay_gate.cgi" target="_blank" style="margin:0px;padding:0px" >';
foreach ($parameter AS $key=>$val)
{
$payLinks .= "<input type='hidden' name='$key' value='$val' />";
}
if(!empty($payment_info['logo']))
{
$payLinks .= "<input type='image' src='".APP_ROOT.$payment_info['logo']."' style='border:solid 1px #ccc;'><div class='blank'></div>";
}
$payLinks .= "<input type='submit' class='paybutton' value='".sprintf($this->payment_lang['GO_TO_PAY'],$this->get_name($bank_type))."'></form>";
$code = '<div style="text-align:center">'.$payLinks.'</div>';
$code.="<br /><div style='text-align:center' class='red'>".$GLOBALS['lang']['PAY_TOTAL_PRICE'].":".format_price($money)."</div>";
return $code;
*/
$reqHandler = new RequestHandler();
$reqHandler->init();
$reqHandler->setKey($payment_info['config']['tencentpay_key']);
$reqHandler->setGateUrl("https://gw.tenpay.com/gateway/pay.htm");
//----------------------------------------
//设置支付参数
//----------------------------------------
$reqHandler->setParameter("partner", $payment_info['config']['tencentpay_id']);
$reqHandler->setParameter("out_trade_no", $out_trade_no);
$reqHandler->setParameter("total_fee", $total_fee);
//总金额
$reqHandler->setParameter("return_url", $return_url);
$reqHandler->setParameter("notify_url", $data_notify_url);
$reqHandler->setParameter("body", $desc);
$reqHandler->setParameter("bank_type", $bank_type);
//银行类型,默认为财付通
//用户ip
$reqHandler->setParameter("spbill_create_ip", CLIENT_IP);
//客户端IP
$reqHandler->setParameter("fee_type", $fee_type);
//币种
$reqHandler->setParameter("subject", $desc);
//商品名称,(中介交易时必填)
//系统可选参数
$reqHandler->setParameter("sign_type", "MD5");
//签名方式,默认为MD5,可选RSA
$reqHandler->setParameter("service_version", "1.0");
//接口版本号
$reqHandler->setParameter("input_charset", "utf-8");
//字符集
$reqHandler->setParameter("sign_key_index", "1");
//密钥序号
//业务可选参数
$reqHandler->setParameter("attach", $attach);
//附件数据,原样返回就可以了
$reqHandler->setParameter("product_fee", "");
//商品费用
$reqHandler->setParameter("transport_fee", "0");
//物流费用
$reqHandler->setParameter("time_start", $today);
//订单生成时间
$reqHandler->setParameter("time_expire", "");
//订单失效时间
$reqHandler->setParameter("buyer_id", "");
//买方财付通帐号
$reqHandler->setParameter("goods_tag", "");
//商品标记
$reqHandler->setParameter("trade_mode", $cmd_no);
//交易模式(1.即时到帐模式,2.中介担保模式,3.后台选择(卖家进入支付中心列表选择))
$reqHandler->setParameter("transport_desc", "");
//物流说明
$reqHandler->setParameter("trans_type", "1");
//交易类型
$reqHandler->setParameter("agentid", "");
//平台ID
$reqHandler->setParameter("agent_type", "");
//代理模式(0.无代理,1.表示卡易售模式,2.表示网店模式)
$reqHandler->setParameter("seller_id", "");
//卖家的商户号
//请求的URL
$reqUrl = $reqHandler->getRequestURL();
/*if($_REQUEST['v']==1){
$debugInfo = $reqHandler->getDebugInfo();
echo "<br/>" . $reqUrl . "<br/>";
echo "<br/>" . $debugInfo . "<br/>";
print_r($payment_info['config']);
}*/
$payLinks = '<form style="text-align:center;" action="' . $reqHandler->getGateUrl() . '" target="_blank" style="margin:0px;padding:0px" method="post" >';
$params = $reqHandler->getAllParameters();
foreach ($params as $k => $v) {
$payLinks .= "<input type=\"hidden\" name=\"{$k}\" value=\"{$v}\" />\n";
}
$payLinks .= "<button type='submit' class='ui-button paybutton' rel='blue'>" . sprintf($this->payment_lang['GO_TO_PAY'], $this->get_name($bank_type)) . "</button></form>";
$code = '<div style="text-align:center">' . $payLinks . '</div>';
$code .= "<br /><div style='text-align:center' class='red'>" . $GLOBALS['lang']['PAY_TOTAL_PRICE'] . ":" . format_price($money) . "</div>";
return $code;
}
示例4: tenpay
public function tenpay()
{
if ($this->payConfig['tenpay']['enable'] == 0) {
exit("对不起,该支付方式被关闭,暂时不能使用!");
}
$tenpay_params = C('TENPAY_PARAMS');
$this->getPaydetail();
$this->paydetail['use_account'] = empty($_GET['useAccount']) ? 0 : $_GET['useAccount'];
require_once C('APP_ROOT') . "Lib/Pay/Tenpay/RequestHandler.class.php";
/* 创建支付请求对象 */
$reqHandler = new RequestHandler();
$reqHandler->init();
$reqHandler->setKey($this->payConfig['tenpay']['mkey']);
$reqHandler->setGateUrl($tenpay_params["PAY_URL"]);
//----------------------------------------
//设置支付参数
//----------------------------------------
$reqHandler->setParameter("total_fee", doubleval($this->paydetail['money']) * 100);
//总金额
//用户ip
$reqHandler->setParameter("spbill_create_ip", get_client_ip());
//客户端IP
$reqHandler->setParameter("return_url", $this->tenpay_rtn_url);
//支付成功后返回
$reqHandler->setParameter("partner", $this->payConfig['tenpay']['MerCode']);
$reqHandler->setParameter("out_trade_no", "tenpay" . date("YmdHis") . rand(10000, 99999));
$reqHandler->setParameter("notify_url", $this->tenpay_notice_url);
$reqHandler->setParameter("body", "轩宇泰投资用户充值");
if ($this->paydetail['use_account'] == 1) {
$this->paydetail['bank'] = "";
$reqHandler->setParameter("bank_type", "DEFAULT");
//买方财付通帐号
} else {
$reqHandler->setParameter("bank_type", $this->paydetail['bank']);
//银行类型,默认为财付通
}
$reqHandler->setParameter("fee_type", "1");
//币种
//系统可选参数
$reqHandler->setParameter("sign_type", "MD5");
//签名方式,默认为MD5,可选RSA
$reqHandler->setParameter("service_version", "1.0");
//接口版本号
$reqHandler->setParameter("input_charset", "UTF-8");
//字符集
$reqHandler->setParameter("sign_key_index", "1");
//密钥序号
//业务可选参数
$reqHandler->setParameter("attach", "");
//附件数据,原样返回就可以了
$reqHandler->setParameter("product_fee", "");
//商品费用
$reqHandler->setParameter("transport_fee", "");
//物流费用
$reqHandler->setParameter("time_start", date("YmdHis"));
//订单生成时间
$reqHandler->setParameter("time_expire", "");
//订单失效时间
$reqHandler->setParameter("buyer_id", "");
$reqHandler->setParameter("goods_tag", "");
//商品标记
//请求的URL
$reqUrl = $reqHandler->getRequestURL();
$this->paydetail['fee'] = getfloatvalue($this->payConfig['tenpay']['feerate'] * $this->paydetail['money'] / 100, 2);
$this->paydetail['nid'] = $this->createnid("tenpay", $reqHandler->getParameter("out_trade_no"));
$this->paydetail['way'] = "tenpay";
$this->paydetail['mer_order_num'] = $reqHandler->getParameter("out_trade_no");
M("member_payonline")->add($this->paydetail);
$this->create($reqHandler->getAllParameters(), $reqHandler->getGateUrl());
}
示例5:
$reqHandler->setParameter("agentid", "");
//平台ID
$reqHandler->setParameter("agent_type", "");
//代理模式(0.无代理,1.表示卡易售模式,2.表示网店模式)
$reqHandler->setParameter("seller_id", "");
//卖家的商户号
//请求的URL
$reqUrl = $reqHandler->getRequestURL();
//获取debug信息,建议把请求和debug信息写入日志,方便定位问题
/**/
$debugInfo = $reqHandler->getDebugInfo();
$html = <<<eot
<br/> {$reqUrl} <br/>
<br/> {$debugInfo} <br/>
<a href="{$reqUrl}" target="_blank">财付通支付</a>
<script>
window.location.href="{$reqUrl}";
</script>
<form action="{$reqHandler->getGateUrl()}" method="post" target="_blank">
eot;
$params = $reqHandler->getAllParameters();
foreach ($params as $k => $v) {
$html .= "<input type=\"hidden\" name=\"{$k}\" value=\"{$v}\" />\n";
}
$html .= <<<eot
<input type="submit" value="财付通支付">
</form>
eot;
?>
示例6: dopay
public function dopay($money = null, $order = null, $ordername = null)
{
//取插件配置参数
$conf = F('pluginTenpay');
if (empty($conf) || APP_DEBUG) {
$data = M('Addons')->field('param')->where("mark='Tenpay'")->find();
$conf = json_decode($data['param'], true);
F('pluginTenpay', $conf);
}
define('SHANGHU_ID', $conf['partner']);
define('SHANGHU_KEY', $conf['key']);
require_once TENPAY_PATH . "/lib/classes/RequestHandler.class.php";
require_once TENPAY_PATH . "/lib/tenpay_config.php";
/* 获取提交的订单号 */
$out_trade_no = $order;
/* 获取提交的商品名称 */
$product_name = $ordername;
/* 获取提交的商品价格 */
$order_price = $money;
/* 获取提交的备注信息 */
$remarkexplain = '没有备注';
/* 支付方式 1:即时到帐,2:中介担保,3:后台选择*/
$trade_mode = 1;
$strDate = date("Ymd");
$strTime = date("His");
/* 商品价格(包含运费),以分为单位 */
$total_fee = $order_price * 100;
/* 商品名称 */
$desc = "商品:" . $product_name . ",备注:" . $remarkexplain;
/* 创建支付请求对象 */
$reqHandler = new RequestHandler();
$reqHandler->init();
$reqHandler->setKey($key);
$reqHandler->setGateUrl("https://gw.tenpay.com/gateway/pay.htm");
//----------------------------------------
//设置支付参数
//----------------------------------------
$reqHandler->setParameter("partner", $partner);
$reqHandler->setParameter("out_trade_no", $out_trade_no);
$reqHandler->setParameter("total_fee", $total_fee);
//总金额
$reqHandler->setParameter("return_url", $return_url);
$reqHandler->setParameter("notify_url", $notify_url);
$reqHandler->setParameter("body", $desc);
$reqHandler->setParameter("bank_type", "DEFAULT");
//银行类型,默认为财付通
//用户ip
$reqHandler->setParameter("spbill_create_ip", $_SERVER['REMOTE_ADDR']);
//客户端IP
$reqHandler->setParameter("fee_type", "1");
//币种
$reqHandler->setParameter("subject", $desc);
//商品名称,(中介交易时必填)
//系统可选参数
$reqHandler->setParameter("sign_type", "MD5");
//签名方式,默认为MD5,可选RSA
$reqHandler->setParameter("service_version", "1.0");
//接口版本号
$reqHandler->setParameter("input_charset", "utf-8");
//字符集
$reqHandler->setParameter("sign_key_index", "1");
//密钥序号
//业务可选参数
$reqHandler->setParameter("attach", "");
//附件数据,原样返回就可以了
$reqHandler->setParameter("product_fee", "");
//商品费用
$reqHandler->setParameter("transport_fee", "0");
//物流费用
$reqHandler->setParameter("time_start", date("YmdHis"));
//订单生成时间
$reqHandler->setParameter("time_expire", "");
//订单失效时间
$reqHandler->setParameter("buyer_id", "");
//买方财付通帐号
$reqHandler->setParameter("goods_tag", "");
//商品标记
$reqHandler->setParameter("trade_mode", $trade_mode);
//交易模式(1.即时到帐模式,2.中介担保模式,3.后台选择(卖家进入支付中心列表选择))
$reqHandler->setParameter("transport_desc", "");
//物流说明
$reqHandler->setParameter("trans_type", "1");
//交易类型
$reqHandler->setParameter("agentid", "");
//平台ID
$reqHandler->setParameter("agent_type", "");
//代理模式(0.无代理,1.表示卡易售模式,2.表示网店模式)
$reqHandler->setParameter("seller_id", "");
//卖家的商户号
//请求的URL
$reqUrl = $reqHandler->getRequestURL();
//获取debug信息,建议把请求和debug信息写入日志,方便定位问题
/**/
$debugInfo = $reqHandler->getDebugInfo();
$html = <<<eot
<form id="tenpay_form" action="{$reqHandler->getGateUrl()}" method="post" target="_blank">
eot;
$params = $reqHandler->getAllParameters();
foreach ($params as $k => $v) {
$html .= "<input type=\"hidden\" name=\"{$k}\" value=\"{$v}\" />\n";
//.........这里部分代码省略.........
示例7: get_payment_code
//.........这里部分代码省略.........
/* 获得订单的流水号,补零到10位 */
$sp_billno = $payment_notice_id;
$spbill_create_ip = $_SERVER['REMOTE_ADDR'];
/* 交易日期 */
$today = to_date($payment_notice['create_time'], 'YmdHis');
/* 将商户号+年月日+流水号 */
$out_trade_no = $payment_notice['notice_sn'];
/* 银行类型:支持纯网关和财付通 */
$bank_type = '0';
$desc = $subject;
$attach = $payment_info['config']['tencentpay_sign'];
/* 返回的路径 */
$return_url = $data_return_url;
/* 总金额 */
$total_fee = $money * 100;
/* 货币类型 */
$fee_type = '1';
/* 重写自定义签名 */
//$payment['magic_string'] = abs(crc32($payment['magic_string']));
/* 数字签名 */
/*$sign_text = "cmdno=" . $cmd_no . "&date=" . $today . "&bargainor_id=" . $payment_info['config']['tencentpay_id'] .
"&transaction_id=" . $transaction_id . "&sp_billno=" . $sp_billno .
"&total_fee=" . $total_fee . "&fee_type=" . $fee_type . "&return_url=" . $return_url .
"&attach=" . $attach . "&spbill_create_ip=" . $spbill_create_ip ."&key=" . $payment_info['config']['tencentpay_key'];
$sign = strtoupper(md5($sign_text));*/
$reqHandler = new RequestHandler();
$reqHandler->init();
$reqHandler->setKey($payment_info['config']['tencentpay_key']);
$reqHandler->setGateUrl("https://gw.tenpay.com/gateway/pay.htm");
//----------------------------------------
//设置支付参数
//----------------------------------------
$reqHandler->setParameter("partner", $payment_info['config']['tencentpay_id']);
$reqHandler->setParameter("out_trade_no", $out_trade_no);
$reqHandler->setParameter("total_fee", $total_fee);
//总金额
$reqHandler->setParameter("return_url", $return_url);
$reqHandler->setParameter("notify_url", $data_notify_url);
$reqHandler->setParameter("body", $desc);
$reqHandler->setParameter("bank_type", $bank_type);
//银行类型,默认为财付通
//用户ip
$reqHandler->setParameter("spbill_create_ip", get_client_ip());
//客户端IP
$reqHandler->setParameter("fee_type", $fee_type);
//币种
$reqHandler->setParameter("subject", $desc);
//商品名称,(中介交易时必填)
//系统可选参数
$reqHandler->setParameter("sign_type", "MD5");
//签名方式,默认为MD5,可选RSA
$reqHandler->setParameter("service_version", "1.0");
//接口版本号
$reqHandler->setParameter("input_charset", "utf-8");
//字符集
$reqHandler->setParameter("sign_key_index", "1");
//密钥序号
//业务可选参数
$reqHandler->setParameter("attach", $attach);
//附件数据,原样返回就可以了
$reqHandler->setParameter("product_fee", "");
//商品费用
$reqHandler->setParameter("transport_fee", "0");
//物流费用
$reqHandler->setParameter("time_start", $today);
//订单生成时间
$reqHandler->setParameter("time_expire", "");
//订单失效时间
$reqHandler->setParameter("buyer_id", "");
//买方财付通帐号
$reqHandler->setParameter("goods_tag", "");
//商品标记
$reqHandler->setParameter("trade_mode", $cmd_no);
//交易模式(1.即时到帐模式,2.中介担保模式,3.后台选择(卖家进入支付中心列表选择))
$reqHandler->setParameter("transport_desc", "");
//物流说明
$reqHandler->setParameter("trans_type", "1");
//交易类型
$reqHandler->setParameter("agentid", "");
//平台ID
$reqHandler->setParameter("agent_type", "");
//代理模式(0.无代理,1.表示卡易售模式,2.表示网店模式)
$reqHandler->setParameter("seller_id", "");
//卖家的商户号
//请求的URL
$reqUrl = $reqHandler->getRequestURL();
if ($_REQUEST['v'] == 1) {
$debugInfo = $reqHandler->getDebugInfo();
echo "<br/>" . $reqUrl . "<br/>";
echo "<br/>" . $debugInfo . "<br/>";
}
$payLinks = '<form style="text-align:center;" id="jumplink" action="' . $reqHandler->getGateUrl() . '" target="_self" style="margin:0px;padding:0px" method="post" >';
$params = $reqHandler->getAllParameters();
foreach ($params as $k => $v) {
$payLinks .= "<input type=\"hidden\" name=\"{$k}\" value=\"{$v}\" />\n";
}
$payLinks .= "正在连接支付接口...</form>";
$payLinks .= '<script type="text/javascript">document.getElementById("jumplink").submit();</script>';
return $payLinks;
}