Exemple #1
0
    public function CallbackVerify($payment)
    {
		unset($_POST['mod']);
		if($_POST){
			if (!class_exists('yeepayMPay')){
				include DRIVER_PATH.'payment/yeepay/yeepayMPay.php';
			}
			$yeepay = new yeepayMPay($payment);
			$this->ypreturn = $return = $yeepay->callback($_POST['data'], $_POST['encryptkey']);
			if(is_array($return) && $return['status'] == 1){
				$order = logic('order')->GetOne($return['orderid']);
				if($order && $order['paytype'] == $payment['id']){
					if($order['product']['type'] == 'ticket'){
						return 'TRADE_FINISHED';
					}else{
						return 'WAIT_SELLER_SEND_GOODS';
					}
				}else{
					return 'VERIFY_FAILED';
				}
			}else{
				return 'VERIFY_FAILED';
			}
		}else{
			return 'VERIFY_FAILED';
		}
    }
Exemple #2
0
 public function notice()
 {
     if (empty($this->pay_config['pay_yeepay_merchantaccount']) || empty($this->pay_config['pay_yeepay_merchantprivatekey']) || empty($this->pay_config['pay_yeepay_merchantpublickey']) || empty($this->pay_config['pay_yeepay_yeepaypublickey']) || empty($this->pay_config['pay_yeepay_productcatalog'])) {
         return array('err_code' => 1, 'err_msg' => '易宝支付缺少配置信息!请联系管理员处理或选择其他支付方式。');
     }
     import('source.class.pay.Yeepay.yeepayMPay');
     $yeepay = new yeepayMPay($this->pay_config['pay_yeepay_merchantaccount'], $this->pay_config['pay_yeepay_merchantpublickey'], $this->pay_config['pay_yeepay_merchantprivatekey'], $this->pay_config['pay_yeepay_yeepaypublickey']);
     try {
         $return = $yeepay->callback($_POST['data'], $_POST['encryptkey']);
         $order_param['trade_no'] = $return['orderid'];
         $order_param['pay_type'] = 'yeepay';
         $order_param['third_id'] = $return['yborderid'];
         $order_param['pay_money'] = $return['amount'] / 100;
         $order_param['third_data'] = $return;
         return array('err_code' => 0, 'order_param' => $order_param);
     } catch (yeepayMPayException $e) {
         return array('err_code' => 1, 'err_msg' => '支付时发生错误!<br/>错误提示:' . $e->GetMessage() . '<br/>错误代码:' . $e->Getcode());
     }
 }
 public function return_url()
 {
     import('@.ORG.Yeepay.yeepayMPay');
     $yeepay = new yeepayMPay($this->payConfig['merchantaccount'], $this->payConfig['merchantPublicKey'], $this->payConfig['merchantPrivateKey'], $this->payConfig['yeepayPublicKey']);
     try {
         $data = str_replace(' ', '+', $_GET['data']);
         $encryptkey = str_replace(' ', '+', $_GET['encryptkey']);
         $return = $yeepay->callback($data, $encryptkey);
         $database_yeepay_tmp = M('Yeepay_tmp');
         $condition_yeepay_tmp['id'] = str_replace('ORDER_', '', $return['orderid']);
         $yeepay_tmp = $database_yeepay_tmp->field(true)->where($condition_yeepay_tmp)->find();
         $_GET['platform'] = $yeepay_tmp['platform'];
         $payHandel = new payHandle($yeepay_tmp['token'], $yeepay_tmp['from'], 'yeepay');
         $orderInfo = $payHandel->afterPay($yeepay_tmp['order_id'], $return['yborderid']);
         $from = $payHandel->getFrom();
         unset($_SESSION['yeepay']);
         $this->redirect('/index.php?g=Wap&m=' . $from . '&a=payReturn&token=' . $orderInfo['token'] . '&wecha_id=' . $orderInfo['wecha_id'] . '&orderid=' . $yeepay_tmp['order_id']);
     } catch (yeepayMPayException $e) {
         $this->error('支付时发生错误!错误提示:' . $e->GetMessage() . ';错误代码:' . $e->Getcode());
     }
 }
Exemple #4
0
 public function return_url()
 {
     if ($this->pay_config["pay_yeepay_merchantaccount"] || $this->pay_config["pay_yeepay_merchantprivatekey"] || $this->pay_config["pay_yeepay_merchantpublickey"] || $this->pay_config["pay_yeepay_yeepaypublickey"] || $this->pay_config["pay_yeepay_productcatalog"]) {
         return array("error" => 1, "msg" => "易宝支付缺少配置信息!请联系管理员处理或选择其他支付方式。");
     }
     import("@.ORG.pay.Yeepay.yeepayMPay");
     $yeepay = new yeepayMPay($this->pay_config["pay_yeepay_merchantaccount"], $this->pay_config["pay_yeepay_merchantpublickey"], $this->pay_config["pay_yeepay_merchantprivatekey"], $this->pay_config["pay_yeepay_yeepaypublickey"]);
     try {
         $return = $yeepay->callback($_GET["data"], $_GET["encryptkey"]);
         $order_id_arr = explode("_", $return["orderid"]);
         $order_param["pay_type"] = "yeepay";
         $order_param["is_mobile"] = $this->is_mobile;
         $order_param["order_type"] = $order_id_arr[0];
         $order_param["order_id"] = $order_id_arr[1];
         $order_param["third_id"] = $return["yborderid"];
         $order_param["pay_money"] = $return["amount"] / 100;
         return array("error" => 0, "order_param" => $order_param);
     } catch (yeepayMPayException $e) {
         return array("error" => 1, "msg" => "支付时发生错误!<br/>错误提示:" . $e->GetMessage() . "<br/>错误代码:" . $e->Getcode());
     }
 }
Exemple #5
0
 public function notify($request)
 {
     $payment = $GLOBALS['db']->getRow("select id,config from " . DB_PREFIX . "payment where class_name='Yjpay'");
     $payment_info['config'] = unserialize($payment['config']);
     include "yeepay/yeepayMPay.php";
     /**
      *此类文件是有关回调的数据处理文件,根据易宝回调进行数据处理
      */
     $yeepay = new yeepayMPay($payment_info['config']['merchantaccount'], $payment_info['config']['merchantPublicKey'], $payment_info['config']['merchantPrivateKey'], $payment_info['config']['yeepayPublicKey']);
     try {
         $return = $yeepay->callback($_POST['data'], $_POST['encryptkey']);
         // TODO:添加订单处理逻辑代码
         /*
         名称 	中文说明 	数据类型 	描述
         merchantaccount 	商户账户 	string
         yborderid 	易宝交易流水号 	string
         orderid 	交易订单 	String
         amount 	支付金额 	int 	以“分”为单位的整型
         bankcode 	银行编码 	string 	支付卡所属银行的编码,如ICBC
         bank 	银行信息 	string 	支付卡所属银行的名称
         cardtype 	卡类型 	int 	支付卡的类型,1为借记卡,2为信用卡
         lastno 	卡号后4位 	string 	支付卡卡号后4位
         status 	订单状态 	int 	1:成功
         */
         $payment_notice_sn = $return['orderid'];
         $money = intval($return['amount'] / 100);
         $outer_notice_sn = $return['yborderid'];
         if ($return['amount'] == 1) {
             $payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where notice_sn = '" . $payment_notice_sn . "'");
             $order_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_order where id = " . $payment_notice['order_id']);
             require_once APP_ROOT_PATH . "system/libs/cart.php";
             $rs = payment_paid($payment_notice['id']);
             if ($rs) {
                 $rs = order_paid($payment_notice['order_id']);
                 if ($rs) {
                     //开始更新相应的outer_notice_sn
                     $GLOBALS['db']->query("update " . DB_PREFIX . "payment_notice set outer_notice_sn = '" . $outer_notice_sn . "' where id = " . $payment_notice['id']);
                     return 'success';
                 } else {
                     if ($order_info['pay_status'] == 2) {
                         return 'success';
                     } else {
                         return 'fail';
                     }
                 }
             } else {
                 return 'fail';
             }
         } else {
             return 'fail';
         }
     } catch (yeepayMPayException $e) {
         // TODO:添加订单支付异常逻辑代码
         return 'fail';
     }
 }
Exemple #6
0
<?php

include 'config.php';
include 'yeepay/yeepayMPay.php';
/**
*此类文件是有关回调的数据处理文件,根据易宝回调进行数据处理
*/
$yeepay = new yeepayMPay($merchantaccount, $merchantPublicKey, $merchantPrivateKey, $yeepayPublicKey);
try {
    $return = $yeepay->callback($_POST['data'], $_POST['encryptkey']);
    // TODO:添加订单处理逻辑代码
} catch (yeepayMPayException $e) {
    // TODO:添加订单支付异常逻辑代码
}