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());
     }
 }
 public function get_payment_code($payment_notice_id)
 {
     include APP_ROOT_PATH . "system/payment/yeepay/yeepayMPay.php";
     $payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id);
     $order_sn = $payment_notice['notice_sn'];
     $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']);
     $sql = "select name " . "from " . DB_PREFIX . "deal " . "where id =" . intval($payment_notice['deal_id']);
     $title_name = $GLOBALS['db']->getOne($sql);
     $subject = $order_sn;
     $yeepay = new yeepayMPay($payment_info['config']['merchantaccount'], $payment_info['config']['merchantPublicKey'], $payment_info['config']['merchantPrivateKey'], $payment_info['config']['yeepayPublicKey']);
     //$notify_url = get_domain().APP_ROOT."/yeepay_web/alipayapi.php?order_id=".intval($payment_notice['order_id'])."&out_trade_no=".$order_sn;//."&out_trade_no={$data.walipay.out_trade_no}";
     $data_return_url = get_domain() . APP_ROOT . '/yeepay_web/yjwap_response.php';
     $data_notify_url = get_domain() . APP_ROOT . '/yeepay_web/yjwap_notify.php';
     $data_notify_url = str_replace("/sjmapi", "", $data_notify_url);
     $data_notify_url = str_replace("/mapi", "", $data_notify_url);
     $data_notify_url = str_replace("/wap", "", $data_notify_url);
     $data_return_url = str_replace("/sjmapi", "", $data_return_url);
     $data_return_url = str_replace("/mapi", "", $data_return_url);
     $data_return_url = str_replace("/wap", "", $data_return_url);
     $order_id = $order_sn;
     //网页支付的订单在订单有效期内可以进行多次支付请求,但是需要注意的是每次请求的业务参数都要一致,交易时间也要保持一致。否则会报错“订单与已存在的订单信息不符”
     $transtime = NOW_TIME;
     // time();//交易时间,是每次支付请求的时间,注意此参数在进行多次支付的时候要保持一致。
     $product_catalog = $payment_info['config']['productcatalog'];
     //商品类编码是我们业管根据商户业务本身的特性进行配置的业务参数。
     $identity_id = $payment_notice['user_id'];
     //用户身份标识,是生成绑卡关系的因素之一,在正式环境此值不能固定为一个,要一个用户有唯一对应一个用户标识,以防出现盗刷的风险且一个支付身份标识只能绑定5张银行卡
     $identity_type = 2;
     //支付身份标识类型码
     require_once APP_ROOT_PATH . 'system/extend/ip.php';
     $iplocation = new iplocate();
     $user_ip = $iplocation->getIP();
     //此参数不是固定的商户服务器IP,而是用户每次支付时使用的网络终端IP,否则的话会有不友好提示:“检测到您的IP地址发生变化,请注意支付安全”。
     $user_ua = $_SERVER['HTTP_USER_AGENT'];
     //'NokiaN70/3.0544.5.1 Series60/2.8 Profile/MIDP-2.0 Configuration/CLDC-1.1';//用户ua
     $callbackurl = $data_notify_url;
     //商户后台系统回调地址,前后台的回调结果一样
     $fcallbackurl = $data_return_url;
     //商户前台系统回调地址,前后台的回调结果一样
     $product_name = '订单号-' . $title_name;
     //出于风控考虑,请按下面的格式传递值:应用-商品名称,如“诛仙-3 阶成品天琊”
     $product_desc = '';
     //商品描述
     $terminaltype = 3;
     $terminalid = '';
     //其他支付身份信息
     $amount = $money * 100;
     //订单金额单位为分,支付时最低金额为2分,因为测试和生产环境的商户都有手续费(如2%),易宝支付收取手续费如果不满1分钱将按照1分钱收取。
     $url = $yeepay->webPay($order_id, $transtime, $amount, $product_catalog, $identity_id, $identity_type, $user_ip, $user_ua, $callbackurl, $fcallbackurl, $currency = 156, $product_name, $product_desc, $terminaltype, $terminalid, $orderexp_date = 60);
     $pay = array();
     $pay['subject'] = $subject;
     $pay['body'] = $title_name;
     $pay['total_fee'] = $money;
     $pay['total_fee_format'] = format_price($money);
     $pay['out_trade_no'] = $payment_notice['notice_sn'];
     $pay['notify_url'] = $url;
     $pay['is_wap'] = 1;
     $pay['pay_code'] = 'wyeepay';
     //,支付宝;mtenpay,财付通;mcod,货到付款
     return $pay;
 }
Exemple #5
0
 public function refund()
 {
     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"]);
     $refund_param = array();
     try {
         $refundResult = $yeepay->refund(floatval($this->pay_money * 100), $this->order_info["order_type"] . "_" . $this->order_info["order_id"], $this->order_info["third_id"]);
         $refund_param["refund_id"] = $refundResult["yborderid"];
         $refund_param["refund_time"] = $refundResult["timestamp"];
         return array("error" => 0, "type" => "ok", "msg" => "退款申请成功!5到10个工作日款项会自动流入您支付时使用的银行卡内。", "refund_param" => $refund_param);
     } catch (yeepayMPayException $e) {
         $refund_param["err_msg"] = "退款时发生错误!<br/>错误提示:" . $e->GetMessage() . "<br/>错误代码:" . $e->Getcode();
         $refund_param["refund_time"] = time();
         return array("error" => 1, "type" => "fail", "msg" => "退款申请失败!如果重试多次还是失败请联系系统管理员。", "refund_param" => $refund_param);
     }
 }
Exemple #6
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 #7
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:添加订单支付异常逻辑代码
}
Exemple #8
0
<?php

include "../yeepayMPay.php";
include "config.php";
$yeepay = new yeepayMPay($merchantaccount, $merchantPublicKey, $merchantPrivateKey, $yeepayPublicKey);
$order_id = create_str(15);
//网页支付的订单在订单有效期内可以进行多次支付请求,但是需要注意的是每次请求的业务参数都要一致,交易时间也要保持一致。否则会报错“订单与已存在的订单信息不符”
$transtime = time();
//交易时间,是每次支付请求的时间,注意此参数在进行多次支付的时候要保持一致。
$product_catalog = '1';
//商品类编码是我们业管根据商户业务本身的特性进行配置的业务参数。
$identity_id = create_str(15);
//用户身份标识,是生成绑卡关系的因素之一,在正式环境此值不能固定为一个,要一个用户有唯一对应一个用户标识,以防出现盗刷的风险且一个支付身份标识只能绑定5张银行卡
$identity_type = 0;
//支付身份标识类型码
$user_ip = '172.17.253.112';
//此参数不是固定的商户服务器IP,而是用户每次支付时使用的网络终端IP,否则的话会有不友好提示:“检测到您的IP地址发生变化,请注意支付安全”。
$user_ua = 'NokiaN70/3.0544.5.1 Series60/2.8 Profile/MIDP-2.0 Configuration/CLDC-1.1';
//用户ua
$callbackurl = 'http://mobiletest.yeepay.com/demo/pay/callback';
//商户后台系统回调地址,前后台的回调结果一样
$fcallbackurl = 'http://mobiletest.yeepay.com/demo/pay/callback';
//商户前台系统回调地址,前后台的回调结果一样
$product_name = '诛仙-3 阶成品天琊';
//出于风控考虑,请按下面的格式传递值:应用-商品名称,如“诛仙-3 阶成品天琊”
$product_desc = '钻石';
//商品描述
$terminaltype = 3;
$terminalid = '05-16-DC-59-C2-34';
//其他支付身份信息
$amount = 4;