| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- <?php
- $payment_lang = array(
- 'name' => '优云宝微信支付',
- 'payId' => '商户号',
- //'merchantAppId'=> '商户APPID',
- 'payKey'=> '商户密钥',
- );
- $config = array(
- 'payId' => array(
- 'INPUT_TYPE' => '0',
- ), //商户编号
- /*'merchantAppId' => array(
- 'INPUT_TYPE' => '0',
- ), //商户APPID*/
- 'payKey' => array(
- 'INPUT_TYPE' => '0',
- ), //商户私钥
- );
- /* 模块的基本信息 */
- if (isset($read_modules) && $read_modules == true)
- {
- $module['class_name'] = 'Youyunwx';
- /* 名称 */
- $module['name'] = $payment_lang['name'];
- /* 支付方式:1:在线支付;0:线下支付 2:仅wap支付 3:仅app支付 4:兼容wap和app*/
- $module['online_pay'] = '4';
- /* 配送 */
- $module['config'] = $config;
-
- $module['lang'] = $payment_lang;
-
- $module['reg_url'] = 'http://www.youyunnet.com/';
-
- return $module;
- }
- // 支付模型
- require_once(APP_ROOT_PATH.'system/libs/payment.php');
- class Youyunwx_payment implements payment {
-
- public function get_payment_code($payment_notice_id)
- {
- $pay = array();
- $pay['is_wap'] = 1;//
- $pay['class_name'] = "Youyunwx";
- $pay['url'] = SITE_DOMAIN . APP_ROOT . '/mapi/index.php?ctl=pay&act=get_display_code&pay_code=Youyunwx¬ice_id=' . $payment_notice_id;
- $pay['sdk_code'] = array("pay_sdk_type" => "yjwap", "config" =>
- array(
- "url" => SITE_DOMAIN . APP_ROOT . '/mapi/index.php?ctl=pay&act=get_display_code&pay_code=Youyunwx¬ice_id=' . $payment_notice_id,
- "is_wap" => 1
- )
- );
- return $pay;
-
- }
- public function response($request)
- {
- }
- public function notify($request)
- {
- $payment = $GLOBALS['db']->getRow("select id,config from " . DB_PREFIX . "payment where class_name='Youyunwx'");
- $config = unserialize($payment['config']);
-
- $ddh = $request['ddh']; //支付宝订单号
-
- $key = $request['key']; //KEY验证
-
- $name = $_POST['name']; //备注信息 接收网关data 参数 支付订单号
-
- $lb = $_POST['lb']; //分类 =1 支付宝 =2财付通 =3 微信
-
- $money = $_POST['money'];//金额
-
- $paytime = $_POST['paytime'];//充值时间
-
- $key2 = $config['payKey'];//APPKEY 和云端和软件上面保持一致
- //回调签名校验
- if($key==$key2){
-
- //<--------------------------商户业务代码写在下方-------------------------->
- $payment_notice_sn = $name;
- $outer_notice_sn = $ddh;
- $payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where notice_sn = '" . $payment_notice_sn . "'");
- require_once APP_ROOT_PATH . "system/libs/cart.php";
- $rs = payment_paid($payment_notice['notice_sn'],$outer_notice_sn);
- if($rs['status']==1){
- echo "ok";
- } else {
- echo 'key error';
- }
- //<--------------------------商户业务代码写在上方-------------------------->
- //下方输出是告知ISPAY服务器业务受理成功,请不要修改下方输出内容,否则会导致重复通知,ISPAY服务器会在24小时内通知8次,输出SUCCESS则不再进行通知
- //echo "SUCCESS";
- }else{
- echo 'key error';
- exit;
- }
-
- }
- function get_display_code(){
- }
- public function display_code($payment_notice_id)
- {
- $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']));
- $config = unserialize($payment_info['config']);
- $order_sn = $payment_notice['notice_sn'];
-
-
- //商户编号
- $Request['pid'] = $config['payId'];
- //支付宝1 微信3 QQ钱包2
- $Request['lb'] = 3;
- //支付通道
- /*if (isset($_GET['payChannel'])) {
- $Request['payChannel'] = $_GET['payChannel'];
- } else {
- $Request['payChannel'] = "alipay";
- }
-
- $m_config = load_auto_cache("m_config");
- $title_name = $m_config['ticket_name'];
- if($title_name=='')
- $title_name = '虚拟印币';
- if(empty($title_name))
- {
- $title_name = "充值".round($payment_notice['money'],2)."元";
- }*/
-
- $post_url = "http://pay1.youyunnet.com/pay/";
- //订单标题
- //$Request['Subject'] = $title_name;
- //交易金额(单位分)
- $Request['money'] = intval($money);
- //随机生成订单号
- $Request['data'] = $order_sn;
- //附加数据(没有可不填)
- //$Request['attachData'] = "";
- //异步通知地址
- $Request['url'] = SITE_DOMAIN . '/callback/payment/youyunwx_notify.php';
- //客户端同步跳转通知地址
- //$Request['Return_url'] = SITE_DOMAIN .'/callback/payment/ispay_response.php';
- //签名(加密算法详见开发文档)
- //$Request['Sign'] = $Ispay -> Sign($Request);
-
- $payLinks = '<form id="payForm" name="form2" action="' . $post_url . '" method="post">';
- $payLinks .= '<input type="hidden" name="pid" id="pid" value="' . $Request['pid'] . '" />';
- $payLinks .= '<input type="hidden" name="lb" id="lb" value="' . $Request['lb'] . '"/>';
- //$payLinks .= '<input type="hidden" name="Subject" id="Subject" value="' . $Request['Subject'] . '"/>';
- $payLinks .= '<input type="hidden" name="money" id="money" value="' . $Request['money'] . '" />';
- $payLinks .= '<input type="hidden" name="data" id="data" value="' . $Request['data'] . '"/>';
- //$payLinks .= '<input type="hidden" name="attachData" id="attachData" value="' . $Request['attachData'] . '"/>';
- $payLinks .= '<input type="hidden" name="url" id="url" value="' . $Request['url'] . '"/>';
- //$payLinks .= '<input type="hidden" name="Return_url" id="Return_url" value="' . $Request['Return_url'] . '"/>';
- //$payLinks .= '<input type="hidden" name="Sign" id="Sign" value="' . $Request['Sign'] . '"/>';
- $payLinks .= '</form>';
- $payLinks .= '<script type="text/javascript">document.getElementById("payForm").submit();</script>';
- return $payLinks;
- }
- }
- ?>
|