예제 #1
0
 public function mobile_return()
 {
     import("@.ORG.pay.Tenpay.ResponseHandler");
     import("@.ORG.pay.Tenpay.WapResponseHandler");
     $resHandler = new WapResponseHandler();
     $resHandler->setKey($this->pay_config["pay_tenpay_partnerkey"]);
     if ($resHandler->isTenpaySign()) {
         $bargainor_id = $resHandler->getParameter("bargainor_id");
         $sp_billno = $resHandler->getParameter("sp_billno");
         $transaction_id = $resHandler->getParameter("transaction_id");
         $total_fee = $resHandler->getParameter("total_fee");
         $pay_result = $resHandler->getParameter("pay_result");
         if ("0" == $pay_result) {
             $order_id_arr = explode("_", $sp_billno);
             $order_param["pay_type"] = "tenpay";
             $order_param["is_mobile"] = "1";
             $order_param["order_type"] = $order_id_arr[0];
             $order_param["order_id"] = $order_id_arr[1];
             $order_param["third_id"] = $transaction_id;
             $order_param["pay_money"] = $total_fee / 100;
             return array("error" => 0, "order_param" => $order_param);
         } else {
             return array("error" => 1, "msg" => "支付错误:付款失败!请联系管理员。");
         }
     } else {
         return array("error" => 1, "msg" => "支付错误:认证签名失败!请联系管理员。");
     }
 }
예제 #2
0
<?php
require_once(dirname(dirname(dirname(__FILE__))) . '/app.php');
need_login(true);
import('qtenpay');
/* 创建支付应答对象 */
$resHandler = new WapResponseHandler();
$resHandler->setKey(trim($INI['qtenpay']['key']));
//判断签名
if($resHandler->isTenpaySign()) {
	//商户订单号
	$sp_billno = $resHandler->getParameter("sp_billno");
	//财付通交易单号
	$transaction_id = $resHandler->getParameter("transaction_id");
	//金额,以分为单位
	$total_fee = $resHandler->getParameter("total_fee");
	//支付结果
	$pay_result = $resHandler->getParameter("pay_result");
	if( "0" == $pay_result  ) {
		$out_trade_no =  $sp_billno;
		@list($_, $order_id, $city_id, $_) = explode('-', $out_trade_no, 4);
		if (Table::Fetch('pay', $out_trade_no)) die('success');
		$currency = 'CNY';
		$service = 'tenpay';
		$bank = '财付通';
		$order = Table::Fetch('order',$order_id);
		$total_fee = moneyit($order['origin'] - $login_user['money']);
		ZOrder::OnlineIt($order_id, $out_trade_no, $total_fee, $currency, $service, $bank,$transaction_id);
		redirect("../pay.php?id={$order_id}" );
	} else {
		$string =  "<br/>" . "支付失败" . "<br/>";
예제 #3
0
 public function return_url()
 {
     import("@.ORG.Tenpay.ResponseHandler");
     import("@.ORG.Tenpay.WapResponseHandler");
     /* 密钥 */
     $partner = $this->payConfig['partnerid'];
     $key = $this->payConfig['partnerkey'];
     /* 创建支付应答对象 */
     $resHandler = new WapResponseHandler();
     $resHandler->setKey($key);
     //判断签名
     if ($resHandler->isTenpaySign()) {
         //商户订单号
         $out_trade_no = $resHandler->getParameter("sp_billno");
         //财付通交易单号
         $transaction_id = $resHandler->getParameter("transaction_id");
         //金额,以分为单位
         $total_fee = $resHandler->getParameter("total_fee");
         //支付结果
         $pay_result = $resHandler->getParameter("pay_result");
         if ("0" == $pay_result) {
             $member_card_create_db = M('Member_card_create');
             $userCard = $member_card_create_db->where(array('token' => $this->token, 'wecha_id' => $this->wecha_id))->find();
             $member_card_set_db = M('Member_card_set');
             $thisCard = $member_card_set_db->where(array('id' => intval($userCard['cardid'])))->find();
             $set_exchange = M('Member_card_exchange')->where(array('cardid' => intval($thisCard['id'])))->find();
             //
             $arr['token'] = $this->token;
             $arr['wecha_id'] = $this->wecha_id;
             $arr['expense'] = intval($total_fee / 100);
             $arr['time'] = time();
             $arr['cat'] = 99;
             $arr['staffid'] = 0;
             $arr['score'] = intval($set_exchange['reward']) * $arr['expense'];
             M('Member_card_use_record')->add($arr);
             $userinfo_db = M('Userinfo');
             $thisUser = $userinfo_db->where(array('token' => $thisCard['token'], 'wecha_id' => $arr['wecha_id']))->find();
             $userArr = array();
             $userArr['total_score'] = $thisUser['total_score'] + $arr['score'];
             $userArr['expensetotal'] = $thisUser['expensetotal'] + $arr['expense'];
             $userinfo_db->where(array('token' => $thisCard['token'], 'wecha_id' => $arr['wecha_id']))->save($userArr);
             //
             $from = $_GET['from'];
             $from = $from ? $from : 'Groupon';
             $from = $from != 'groupon' ? $from : 'Groupon';
             switch (strtolower($from)) {
                 default:
                 case 'groupon':
                 case 'store':
                     $order_model = M('product_cart');
                     break;
                 case 'repast':
                     $order_model = M('Dish_order');
                     break;
                 case 'hotels':
                     $order_model = M('Hotels_order');
                     break;
                 case 'business':
                     $order_model = M('Reservebook');
                     break;
             }
             $thisOrder = $order_model->where(array('orderid' => $out_trade_no, 'token' => $this->token))->find();
             $order_model->where(array('orderid' => $out_trade_no))->setField('paid', 1);
             $this->redirect('?g=Wap&m=' . $from . '&a=payReturn&token=' . $_GET['token'] . '&wecha_id=' . $thisOrder['wecha_id'] . '&orderid=' . $out_trade_no);
         } else {
             //当做不成功处理
             $string = "<br/>" . "支付失败" . "<br/>";
             echo $string;
         }
     } else {
         $string = "<br/>" . "认证签名失败" . "<br/>";
         echo $string;
     }
 }
예제 #4
0
 public function return_url()
 {
     import("@.ORG.Tenpay.ResponseHandler");
     import("@.ORG.Tenpay.WapResponseHandler");
     /* 密钥 */
     $partner = $this->payConfig['partnerid'];
     $key = $this->payConfig['partnerkey'];
     /* 创建支付应答对象 */
     $resHandler = new WapResponseHandler();
     $resHandler->setKey($key);
     //判断签名
     if ($resHandler->isTenpaySign()) {
         //商户订单号
         $out_trade_no = $resHandler->getParameter("sp_billno");
         //财付通交易单号
         $transaction_id = $resHandler->getParameter("transaction_id");
         //金额,以分为单位
         $total_fee = $resHandler->getParameter("total_fee");
         //支付结果
         $pay_result = $resHandler->getParameter("pay_result");
         if ("0" == $pay_result) {
             //after
             $payHandel = new payHandle($_GET['token'], $_GET['from']);
             $orderInfo = $payHandel->afterPay($out_trade_no);
             $from = $payHandel->getFrom();
             $this->redirect('/index.php?g=Wap&m=' . $from . '&a=payReturn&token=' . $orderInfo['token'] . '&wecha_id=' . $orderInfo['wecha_id'] . '&orderid=' . $out_trade_no);
         } else {
             //当做不成功处理
             $string = "<br/>" . "支付失败" . "<br/>";
             echo $string;
         }
     } else {
         $string = "<br/>" . "认证签名失败" . "<br/>";
         echo $string;
     }
 }
예제 #5
0
<?php

error_reporting(0);
//---------------------------------------------------------
//财付通即时到帐支付页面回调示例,商户按照此文档进行开发即可
//---------------------------------------------------------
require_once "./classes/ResponseHandler.class.php";
require_once "./classes/WapResponseHandler.class.php";
/* 密钥 */
$key = "8934e7d15453e97507ef794cf7b0519d";
/* 创建支付应答对象 */
$resHandler = new WapResponseHandler();
$resHandler->setKey($key);
//判断签名
if ($resHandler->isTenpaySign()) {
    //商户订单号
    $bargainor_id = $resHandler->getParameter("bargainor_id");
    //财付通交易单号
    $transaction_id = $resHandler->getParameter("transaction_id");
    //金额,以分为单位
    $total_fee = $resHandler->getParameter("total_fee");
    //支付结果
    $pay_result = $resHandler->getParameter("pay_result");
    if ("0" == $pay_result) {
        $string = "<br/>" . "支付成功" . "<br/>";
    } else {
        //当做不成功处理
        $string = "<br/>" . "支付失败" . "<br/>";
    }
} else {
    $string = "<br/>" . "认证签名失败" . "<br/>";