本文整理汇总了PHP中RequestHandler::getDebugInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP RequestHandler::getDebugInfo方法的具体用法?PHP RequestHandler::getDebugInfo怎么用?PHP RequestHandler::getDebugInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RequestHandler
的用法示例。
在下文中一共展示了RequestHandler::getDebugInfo方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: recharge
public function recharge(){
////////////////////////////////////
//参数数据
$total_fee =floatval($_POST['price']);
$total_fee1=$total_fee;
$total_fee =floatval($total_fee)*100;
$body = '会员充值';
$orderName=$body;
$out_trade_no = $this->user['id'].'_'.time();
$notify_url = C('site_url').U('Tenpay/notify_url');
//需http://格式的完整路径,不能加?id=123这类自定义参数
//页面跳转同步通知页面路径
$return_url = C('site_url').U('Tenpay/charge_return');
//
if(!$total_fee)exit('必须有价格才能支付');
import("@.ORG.TenpayComputer.RequestHandler");
$reqHandler = new RequestHandler();
$reqHandler->init();
$key=trim(C('tenpay_partnerkey'));
$partner=trim(C('tenpay_partnerid'));
$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", '财付通在线支付');
$reqHandler->setParameter("bank_type", "DEFAULT"); //银行类型,默认为财付通
//用户ip
$reqHandler->setParameter("spbill_create_ip", $_SERVER['REMOTE_ADDR']);//客户端IP
$reqHandler->setParameter("fee_type", "1"); //币种
$reqHandler->setParameter("subject",'member recharge'); //商品名称,(中介交易时必填)
//系统可选参数
$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();
//获取debug信息,建议把请求和debug信息写入日志,方便定位问题
/**/
$debugInfo = $reqHandler->getDebugInfo();
//
$data=M('Indent')->data(
array('uid'=>session('uid'),'month'=>0,'title'=>$body,'uname'=>'','gid'=>0,'create_time'=>time(),'indent_id'=>$out_trade_no,'price'=>$total_fee1))->add();
//
header('Location:'.$reqUrl);
}
示例2: json_encode
$sign = $reqHandler->createSHA1Sign($prePayParams);
$outparams['retcode'] = 0;
$outparams['retmsg'] = 'ok';
$outparams['appid'] = $APP_ID;
$outparams['noncestr'] = $nonce_str;
$outparams['package'] = $pack;
$outparams['prepayid'] = $prepayid;
$outparams['timestamp'] = $time_stamp;
$outparams['sign'] = $sign;
} else {
$outparams['retcode'] = -2;
$outparams['retmsg'] = '错误:获取prepayId失败';
}
} else {
$outparams['retcode'] = -1;
$outparams['retmsg'] = '错误:获取不到Token';
}
/**
=========================
输出参数列表
=========================
*/
//Json 输出
ob_clean();
echo json_encode($outparams);
//debug信息,注意参数含有特殊字符,需要JsEncode
if ($DEBUG_) {
echo PHP_EOL . '/*' . $reqHandler->getDebugInfo() . '*/';
}
?>
示例3: pay
public function pay()
{
////////////////////////////////////
//before
$orderid = $_GET['orderid'];
$payHandel = new payHandle($this->token, $_GET['from'], 'tenpayComputer');
$orderInfo = $payHandel->beforePay($orderid);
$price = $orderInfo['price'];
//参数数据
$orderName = $_GET['orderName'];
if (!$orderid) {
$orderid = $_GET['single_orderid'];
//单个订单
}
$notify_url = C('site_url') . '/index.php?g=Wap&m=TenpayComputer&a=notify_url';
//需http://格式的完整路径,不能加?id=123这类自定义参数
//页面跳转同步通知页面路径
$return_url = C('site_url') . '/index.php?g=Wap&m=TenpayComputer&a=return_url&token=' . $_GET['token'] . '&wecha_id=' . $_GET['wecha_id'] . '&from=' . $_GET['from'];
//
if (!$price) {
exit('必须有价格才能支付');
}
$total_fee = floatval($price) * 100;
import("@.ORG.TenpayComputer.RequestHandler");
$out_trade_no = $orderid;
$reqHandler = new RequestHandler();
$reqHandler->init();
$key = $this->payConfig['partnerkey'];
$partner = $this->payConfig['partnerid'];
$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", '财付通在线支付');
$reqHandler->setParameter("bank_type", "DEFAULT");
//银行类型,默认为财付通
//用户ip
$reqHandler->setParameter("spbill_create_ip", $_SERVER['REMOTE_ADDR']);
//客户端IP
$reqHandler->setParameter("fee_type", "1");
//币种
$reqHandler->setParameter("subject", 'weixin');
//商品名称,(中介交易时必填)
//系统可选参数
$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();
//获取debug信息,建议把请求和debug信息写入日志,方便定位问题
/**/
$debugInfo = $reqHandler->getDebugInfo();
header('Location:' . $reqUrl);
//echo "<br/>" . $reqUrl . "<br/>";
//echo "<br/>" . $debugInfo . "<br/>";
}
示例4:
//交易模式(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();
echo "<br/>" . $reqUrl . "<br/>";
echo "<br/>" . $debugInfo . "<br/>";
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>财付通即时到帐程序演示</title>
</head>
<body>
<br/><a href="<?php
echo $reqUrl;
?>
" target="_blank">财付通支付</a>
<form action="<?php
echo $reqHandler->getGateUrl();
示例5: pay
public function pay()
{
$orderid = $_GET['orderid'];
if (!$orderid) {
$orderid = $_GET['single_orderid'];
}
$payHandel = new payHandle($this->token, $_GET['from'], 'tenpayComputer');
$orderInfo = $payHandel->beforePay($orderid);
$price = $orderInfo['price'];
$orderName = $_GET['orderName'];
$notify_url = C('site_url') . '/index.php?g=Wap&m=TenpayComputer&a=notify_url';
if ($_GET['platform']) {
$return_url = C('site_url') . '/index.php?g=Wap&m=TenpayComputer&a=return_url&token=' . $_GET['token'] . '&wecha_id=' . $_GET['wecha_id'] . '&from=' . $_GET['from'] . '&pl=1';
}
else {
$return_url = C('site_url') . '/index.php?g=Wap&m=TenpayComputer&a=return_url&token=' . $_GET['token'] . '&wecha_id=' . $_GET['wecha_id'] . '&from=' . $_GET['from'];
}
if ($orderInfo['paid']) {
exit('您已经支付过此次订单!');
}
if (!$price) {
exit('必须有价格才能支付');
}
$total_fee = floatval($price) * 100;
import('@.ORG.TenpayComputer.RequestHandler');
$out_trade_no = $orderid;
$reqHandler = new RequestHandler();
$reqHandler->init();
$key = $this->payConfig['partnerkey'];
$partner = $this->payConfig['partnerid'];
$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', '财付通在线支付');
$reqHandler->setParameter('bank_type', 'DEFAULT');
$reqHandler->setParameter('spbill_create_ip', $_SERVER['REMOTE_ADDR']);
$reqHandler->setParameter('fee_type', '1');
$reqHandler->setParameter('subject', 'weixin');
$reqHandler->setParameter('sign_type', 'MD5');
$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);
$reqHandler->setParameter('transport_desc', '');
$reqHandler->setParameter('trans_type', '1');
$reqHandler->setParameter('agentid', '');
$reqHandler->setParameter('agent_type', '');
$reqHandler->setParameter('seller_id', '');
$reqUrl = $reqHandler->getRequestURL();
$debugInfo = $reqHandler->getDebugInfo();
header('Location:' . $reqUrl);
}
示例6: 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>';
}
示例7: web_pay
public function web_pay()
{
import("@.ORG.pay.TenpayComputer.RequestHandler");
$reqHandler = new RequestHandler();
$reqHandler->init();
$reqHandler->setKey($this->pay_config["pay_tenpay_partnerkey"]);
$reqHandler->setGateUrl("https://gw.tenpay.com/gateway/pay.htm");
$return_url = C("config.site_url") . "/index.php?c=Pay&a=return_url&pay_type=tenpay";
$notify_url = C("config.site_url") . "/index.php?c=Pay&a=notify_url&pay_type=tenpay";
$body = "订单编号:" . $this->order_info["order_id"];
$reqHandler->setParameter("partner", $this->pay_config["pay_tenpay_partnerid"]);
$reqHandler->setParameter("out_trade_no", $this->order_info["order_type"] . "_" . $this->order_info["order_id"]);
$reqHandler->setParameter("total_fee", floatval($this->pay_money * 100));
$reqHandler->setParameter("return_url", $return_url);
$reqHandler->setParameter("notify_url", $notify_url);
$reqHandler->setParameter("body", $body);
$reqHandler->setParameter("bank_type", "DEFAULT");
$reqHandler->setParameter("spbill_create_ip", get_client_ip());
$reqHandler->setParameter("fee_type", "1");
$reqHandler->setParameter("subject", "订单编号:" . $this->order_info["order_id"]);
$reqHandler->setParameter("sign_type", "MD5");
$reqHandler->setParameter("service_version", "1.0");
$reqHandler->setParameter("input_charset", "utf-8");
$reqHandler->setParameter("sign_key_index", "1");
$reqUrl = $reqHandler->getRequestURL();
$debugInfo = $reqHandler->getDebugInfo();
return array("error" => 0, "url" => $reqUrl);
}
示例8: config
public function config($config = null)
{
$this->config = $config;
$partner = $config['id'];
//财付通商户号
$key = $config['key'];
//财付通密钥
$return_url = $config['ReturnUrl'];
//显示支付结果页面,*替换成payReturnUrl.php所在路径
$notify_url = $config['NotifyUrl'];
//支付完成后的回调处理页面,*替换成payNotifyUrl.php所在路径
/* 获取提交的订单号 */
$out_trade_no = $config['code'];
/* 获取提交的商品名称 */
$product_name = $config['title'];
/* 获取提交的商品价格 */
$order_price = $config['money'];
/* 获取提交的备注信息 */
$remarkexplain = '';
/* 支付方式 */
$trade_mode = $config['type'];
/* 商品价格(包含运费),以分为单位 */
$total_fee = $order_price * 100;
/* 商品名称 */
//$desc = "商品:".$product_name.",备注:".$remarkexplain;
$desc = $product_name;
/* 创建支付请求对象 */
$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", $config['pay_bank']);
//银行类型,默认为财付通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
$this->url = $reqUrl = $reqHandler->getRequestURL();
//获取debug信息,建议把请求和debug信息写入日志,方便定位问题
$this->debugInfo = $debugInfo = $reqHandler->getDebugInfo();
}
示例9: get_payment_code
//.........这里部分代码省略.........
'sign' => $sign, // MD5签名
//'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/>";
}
$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 class='ui-button paybutton' rel='blue' type='submit'>前往财付通支付</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;
}
示例10: 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";
//.........这里部分代码省略.........
示例11: get_payment_code
public function get_payment_code($payment_notice_id)
{
require APP_ROOT_PATH . "system/payment/Tenpay/classes/RequestHandler.class.php";
$payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id);
$money = round($payment_notice['money'], 2);
$payment_info = $GLOBALS['db']->getRow("select id,config,logo from " . DB_PREFIX . "payment where id=" . intval($payment_notice['payment_id']));
$payment_info['config'] = unserialize($payment_info['config']);
$subject = $payment_notice['deal_name'] == "" ? "充值" . format_price($payment_notice['money']) : $payment_notice['deal_name'];
$data_return_url = get_domain() . APP_ROOT . '/index.php?ctl=payment&act=response&class_name=Tenpay';
$data_notify_url = get_domain() . APP_ROOT . '/index.php?ctl=payment&act=notify&class_name=Tenpay';
$cmd_no = '1';
/* 获得订单的流水号,补零到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/>";
//.........这里部分代码省略.........
示例12: RequestHandler
* 2.如出现无权访问的情况,则需开通相关api的访问权限
* *************************************************************************************
*
* @link https://www.zhongan.com
* @copyright Copyright (c) 2013 众安保险
*/
require_once 'classes/RequestHandler.class.php';
//如果报timestamp相关的错 需设置时区参数为Asia/Shanghai(东八区)
date_default_timezone_set('Asia/Shanghai');
try {
//初始化request,传入环境参数
//RequestHandler::ENV_TEST | RequestHandler::ENV_UAT | RequestHandler::ENV_PROD
$request = new RequestHandler(RequestHandler::ENV_TEST);
//可自行设定版本参数, 未设置时默认为1.0.0
$request->setVersion('1.0.0');
//组装请求业务参数,具体参数请查看对应的api文档
$params = array('identityNo' => '410482198209279874', 'userName' => '张三');
//获取请求结果,第一个参数为开放平台api的serviceName,第二个字段为开放平台api的业务级输入参数
//如果$res含有 errorCode和errorMsg字段,则说明该请求出现错误,需视情况作出处理
$res = $request->doRequest('zhongan.user.person.addByIdentityNo', $params);
print_r($res);
//如果请求有错误,可以获取debug信息追踪错误 (仅限test和uat环境, prod环境默认不添加debug信息)
$debugInfo = $request->getDebugInfo();
print_r($debugInfo);
//如果通过doRequest获取的请求结果不符合预期,可自行获取返回的原始业务参数进行后续处理
$rawBizContent = $request->getRawBizContent();
print_r($rawBizContent);
} catch (Exception $e) {
//可以在这里添加你的异常处理逻辑
print_r($e->getMessage());
}