Esempio n. 1
0
        public string ProcessNotify()
        {
            //如果有多个公众号支付,此处要取返回中的公众号ID,再取Key验证
            WxPayData notifyData = wxnotify.GetNotifyData();
            WxPayData res        = GetWxDataMod();

            //检查支付结果中transaction_id是否存在
            if (!notifyData.IsSet("out_trade_no"))
            {
                //若transaction_id不存在,则立即返回结果给微信支付后台
                res.SetValue("return_code", "FAIL");
                res.SetValue("return_msg", "支付结果中订单号不存在");
                ZLLog.L(ZLEnum.Log.pay, new M_Log()
                {
                    Action  = "支付平台异常",
                    Message = PayPlat + ",原因:支付结果中订单号不存在!XML:" + notifyData.ToXml()
                });
                return(res.ToXml());
            }
            string transaction_id = notifyData.GetValue("out_trade_no").ToString();
            //查询订单,判断订单真实性
            //if (!QueryOrder(transaction_id))
            //{
            //    //若订单查询失败,则立即返回结果给微信支付后台
            //    WxPayData res = GetWxDataMod();
            //    res.SetValue("return_code", "FAIL");
            //    res.SetValue("return_msg", "订单查询失败");
            //    ZLLog.L(ZLEnum.Log.pay, new M_Log()
            //    {
            //        Action = "支付平台异常",
            //        Message = PayPlat + ",支付单:" + transaction_id + ",原因:订单查询失败!XML:" + notifyData.ToXml()
            //    });
            //    return res.ToXml();
            //}
            //查询订单成功
            //else
            //{
            //}
            //未指定,则默认加载PC扫码配置
            M_Payment  pinfo  = payBll.SelModelByPayNo(notifyData.GetValue("out_trade_no").ToString());
            M_WX_APPID appMod = WxPayApi.Pay_GetByID(DataConvert.CLng(pinfo.PlatformInfo));

            notifyData.PayKey = appMod.Pay_Key;
            try
            {
                notifyData.CheckSign();
                PayOrder_Success(pinfo, notifyData);
            }
            catch (Exception ex)
            {
                ZLLog.L(ZLEnum.Log.pay, new M_Log()
                {
                    Action = PayPlat + "报错,支付单:" + transaction_id, Message = ex.Message + "||XML:" + notifyData.ToXml()
                });
            }
            res.SetValue("return_code", "SUCCESS");
            res.SetValue("return_msg", "OK");
            return(res.ToXml());
        }
Esempio n. 2
0
    public void ProcessNotify()
    {
        WxPayData notifyData = wxnotify.GetNotifyData();

        //检查支付结果中transaction_id是否存在
        if (!notifyData.IsSet("out_trade_no"))
        {
            //若transaction_id不存在,则立即返回结果给微信支付后台
            WxPayData res = new WxPayData();
            res.SetValue("return_code", "FAIL");
            res.SetValue("return_msg", "支付结果中微信订单号不存在");
            ZLLog.L(ZLEnum.Log.pay, new M_Log()
            {
                Action  = "支付平台异常",
                Message = "平台:微信,原因:支付结果中微信订单号不存在!"
            });
            Response.Write(res.ToXml());
            Response.End();
        }
        string transaction_id = notifyData.GetValue("out_trade_no").ToString();

        //查询订单,判断订单真实性
        if (!QueryOrder(transaction_id))
        {
            //若订单查询失败,则立即返回结果给微信支付后台
            WxPayData res = new WxPayData();
            res.SetValue("return_code", "FAIL");
            res.SetValue("return_msg", "订单查询失败");
            ZLLog.L(ZLEnum.Log.pay, new M_Log()
            {
                Action  = "支付平台异常",
                Message = "平台:微信,支付单:" + transaction_id + ",原因:订单查询失败!"
            });
            Response.Write(res.ToXml());
            Response.End();
        }
        //查询订单成功
        else
        {
            WxPayData res = new WxPayData();
            res.SetValue("return_code", "SUCCESS");
            res.SetValue("return_msg", "OK");
            try
            {
                PayOrder_Success(notifyData);
            }
            catch (Exception ex)
            {
                ZLLog.L(ZLEnum.Log.pay, new M_Log()
                {
                    Action = "微信支付报错,支付单:" + transaction_id, Message = ex.Message
                });
            }
            string result = res.ToXml();
            Response.Write(result);
            Response.End();
        }
    }
        public string ProcessNotify()
        {
            WxPayData notifyData = wxnotify.GetNotifyData(PlatConfig.WXPay_Key);

            //检查支付结果中transaction_id是否存在
            if (!notifyData.IsSet("out_trade_no"))
            {
                //若transaction_id不存在,则立即返回结果给微信支付后台
                WxPayData res = GetWxDataMod();
                res.SetValue("return_code", "FAIL");
                res.SetValue("return_msg", "支付结果中微信订单号不存在");
                ZLLog.L(ZLEnum.Log.pay, new M_Log()
                {
                    Action  = "支付平台异常",
                    Message = PayPlat + "原因:支付结果中微信订单号不存在!"
                });
                return(res.ToXml());
            }
            string transaction_id = notifyData.GetValue("out_trade_no").ToString();

            //查询订单,判断订单真实性
            if (!QueryOrder(transaction_id))
            {
                //若订单查询失败,则立即返回结果给微信支付后台
                WxPayData res = GetWxDataMod();
                res.SetValue("return_code", "FAIL");
                res.SetValue("return_msg", "订单查询失败");
                ZLLog.L(ZLEnum.Log.pay, new M_Log()
                {
                    Action  = "支付平台异常",
                    Message = PayPlat + ":支付单:" + transaction_id + ",原因:订单查询失败!"
                });
                return(res.ToXml());
            }
            //查询订单成功
            else
            {
                WxPayData res = GetWxDataMod();
                res.CheckSign();
                res.SetValue("return_code", "SUCCESS");
                res.SetValue("return_msg", "OK");
                try
                {
                    PayOrder_Success(notifyData);
                }
                catch (Exception ex)
                {
                    ZLLog.L(ZLEnum.Log.pay, new M_Log()
                    {
                        Action = PayPlat + ",支付单:" + transaction_id, Message = ex.Message
                    });
                }
                return(res.ToXml());
            }
        }
Esempio n. 4
0
    public string ProcessNotify()
    {
        //如果有多个公众号支付,此处要取返回中的公众号ID,再取Key验证
        WxPayData notifyData = wxnotify.GetNotifyData(WxPayApi.Pay_GetByID().Pay_Key);

        //检查支付结果中transaction_id是否存在
        if (!notifyData.IsSet("out_trade_no"))
        {
            //若transaction_id不存在,则立即返回结果给微信支付后台
            WxPayData res = GetWxDataMod();
            res.SetValue("return_code", "FAIL");
            res.SetValue("return_msg", "支付结果中订单号不存在");
            ZLLog.L(ZLEnum.Log.pay, new M_Log()
            {
                Action  = "支付平台异常",
                Message = PayPlat + ",原因:支付结果中订单号不存在!XML:" + notifyData.ToXml()
            });
            return(res.ToXml());
        }
        string transaction_id = notifyData.GetValue("out_trade_no").ToString();

        //查询订单,判断订单真实性
        if (!QueryOrder(transaction_id))
        {
            //若订单查询失败,则立即返回结果给微信支付后台
            WxPayData res = GetWxDataMod();
            res.SetValue("return_code", "FAIL");
            res.SetValue("return_msg", "订单查询失败");
            ZLLog.L(ZLEnum.Log.pay, new M_Log()
            {
                Action  = "支付平台异常",
                Message = PayPlat + ",支付单:" + transaction_id + ",原因:订单查询失败!XML:" + notifyData.ToXml()
            });
            return(res.ToXml());
        }
        //查询订单成功
        else
        {
            WxPayData res = GetWxDataMod();
            res.SetValue("return_code", "SUCCESS");
            res.SetValue("return_msg", "OK");
            try
            {
                PayOrder_Success(notifyData);
            }
            catch (Exception ex)
            {
                ZLLog.L(ZLEnum.Log.pay, new M_Log()
                {
                    Action = PayPlat + "报错,支付单:" + transaction_id, Message = ex.Message + "||XML:" + notifyData.ToXml()
                });
            }
            return(res.ToXml());
        }
    }