当前位置: 首页>>代码示例>>PHP>>正文


PHP RequestHandler::init方法代码示例

本文整理汇总了PHP中RequestHandler::init方法的典型用法代码示例。如果您正苦于以下问题:PHP RequestHandler::init方法的具体用法?PHP RequestHandler::init怎么用?PHP RequestHandler::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RequestHandler的用法示例。


在下文中一共展示了RequestHandler::init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: intval

	/**
	 * 生成支付代码
	 * @param   array    $order       订单信息
	 * @param   array    $payment     支付方式信息
	 */
	function get_code($order,$payment){
		require_once 'requesthandler.class.php';
		/* 商户号 */
		$partner = $payment['tenpay_account'];

		/* 密钥 */
		$key = $payment['tenpay_key'];

		//订单号,此处用时间加随机数生成,商户根据自己情况调整,只要保持全局唯一就行
		$out_trade_no = $order['order_sn'];
		/* 财付通交易单号,规则为:10位商户号+8位时间(YYYYmmdd)+10位流水号 */

		//认证费用
		$money = intval(intval($order['order_amount']).'00');

		//附加数据 0-钻石会员,1-高级会员
		$attach = $order['order_type'];

		/* 创建支付请求对象 */
		$reqHandler = new RequestHandler();
		$reqHandler->init();
		$reqHandler->setKey($key);
		$reqHandler->setGateUrl($payment['gateurl']);

		//----------------------------------------
		//设置支付参数 
		//----------------------------------------
		$reqHandler->setParameter("total_fee",$money);  //总金额
		//用户ip
		$reqHandler->setParameter("spbill_create_ip",$_SERVER['REMOTE_ADDR']);//客户端IP
		$reqHandler->setParameter("return_url",$payment['returnurl']);//支付成功后返回
		$reqHandler->setParameter("partner",$partner);
		$reqHandler->setParameter("out_trade_no",$out_trade_no);			//用户订单号
//		$reqHandler->setParameter("transaction_id",$transaction_id);		//财付通交易单号
		$reqHandler->setParameter("notify_url",$payment['notifyurl']);//通知商户后台
		$reqHandler->setParameter("body",$order['subject']);
		$reqHandler->setParameter("bank_type", "DEFAULT");  	  //银行类型,默认为财付通
		$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", $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", "");               //商品标记
		$reqHandler->setParameter("agentid", "");                 //===========
		$reqHandler->setParameter("agent_type", "");			  //===========
		//请求的URL
		$reqUrl = $reqHandler->getRequestURL();
//		return $transaction_id;
		return $reqUrl;
	}
开发者ID:noikiy,项目名称:zays,代码行数:65,代码来源:tenpay.php

示例2: buildRequestForm

 function buildRequestForm($method, $button_name)
 {
     $reqHandler = new RequestHandler();
     $reqHandler->init();
     $reqHandler = $this->__inithandler($reqHandler);
     //待请求参数数组
     $reqHandler->createSign();
     $params = $reqHandler->getAllParameters();
     ksort($params);
     $sHtml = "<form id='tenpaysubmit' name='tenpaysubmit' action='" . $reqHandler->getGateUrl() . "' method='" . $method . "'>";
     while (list($key, $val) = each($params)) {
         $sHtml .= "<input type='hidden' name='" . $key . "' value='" . $val . "'/>";
     }
     //submit按钮控件请不要含有name属性
     $sHtml = $sHtml . "<input type='submit' value='" . $button_name . "'></form>";
     $sHtml = $sHtml . "<script>document.forms['tenpaysubmit'].submit();</script>";
     return $sHtml;
 }
开发者ID:fengsmith1988,项目名称:weixin-1,代码行数:18,代码来源:tenpay.class.php

示例3: pay

 public function pay()
 {
     if (empty($this->pay_config['pay_tenpay_partnerid']) || empty($this->pay_config['pay_tenpay_partnerkey'])) {
         return array('err_code' => 1, 'err_msg' => '财付通支付缺少配置信息!请联系管理员处理或选择其他支付方式。');
     }
     import('source.class.pay.Tenpay.RequestHandler');
     import('source.class.pay.Tenpay.client.ClientResponseHandler');
     import('source.class.pay.Tenpay.client.TenpayHttpClient');
     $reqHandler = new RequestHandler();
     $reqHandler->init();
     $reqHandler->setKey($this->pay_config['pay_tenpay_partnerkey']);
     $reqHandler->setGateUrl('http://wap.tenpay.com/cgi-bin/wappayv2.0/wappay_init.cgi');
     $httpClient = new TenpayHttpClient();
     $resHandler = new ClientResponseHandler();
     $callback_url = option('config.wap_site_url') . '/paycallback.php?orderno=' . $this->order_info['order_no_txt'];
     $notify_url = option('config.wap_site_url') . '/paynotice.php';
     $desc = '订单号:' . $this->order_info['order_no_txt'] . ';订单数量:' . $this->order_info['pro_num'];
     $reqHandler->setParameter('total_fee', floatval($this->order_info['total'] * 100));
     $reqHandler->setParameter('spbill_create_ip', $_SERVER['REMOTE_ADDR']);
     $reqHandler->setParameter('ver', '2.0');
     $reqHandler->setParameter('bank_type', '0');
     $reqHandler->setParameter('callback_url', $callback_url);
     $reqHandler->setParameter('bargainor_id', $this->pay_config['pay_tenpay_partnerid']);
     $reqHandler->setParameter('sp_billno', $this->order_info['trade_no']);
     $reqHandler->setParameter('notify_url', $notify_url);
     $reqHandler->setParameter('desc', $desc);
     $reqHandler->setParameter('attach', 'tenpay');
     $httpClient->setReqContent($reqHandler->getRequestURL());
     if ($httpClient->call()) {
         $resHandler->setContent($httpClient->getResContent());
         if ($resHandler->parameters['err_info']) {
             return array('err_code' => 1, 'err_msg' => '财付通异常返回:<b>' . $resHandler->parameters['err_info'] . '</b>');
         }
         $token_id = $resHandler->getParameter('token_id');
         $reqHandler->setParameter('token_id', $token_id);
         $reqUrl = 'http://wap.tenpay.com/cgi-bin/wappayv2.0/wappay_gate.cgi?token_id=' . $token_id;
         return array('err_code' => 0, 'url' => $reqUrl);
     } else {
         return array('err_code' => 1, 'err_msg' => '财付通信息校验失败,请重试。');
     }
 }
开发者ID:fkssei,项目名称:pigcms10,代码行数:41,代码来源:Tenpay.class.php

示例4: checkPay

 function checkPay($PassageInfo, $OrderInfo)
 {
     /* 商户号 */
     $partner = $PassageInfo['StagePartnerId'];
     /* 密钥 */
     $key = $PassageInfo['StageSecureCode'];
     //创建查询请求
     $queryReq = new RequestHandler();
     $queryReq->init();
     $queryReq->setKey($key);
     $queryReq->setGateUrl("https://gw.tenpay.com/gateway/normalorderquery.xml");
     $queryReq->setParameter("partner", $partner);
     $queryReq->setParameter("out_trade_no", $OrderInfo['OrderId']);
     //通信对象
     $httpClient = new TenpayHttpClient();
     $httpClient->setTimeOut(5);
     //设置请求内容
     $httpClient->setReqContent($queryReq->getRequestURL());
     //后台调用
     if ($httpClient->call()) {
         //设置结果参数
         $queryRes = new ClientResponseHandler();
         $queryRes->setContent($httpClient->getResContent());
         $queryRes->setKey($key);
         //判断签名及结果
         //只有签名正确,retcode为0,trade_state为0才是支付成功
         if ($queryRes->isTenpaySign() && $queryRes->getParameter("trade_state") == "0") {
             return true;
         } else {
             //错误时,返回结果可能没有签名,写日志trade_state、retcode、retmsg看失败详情。
             //echo "验证签名失败 或 业务错误信息:trade_state=" . $queryRes->getParameter("trade_state") . ",retcode=" . $queryRes->getParameter("retcode"). ",retmsg=" . $queryRes->getParameter("retmsg") . "<br/>" ;
             return false;
         }
     } else {
         //通信失败
         return false;
         //后台调用通信失败,写日志,方便定位问题
         //echo "<br>call err:" . $httpClient->getResponseCode() ."," . $httpClient->getErrInfo() . "<br>";
     }
     //获取debug信息,建议把debug信息写入日志,方便定位问题
     //echo $resHandler->getDebugInfo() . "<br>";
 }
开发者ID:eappl,项目名称:prototype,代码行数:42,代码来源:Tenpay.php

示例5: foreach

    /**
     * Process the payment and return the result
     **/
    function process_payment($order_id)
    {
        global $woocommerce;
        require_once "classes/RequestHandler.class.php";
        $order = new WC_Order($order_id);
        if (sizeof($order->get_items()) > 0) {
            foreach ($order->get_items() as $item) {
                if ($item['qty']) {
                    $item_names[] = $item['name'] . ' x ' . $item['qty'];
                }
            }
        }
        //////////////////////////////
        /* 商户号 */
        $partner = $this->tenpayUid;
        /* 密钥 */
        $key = $this->tenpayKey;
        //订单号,此处用时间加随机数生成,商户根据自己情况调整,只要保持全局唯一就行
        $out_trade_no = 'CIP' . $order_id;
        /* 创建支付请求对象 */
        $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", ($order->get_order_total() - $order->get_total_discount()) * 100);
        //总金额
        $reqHandler->setParameter("return_url", CI_WC_ALI_PATH . "/payReturnUrl.php");
        $reqHandler->setParameter("notify_url", CI_WC_ALI_PATH . "/payNotifyUrl.php");
        $reqHandler->setParameter("body", implode(',', $item_names));
        $reqHandler->setParameter("bank_type", "DEFAULT");
        //银行类型,默认为财付通
        //用户ip
        $reqHandler->setParameter("spbill_create_ip", $_SERVER['REMOTE_ADDR']);
        //客户端IP
        $reqHandler->setParameter("fee_type", "1");
        //币种
        $reqHandler->setParameter("subject", '');
        //商品名称,(中介交易时必填)
        //系统可选参数
        $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", "");
        //卖家的商户号
        $reqUrl = $reqHandler->getRequestURL();
        $html_text = '
	<script>window.location.href="' . $reqUrl . '"</script>';
        //param end
        $output = "\r\n\t\t\t<html>\r\n\t\t    <head>\r\n\t\t\t\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n\t\t        <title>正在前往财付通...</title>\r\n\t\t    </head>\r\n\t\t    <body>{$html_text}</body></html>";
        echo $output;
        exit;
        return array('result' => 'success', 'redirect' => $output);
    }
开发者ID:proj-2014,项目名称:vlan247-test-wp2,代码行数:91,代码来源:ciphp-wc-tenpay.php

示例6: houtai

 public function houtai()
 {
     $pay_type = $this->db->GetOne("SELECT * from `@#_pay` where `pay_class` = 'tenpay' and `pay_start` = '1'");
     $pay_type_key = unserialize($pay_type['pay_key']);
     $key = $pay_type_key['key']['val'];
     //支付KEY
     $partner = $pay_type_key['id']['val'];
     //支付商号ID
     /* 创建支付应答对象 */
     $resHandler = new ResponseHandler();
     $resHandler->setKey($key);
     //判断签名
     if (!$resHandler->isTenpaySign()) {
         echo "认证签名失败";
         exit;
     }
     //通知ID
     $notify_id = $resHandler->getParameter("notify_id");
     //通过通知ID查询,确保通知来至财付通
     //创建查询请求
     $queryReq = new RequestHandler();
     $queryReq->init();
     $queryReq->setKey($key);
     $queryReq->setGateUrl("https://gw.tenpay.com/gateway/simpleverifynotifyid.xml");
     $queryReq->setParameter("partner", $partner);
     $queryReq->setParameter("notify_id", $notify_id);
     //通信对象
     $httpClient = new TenpayHttpClient();
     $httpClient->setTimeOut(5);
     //设置请求内容
     $httpClient->setReqContent($queryReq->getRequestURL());
     //后台调用
     if ($httpClient->call()) {
         //设置结果参数
         $queryRes = new ClientResponseHandler();
         $queryRes->setContent($httpClient->getResContent());
         $queryRes->setKey($key);
     } else {
         echo "通信失败";
         exit;
     }
     //及时到账
     if ($resHandler->getParameter("trade_mode") == "1") {
         //只有签名正确,retcode为0,trade_state为0才是支付成功
         if ($queryRes->isTenpaySign() && $queryRes->getParameter("retcode") == "0" && $resHandler->getParameter("trade_state") == "0") {
             //log_result("即时到帐验签ID成功");
             //取结果参数做业务处理
             $out_trade_no = $resHandler->getParameter("out_trade_no");
             //财付通订单号
             $transaction_id = $resHandler->getParameter("transaction_id");
             //金额,以分为单位
             $total_fee = $resHandler->getParameter("total_fee");
             //如果有使用折扣券,discount有值,total_fee+discount=原请求的total_fee
             $discount = $resHandler->getParameter("discount");
             //------------------------------
             //处理业务开始
             //------------------------------
             //处理数据库逻辑
             //注意交易单不要重复处理
             //注意判断返回金额
             $total_fee_t = $total_fee / 100;
             $this->db->Autocommit_start();
             $dingdaninfo = $this->db->GetOne("select * from `@#_member_addmoney_record` where `code` = '{$out_trade_no}' and `money` = '{$total_fee_t}' and `status` = '未付款' for update");
             if (!$dingdaninfo) {
                 echo "fail";
                 exit;
             }
             $time = time();
             $up_q1 = $this->db->Query("UPDATE `@#_member_addmoney_record` SET `pay_type` = '财付通', `status` = '已付款' where `id` = '{$dingdaninfo['id']}' and `code` = '{$dingdaninfo['code']}'");
             $up_q2 = $this->db->Query("UPDATE `@#_member` SET `money` = `money` + {$total_fee_t} where (`uid` = '{$dingdaninfo['uid']}')");
             $up_q3 = $this->db->Query("INSERT INTO `@#_member_account` (`uid`, `type`, `pay`, `content`, `money`, `time`) VALUES ('{$dingdaninfo['uid']}', '1', '账户', '充值', '{$total_fee_t}', '{$time}')");
             if ($up_q1 && $up_q2 && $up_q3) {
                 $this->db->Autocommit_commit();
             } else {
                 $this->db->Autocommit_rollback();
                 echo "fail";
                 exit;
             }
             if (empty($dingdaninfo['scookies'])) {
                 echo "success";
                 exit;
             }
             $uid = $dingdaninfo['uid'];
             $scookies = unserialize($dingdaninfo['scookies']);
             $pay = System::load_app_class('pay', 'pay');
             $pay->scookie = $scookies;
             $ok = $pay->init($uid, $pay_type['pay_id'], 'go_record');
             //闪购商品
             if ($ok != 'ok') {
                 _setcookie('Cartlist', NULL);
                 echo "fail";
                 exit;
                 //商品购买失败
             }
             $check = $pay->go_pay(1);
             if ($check) {
                 $this->db->Query("UPDATE `@#_member_addmoney_record` SET `scookies` = '1' where `code` = '{$out_trade_no}' and `status` = '已付款'");
                 _setcookie('Cartlist', NULL);
                 echo "success";
                 exit;
//.........这里部分代码省略.........
开发者ID:ping199143,项目名称:1ydb,代码行数:101,代码来源:tenpay_url.action.php

示例7: pay

 public function pay()
 {
     import("@.ORG.Tenpay.RequestHandler");
     import("@.ORG.Tenpay.client.ClientResponseHandler");
     import("@.ORG.Tenpay.client.TenpayHttpClient");
     $partner = $this->payConfig['partnerid'];
     $key = $this->payConfig['partnerkey'];
     $orderid = $_GET['orderid'];
     if (!$orderid) {
         $orderid = $_GET['single_orderid'];
         //单个订单
     }
     $out_trade_no = $orderid;
     //before
     $payHandel = new payHandle($this->token, $_GET['from']);
     $orderInfo = $payHandel->beforePay($orderid);
     $price = $orderInfo['price'];
     //
     if (!$price) {
         exit('必须有价格才能支付');
     }
     $orderName = $_GET['orderName'];
     $total_fee = floatval($price);
     /* 创建支付请求对象 */
     $reqHandler = new RequestHandler();
     $reqHandler->init();
     $reqHandler->setKey($key);
     $reqHandler->setGateUrl("http://wap.tenpay.com/cgi-bin/wappayv2.0/wappay_init.cgi");
     $httpClient = new TenpayHttpClient();
     //应答对象
     $resHandler = new ClientResponseHandler();
     //----------------------------------------
     //设置支付参数
     //----------------------------------------
     $reqHandler->setParameter("total_fee", $total_fee * 100);
     //总金额
     //用户ip
     $reqHandler->setParameter("spbill_create_ip", $_SERVER['REMOTE_ADDR']);
     //客户端IP
     $reqHandler->setParameter("ver", "2.0");
     //版本类型
     $reqHandler->setParameter("bank_type", "0");
     //银行类型,财付通填写0
     $return_url = C('site_url') . '/index.php?g=Wap&m=Tenpay&a=return_url&token=' . $this->token . '&wecha_id=' . $this->wecha_id . '&from=' . $_GET['from'];
     $reqHandler->setParameter("callback_url", $return_url);
     //交易完成后跳转的URL
     $reqHandler->setParameter("bargainor_id", $partner);
     //商户号
     $reqHandler->setParameter("sp_billno", $out_trade_no);
     //商户订单号
     $notify_url = C('site_url') . '/index.php?g=Wap&m=Tenpay&a=notify_url';
     $reqHandler->setParameter("notify_url", $notify_url);
     //接收财付通通知的URL,需绝对路径
     $reqHandler->setParameter("desc", $orderName ? $orderName : 'wechat');
     $reqHandler->setParameter("attach", "");
     $httpClient->setReqContent($reqHandler->getRequestURL());
     //后台调用
     if ($httpClient->call()) {
         $resHandler->setContent($httpClient->getResContent());
         //获得的token_id,用于支付请求
         $token_id = $resHandler->getParameter('token_id');
         $reqHandler->setParameter("token_id", $token_id);
         //请求的URL
         //$reqHandler->setGateUrl("https://wap.tenpay.com/cgi-bin/wappayv2.0/wappay_gate.cgi");
         //此次请求只需带上参数token_id就可以了,$reqUrl和$reqUrl2效果是一样的
         //$reqUrl = $reqHandler->getRequestURL();
         $reqUrl = "http://wap.tenpay.com/cgi-bin/wappayv2.0/wappay_gate.cgi?token_id=" . $token_id;
     }
     header('Location:' . $reqUrl);
 }
开发者ID:d0oo0b,项目名称:wechatcms,代码行数:70,代码来源:TenpayAction.class.php

示例8: mobile_refund

 public function mobile_refund()
 {
     import("@.ORG.pay.Tenpay.RequestHandler");
     import("@.ORG.pay.Tenpay.client.ClientResponseHandler");
     import("@.ORG.pay.Tenpay.client.TenpayHttpClient");
     $reqHandler = new RequestHandler();
     $httpClient = new TenpayHttpClient();
     $resHandler = new ClientResponseHandler();
     $reqHandler = new RequestHandler();
     $reqHandler->init();
     $reqHandler->setKey($this->pay_config["pay_tenpay_partnerkey"]);
     $reqHandler->setGateUrl("https://gw.tenpay.com/gateway/normalrefundquery.xml");
     $httpClient = new TenpayHttpClient();
     $resHandler = new ClientResponseHandler();
     $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("input_charset", "utf-8");
     $httpClient->setTimeOut(30);
     $httpClient->setMethod("POST");
     $httpClient->setReqContent($reqHandler->getRequestURL());
     if ($httpClient->call()) {
         $resHandler->setContent($httpClient->getResContent());
         $resHandler->setKey($this->pay_config["pay_tenpay_partnerkey"]);
         if ($resHandler->isTenpaySign() && $resHandler->getParameter("retcode") == 0) {
             $refund_param["refund_id"] = $resHandler->getParameter("out_refund_no_0");
             $refund_param["refund_time"] = $refundResult["timestamp"];
             return array("error" => 0, "type" => "ok", "msg" => "退款申请成功!5到10个工作日款项会自动流入您支付时使用的银行卡内。", "refund_param" => $refund_param);
         } else {
             $refund_param["err_msg"] = "验证签名失败 或 业务错误信息:retcode= " . $resHandler->getParameter("retcode") . ",retmsg= " . $resHandler->getParameter("retmsg");
             $refund_param["refund_time"] = time();
             return array("error" => 1, "type" => "fail", "msg" => "退款申请失败!如果重试多次还是失败请联系系统管理员。", "refund_param" => $refund_param);
         }
     } else {
         $refund_param["err_msg"] = "call err:" . $httpClient->getResponseCode() . "," . $httpClient->getErrInfo();
         $refund_param["refund_time"] = time();
         return array("error" => 1, "type" => "fail", "msg" => "退款申请失败!如果重试多次还是失败请联系系统管理员。", "refund_param" => $refund_param);
     }
 }
开发者ID:belerweb,项目名称:pigcms,代码行数:38,代码来源:Tenpay.class.php

示例9: 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);
	}
开发者ID:kevicki,项目名称:pig,代码行数:69,代码来源:TenpayComputerAction.class.php

示例10: invite_payurl

function invite_payurl($amount, $price, &$orderid, $bank = 'DEFAULT')
{
    include_once DISCUZ_ROOT . './source/class/class_chinese.php';
    global $_G;
    $date = dgmdate(TIMESTAMP, 'YmdHis');
    $suffix = dgmdate(TIMESTAMP, 'His') . rand(1000, 9999);
    $transaction_id = DISCUZ_PARTNER . $date . $suffix;
    $orderid = dgmdate(TIMESTAMP, 'YmdHis') . random(14);
    $chinese = new Chinese(strtoupper(CHARSET), 'GBK');
    $subject = $chinese->Convert(lang('forum/misc', 'invite_forum_payment') . '_' . intval($amount) . '_' . lang('forum/misc', 'invite_forum_payment_unit') . '_(' . $_G['clientip'] . ')');
    $reqHandler = new RequestHandler();
    $reqHandler->setGateURL("https://gw.tenpay.com/gateway/pay.htm");
    $reqHandler->init();
    $reqHandler->setKey(DISCUZ_SECURITYCODE);
    $reqHandler->setParameter("partner", DISCUZ_PARTNER);
    $reqHandler->setParameter("out_trade_no", $orderid);
    $reqHandler->setParameter("total_fee", $price * 100);
    $reqHandler->setParameter("return_url", $_G['siteurl'] . 'api/trade/notify_invite.php');
    $reqHandler->setParameter("notify_url", $_G['siteurl'] . 'api/trade/notify_invite.php');
    $reqHandler->setParameter("body", $subject);
    $reqHandler->setParameter("bank_type", $bank);
    $reqHandler->setParameter("spbill_create_ip", $_G['clientip']);
    $reqHandler->setParameter("fee_type", "1");
    $reqHandler->setParameter("subject", $subject);
    $reqHandler->setParameter("sign_type", "MD5");
    $reqHandler->setParameter("service_version", "1.0");
    $reqHandler->setParameter("input_charset", "GBK");
    $reqHandler->setParameter("sign_key_index", "1");
    $reqHandler->setParameter("attach", "tenpay");
    $reqHandler->setParameter("time_start", $date);
    $reqHandler->setParameter("trade_mode", "1");
    $reqHandler->setParameter("trans_type", "1");
    $reqHandler->setParameter("agentid", DISCUZ_AGENTID);
    $reqHandler->setParameter("agent_type", "2");
    $reqUrl = $reqHandler->getRequestURL();
    return $reqUrl;
}
开发者ID:softhui,项目名称:discuz,代码行数:37,代码来源:api_tenpay.php

示例11: checkPay

 function checkPay($PassageInfo, $OrderInfo)
 {
     /* 商户号 */
     $partner = $PassageInfo['StagePartnerId'];
     /* 密钥 */
     $key = $PassageInfo['StageSecureCode'];
     //创建查询请求
     $queryReq = new RequestHandler();
     $queryReq->init();
     $queryReq->setKey($key);
     $queryReq->setGateUrl("https://gw.tenpay.com/gateway/normalorderquery.xml");
     $queryReq->setParameter("partner", $partner);
     $queryReq->setParameter("out_trade_no", $OrderInfo['OrderId']);
     //通信对象
     $httpClient = new TenpayHttpClient();
     $httpClient->setTimeOut(5);
     //设置请求内容
     $httpClient->setReqContent($queryReq->getRequestURL());
     //后台调用
     if ($httpClient->call()) {
         //设置结果参数
         $queryRes = new ClientResponseHandler();
         $queryRes->setContent($httpClient->getResContent());
         $queryRes->setKey($key);
         //判断签名及结果
         //只有签名正确,retcode为0,trade_state为0才是支付成功
         if ($queryRes->isTenpaySign()) {
             echo "here";
             //					//取结果参数做业务处理
             //					$out_trade_no = $queryRes->getParameter("out_trade_no");
             //					//财付通订单号
             //					$transaction_id = $queryRes->getParameter("transaction_id");
             //					//金额,以分为单位
             //					$total_fee = $queryRes->getParameter("total_fee");
             //					//如果有使用折扣券,discount有值,total_fee+discount=原请求的total_fee
             //					$discount = $queryRes->getParameter("discount");
             //
             //					if($OrderInfo['OrderId']==$out_trade_no)&&($total_fee==$Pay['Coin'])
             //					{
             //						$Pay['OrderId'] = $OrderInfo['OrderId'];
             //						$Pay['PayUserId'] = $OrderInfo['PayUserId'];
             //						$Pay['AcceptUserId'] = $OrderInfo['AcceptUserId'];
             //						$Pay['PassageId'] = $OrderInfo['PassageId'];
             //						$Pay['Amount'] = $OrderInfo['Amount'];
             //						$Pay['Coin'] = $OrderInfo['Coin'];
             //						$Pay['Credit'] = $OrderInfo['Credit'];
             //						$Pay['PayIP'] = $OrderInfo['PayIp'];
             //						$Pay['PayTime'] = $OrderInfo['PayTime'];
             //						$Pay['PayedTime'] = strtotime($queryRes->getParameter("time_end"));
             //						$Pay['StageOrder'] = $transaction_id;
             //						$Pay['comment'] = json_encode(array('bank_info'=>'bank_type'!="DEFAULT"?$queryRes->getParameter("bank_type")."|".$queryRes->getParameter("bank_billno"):"DEFAULT"));
             //						return $Pay;
             //					}
             //					else
             //					{
             //					 	return false;
             //					}
             //					//------------------------------
             //					//处理业务开始
             //					//------------------------------
             //
             //					//处理数据库逻辑
             //					//注意交易单不要重复处理
             //					//注意判断返回金额
             //
             //					//------------------------------
             //					//处理业务完毕
             //					//------------------------------
             //					echo "success";
         } else {
             //错误时,返回结果可能没有签名,写日志trade_state、retcode、retmsg看失败详情。
             //echo "验证签名失败 或 业务错误信息:trade_state=" . $queryRes->getParameter("trade_state") . ",retcode=" . $queryRes->getParameter("retcode"). ",retmsg=" . $queryRes->getParameter("retmsg") . "<br/>" ;
             echo "1fail";
         }
         //获取查询的debug信息,建议把请求、应答内容、debug信息,通信返回码写入日志,方便定位问题
         /*
         echo "<br>------------------------------------------------------<br>";
         echo "http res:" . $httpClient->getResponseCode() . "," . $httpClient->getErrInfo() . "<br>";
         echo "query req:" . htmlentities($queryReq->getRequestURL(), ENT_NOQUOTES, "GB2312") . "<br><br>";
         echo "query res:" . htmlentities($queryRes->getContent(), ENT_NOQUOTES, "GB2312") . "<br><br>";
         echo "query reqdebug:" . $queryReq->getDebugInfo() . "<br><br>" ;
         echo "query resdebug:" . $queryRes->getDebugInfo() . "<br><br>";
         */
     } else {
         //通信失败
         echo "2fail";
         //后台调用通信失败,写日志,方便定位问题
         //echo "<br>call err:" . $httpClient->getResponseCode() ."," . $httpClient->getErrInfo() . "<br>";
     }
     //获取debug信息,建议把debug信息写入日志,方便定位问题
     //echo $resHandler->getDebugInfo() . "<br>";
 }
开发者ID:eappl,项目名称:prototype,代码行数:92,代码来源:AliTel.php

示例12: get_payment_code

 public function get_payment_code($payment_notice_id)
 {
     require APP_ROOT_PATH . "system/payment/TenpayBank/classes/RequestHandler.class.php";
     $payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id);
     $order_sn = $GLOBALS['db']->getOne("select order_sn from " . DB_PREFIX . "deal_order where id = " . $payment_notice['order_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']);
     $data_return_url = SITE_DOMAIN . APP_ROOT . '/callback/payment/tenpayb_response.php';
     $data_notify_url = SITE_DOMAIN . APP_ROOT . '/callback/payment/tenpayb_notify.php';
     $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 = intval($GLOBALS['db']->getOne("select bank_id from " . DB_PREFIX . "deal_order where id = " . $payment_notice['order_id']));
     $desc = $out_trade_no;
     $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));
     
              交易参数 
             $parameter = array(
                 'cmdno'             => $cmd_no,                     // 业务代码, 财付通支付支付接口填  1
                 'date'              => $today,                      // 商户日期:如20051212
                 'bank_type'         => $bank_type,                  // 银行类型:支持纯网关和财付通
                 'desc'              => $desc,                       // 交易的商品名称
                 'purchaser_id'      => '',                          // 用户(买方)的财付通帐户,可以为空
                 'bargainor_id'      => $payment_info['config']['tencentpay_id'],  // 商家的财付通商户号
                 'transaction_id'    => $transaction_id,             // 交易号(订单号),由商户网站产生(建议顺序累加)
                 'sp_billno'         => $sp_billno,                  // 商户系统内部的定单号,最多10位
                 'total_fee'         => $total_fee,                  // 订单金额
                 'fee_type'          => $fee_type,                   // 现金支付币种
                 'return_url'        => $return_url,                 // 接收财付通返回结果的URL
                 'attach'            => $attach,                     // 用户自定义签名
             	'spbill_create_ip'  => $spbill_create_ip,           // 安全防范参数
                 '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);
     //商品名称,(中介交易时必填)
     //系统可选参数
//.........这里部分代码省略.........
开发者ID:macall,项目名称:jsd,代码行数:101,代码来源:TenpayBank_payment.php

示例13: notify

 /**
  * POST接收数据
  * 状态码说明  (0 交易完成 1 交易失败 2 交易超时 3 交易处理中 4 交易未支付 5交易取消 6交易发生错误)
  */
 public function notify()
 {
     /* 创建支付应答对象 */
     $resHandler = new ResponseHandler();
     $resHandler->setKey($this->config['key']);
     //判断签名
     if ($resHandler->isTenpaySign()) {
         //通知id
         $notify_id = $resHandler->getParameter("notify_id");
         //通过通知ID查询,确保通知来至财付通
         //创建查询请求
         $queryReq = new RequestHandler();
         $queryReq->init();
         $queryReq->setKey($this->config['key']);
         $queryReq->setGateUrl("https://gw.tenpay.com/gateway/simpleverifynotifyid.xml");
         $queryReq->setParameter("partner", $this->config['partner']);
         $queryReq->setParameter("notify_id", $notify_id);
         //通信对象
         $httpClient = new TenpayHttpClient();
         $httpClient->setTimeOut(5);
         //设置请求内容
         $httpClient->setReqContent($queryReq->getRequestURL());
         //后台调用
         if ($httpClient->call()) {
             //设置结果参数
             $queryRes = new ClientResponseHandler();
             $queryRes->setContent($httpClient->getResContent());
             $queryRes->setKey($this->config['key']);
             if ($resHandler->getParameter("trade_mode") == "1") {
                 //判断签名及结果(即时到帐)
                 //只有签名正确,retcode为0,trade_state为0才是支付成功
                 if ($queryRes->isTenpaySign() && $queryRes->getParameter("retcode") == "0" && $resHandler->getParameter("trade_state") == "0") {
                     $return_data['order_id'] = $resHandler->getParameter("out_trade_no");
                     $return_data['price'] = dround($resHandler->getParameter("total_fee") / 100);
                     $return_data['account'] = $resHandler->getParameter("partner");
                     $return_data['order_status'] = 0;
                     return $return_data;
                 } else {
                     //错误时,返回结果可能没有签名,写日志trade_state、retcode、retmsg看失败详情。
                     //echo "验证签名失败 或 业务错误信息:trade_state=" . $resHandler->getParameter("trade_state") . ",retcode=" . $queryRes-> getParameter("retcode"). ",retmsg=" . $queryRes->getParameter("retmsg") . "<br/>" ;
                     error_log(date('m-d H:i:s') . '| POST: ' . $queryRes->getParameter("retmsg") . ' |' . "\r\n", 3, LOG_PATH . 'tenpay_error_log.php');
                     return false;
                 }
             } elseif ($resHandler->getParameter("trade_mode") == "2") {
                 //判断签名及结果(中介担保)
                 //只有签名正确,retcode为0,trade_state为0才是支付成功
                 if ($queryRes->isTenpaySign() && $queryRes->getParameter("retcode") == "0") {
                     $return_data['order_id'] = $resHandler->getParameter("out_trade_no");
                     $return_data['price'] = dround($resHandler->getParameter("total_fee") / 100);
                     $return_data['account'] = $resHandler->getParameter("partner");
                     switch ($resHandler->getParameter("trade_state")) {
                         case 0:
                             $return_data['order_status'] = 3;
                             break;
                         case 1:
                             $return_data['order_status'] = 4;
                             break;
                         case 2:
                             $return_data['order_status'] = 4;
                             break;
                         case 4:
                             $return_data['order_status'] = 3;
                             break;
                         case 5:
                             $return_data['order_status'] = 0;
                             break;
                         case 6:
                             $return_data['order_status'] = 5;
                             break;
                         case 7:
                             $return_data['order_status'] = 3;
                             break;
                         case 8:
                             $return_data['order_status'] = 3;
                             break;
                         case 9:
                             $return_data['order_status'] = 5;
                             break;
                         case 10:
                             $return_data['order_status'] = 5;
                             break;
                         default:
                             $return_data['order_status'] = 5;
                     }
                     return $return_data;
                 } else {
                     //错误时,返回结果可能没有签名,写日志trade_state、retcode、retmsg看失败详情。
                     //echo "验证签名失败 或 业务错误信息:trade_state=" . $resHandler->getParameter("trade_state") . ",retcode=" . $queryRes->             										       getParameter("retcode"). ",retmsg=" . $queryRes->getParameter("retmsg") . "<br/>" ;
                     error_log(date('m-d H:i:s') . '| POST: ' . $queryRes->getParameter("retmsg") . ' |' . "\r\n", 3, LOG_PATH . 'tenpay_error_log.php');
                     return false;
                 }
             }
             //获取查询的debug信息,建议把请求、应答内容、debug信息,通信返回码写入日志,方便定位问题
             /*
             	echo "<br>------------------------------------------------------<br>";
             	echo "http res:" . $httpClient->getResponseCode() . "," . $httpClient->getErrInfo() . "<br>";
//.........这里部分代码省略.........
开发者ID:hutao1004,项目名称:yintt,代码行数:101,代码来源:Tenpay.class.php

示例14: tenpaynotice

 public function tenpaynotice()
 {
     require_once C('APP_ROOT') . "Lib/Pay/Tenpay/ResponseHandler.class.php";
     require_once C('APP_ROOT') . "Lib/Pay/Tenpay/RequestHandler.class.php";
     require_once C('APP_ROOT') . "Lib/Pay/Tenpay/client/ClientResponseHandler.class.php";
     require_once C('APP_ROOT') . "Lib/Pay/Tenpay/client/TenpayHttpClient.class.php";
     /* 创建支付应答对象 */
     $resHandler = new ResponseHandler();
     $resHandler->setKey($this->payConfig['tenpay']['mkey']);
     //Log::write('tenpay notice:'.print_r($resHandler->getAllParameters(), true), Log::DEBUG);
     //判断签名
     if ($resHandler->isTenpaySign()) {
         //通知id
         $notify_id = $resHandler->getParameter("notify_id");
         $tenpay_params = C('TENPAY_PARAMS');
         //通过通知ID查询,确保通知来至财付通
         //创建查询请求
         $queryReq = new RequestHandler();
         $queryReq->init();
         $queryReq->setKey($this->payConfig['tenpay']['mkey']);
         $queryReq->setGateUrl($tenpay_params["VERIFY_URL"]);
         $queryReq->setParameter("partner", $this->payConfig['tenpay']['MerCode']);
         $queryReq->setParameter("notify_id", $notify_id);
         $queryReq->setParameter("input_charset", "UTF-8");
         //通信对象
         $httpClient = new TenpayHttpClient();
         $httpClient->setTimeOut(5);
         //设置请求内容
         $httpClient->setReqContent($queryReq->getRequestURL());
         //后台调用
         if ($httpClient->call()) {
             //设置结果参数
             $queryRes = new ClientResponseHandler();
             $queryRes->setContent($httpClient->getResContent());
             $queryRes->setKey($this->payConfig['tenpay']['mkey']);
             //判断签名及结果
             //只有签名正确,retcode为0,trade_state为0才是支付成功
             if ($queryRes->isTenpaySign() && $queryRes->getParameter("retcode") == "0" && $queryRes->getParameter("trade_state") == "0" && $queryRes->getParameter("trade_mode") == "1") {
                 //取结果参数做业务处理
                 $out_trade_no = $queryRes->getParameter("out_trade_no");
                 //财付通订单号
                 $transaction_id = $queryRes->getParameter("transaction_id");
                 //金额,以分为单位
                 $total_fee = $queryRes->getParameter("total_fee");
                 //如果有使用折扣券,discount有值,total_fee+discount=原请求的total_fee
                 $discount = $queryRes->getParameter("discount");
                 //------------------------------
                 //处理业务开始
                 //------------------------------
                 //处理数据库逻辑
                 //注意交易单不要重复处理
                 //注意判断返回金额
                 $nid = $this->createnid("tenpay", $out_trade_no);
                 $done = $this->payDone(1, $nid, $transaction_id, "total_fee:" . $total_fee);
                 //------------------------------
                 //处理业务完毕
                 //------------------------------
                 echo "success";
             } else {
                 //错误时,返回结果可能没有签名,写日志trade_state、retcode、retmsg看失败详情。
                 //echo "验证签名失败 或 业务错误信息:trade_state=" . $queryRes->getParameter("trade_state") . ",retcode=" . $queryRes->getParameter("retcode"). ",retmsg=" . $queryRes->getParameter("retmsg") . "<br/>" ;
                 $out_trade_no = $resHandler->getParameter("out_trade_no");
                 $nid = $this->createnid("tenpay", $out_trade_no);
                 $done = $this->payDone(3, $nid, "", print_r($queryRes->getAllParameters(), true));
                 echo "fail";
             }
         } else {
             // 				$out_trade_no = $resHandler->getParameter("out_trade_no");
             // 				$nid = $this->createnid( "tenpay", $out_trade_no);
             // 				$done = $this->payDone(3,$nid, "", print_r($resHandler->getAllParameters(), true));
             //通信失败
             echo "fail";
             //后台调用通信失败,写日志,方便定位问题
             //echo "<br>call err:" . $httpClient->getResponseCode() ."," . $httpClient->getErrInfo() . "<br>";
             Log::write("tenpay notice:<br>call err:" . $httpClient->getResponseCode() . "," . $httpClient->getErrInfo(), Log::DEBUG);
         }
     } else {
         $out_trade_no = $resHandler->getParameter("out_trade_no");
         $transaction_id = $resHandler->getParameter("transaction_id");
         $nid = $this->createnid("tenpay", $out_trade_no);
         $done = $this->payDone(2, $nid, $transaction_id, print_r($resHandler->getAllParameters(), true));
         //回调签名错误
         echo "fail";
     }
 }
开发者ID:hutao1004,项目名称:yintt,代码行数:85,代码来源:PayAction.class.php

示例15: qpay_team_tenpay

/**
 * 通过财付通wap支付
 * @author abei <abei@qiang8.cn>
 */
function qpay_team_tenpay($total_money,$order){
	
	$total_money = $total_money*100;
	global $INI; if($total_money<=0||!$order) return null;
	$team = Table::Fetch('team', $order['team_id']);
	$pay_id = $order['pay_id'];
	
	/* 商户号 */
	$partner =  trim($INI['qtenpay']['partner']);
	/* 密钥 */
	$key = trim($INI['qtenpay']['key']);

	//订单号,此处用时间加随机数生成,商户根据自己情况调整,只要保持全局唯一就行
	$out_trade_no = $pay_id;
	/* 创建支付请求对象 */
	$reqHandler = new RequestHandler();
	$reqHandler->init();
	$reqHandler->setKey($key);

	$reqHandler->setGateUrl("http://wap.tenpay.com/cgi-bin/wappayv2.0/wappay_init.cgi");
	$httpClient = new TenpayHttpClient();
	//应答对象
	$resHandler = new ClientResponseHandler(); 
	//----------------------------------------
	//设置支付参数 
	//----------------------------------------
	//----------------------------------------
	$reqHandler->setParameter("total_fee", $total_money);  //总金额
	//用户ip
	$reqHandler->setParameter("spbill_create_ip", $_SERVER['REMOTE_ADDR']);//客户端IP
	$reqHandler->setParameter("ver", "2.0"); //版本类型
	$reqHandler->setParameter("bank_type", "0"); //银行类型,财付通填写0
	$reqHandler->setParameter("callback_url", "http://new.milituan.net/m/tenpay/call_back_url.php");//交易完成后跳转的URL
	
	$reqHandler->setParameter("bargainor_id", $partner); //商户号
	$reqHandler->setParameter("sp_billno", $out_trade_no); //商户订单号
	$reqHandler->setParameter("notify_url", "http://new.milituan.net/m/tenpay/notify_url.php");//接收财付通通知的URL,需绝对路径
	$reqHandler->setParameter("desc", $team['product']);

	$attach_str = $order['mobile'];
	$reqHandler->setParameter("attach",$attach_str );

	$httpClient->setReqContent($reqHandler->getRequestURL());

	if($httpClient->call()) {

		$resHandler->setContent($httpClient->getResContent());
		//var_dump($resHandler);
		//获得的token_id,用于支付请求
		$token_id = $resHandler->getParameter('token_id');
		$reqHandler->setParameter("token_id", $token_id);
		 
		//请求的URL
		//$reqHandler->setGateUrl("https://wap.tenpay.com/cgi-bin/wappayv2.0/wappay_gate.cgi");
		//此次请求只需带上参数token_id就可以了,$reqUrl和$reqUrl2效果是一样的
		//$reqUrl = $reqHandler->getRequestURL(); 
		$reqUrl = "http://wap.tenpay.com/cgi-bin/wappayv2.0/wappay_gate.cgi?token_id=".$token_id;
		
		return render('block_qpay_tenpay', array(
				'order_id' => $order_id,	
				'reqUrl'=>$reqUrl
			));
			
	}
} 
开发者ID:noikiy,项目名称:mdwp,代码行数:69,代码来源:pay.php


注:本文中的RequestHandler::init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。