/// <summary>
        /// 支付宝异步返回订单交易信息 post
        /// </summary>
        /// <param name="context">当前上下文</param>
        /// <returns></returns>
        public ZFBReturnPara_Model ZFBCallBack(HttpContext context)
        {
            ZFBReturnPara_Model zfbpara = new ZFBReturnPara_Model();
            zfbpara.iscallbacksuccess = false;
            SortedDictionary<string, string> sPara = GetRequestPost(context);
            if (sPara.Count > 0)
            {
                Com.Alipay.Notify aliNotify = new Com.Alipay.Notify();
                bool verifyResult = aliNotify.Verify(sPara, context.Request.Form["notify_id"], context.Request.Form["sign"]);
                if (verifyResult)//验证成功
                {
                    #region
                    //退款状态,付款成功 没有此参数
                    string refund_status = "refund_status".GetFormString();
                    //交易状态
                    string trade_status = "trade_status".GetFormString();

                    zfbpara.trade_no = context.Request.Form["trade_no"];
                    zfbpara.order_no = context.Request.Form["out_trade_no"];
                    zfbpara.total_fee = context.Request.Form["total_fee"];
                    zfbpara.ispaysuccess = ((trade_status == "TRADE_SUCCESS" || trade_status == "TRADE_FINISHED") && refund_status == "") ? true : false;
                    zfbpara.isallreturn = ((trade_status == "TRADE_SUCCESS" || trade_status == "TRADE_FINISHED") && refund_status == "REFUND_SUCCESS") ? true : false;
                    #endregion
                    zfbpara.iscallbacksuccess = true;
                    zfbpara.sendzfbcallbackmessage = "success";
                }
                else
                    zfbpara.sendzfbcallbackmessage = "fail";
            }
            else
                zfbpara.sendzfbcallbackmessage = "无通知参数";

            return zfbpara;
        }
        /// <summary>
        /// 支付宝 返回 前端订单交易信息 get
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public ZFBReturnPara_Model ZFBCallBack(HttpContext context, bool isTouch)
        {
            ZFBReturnPara_Model         zfbpara = new ZFBReturnPara_Model();
            Dictionary <string, string> sPara   = GetRequestInputStream(context);

            if (sPara.Count > 0)//判断是否有带返回参数
            {
                Com.Alipay.Touch.Notify aliNotify = new Com.Alipay.Touch.Notify();
                bool verifyResult = aliNotify.VerifyNotify(sPara, sPara["sign"]);

                if (verifyResult)//验证成功
                {
                    //XML解析notify_data数据
                    try
                    {
                        XmlDocument xmlDoc = new XmlDocument();
                        xmlDoc.LoadXml(sPara["notify_data"]);
                        //商户订单号
                        string out_trade_no = xmlDoc.SelectSingleNode("/notify/out_trade_no").InnerText;
                        //支付宝交易号
                        string trade_no = xmlDoc.SelectSingleNode("/notify/trade_no").InnerText;
                        //交易状态
                        string trade_status = xmlDoc.SelectSingleNode("/notify/trade_status").InnerText;
                        //交易状态
                        string total_fee = xmlDoc.SelectSingleNode("/notify/total_fee").InnerText;

                        if (trade_status == "TRADE_FINISHED" || trade_status == "TRADE_SUCCESS")
                        {
                            zfbpara.trade_no  = trade_no;
                            zfbpara.order_no  = out_trade_no;
                            zfbpara.total_fee = total_fee;

                            zfbpara.ispaysuccess           = (trade_status == "TRADE_SUCCESS" || trade_status == "TRADE_FINISHED") ? true : false;
                            zfbpara.isallreturn            = false;
                            zfbpara.iscallbacksuccess      = true;
                            zfbpara.sendzfbcallbackmessage = "success";
                        }
                        else
                        {
                            zfbpara.sendzfbcallbackmessage = "fail";
                        }
                    }
                    catch (Exception exc)
                    {
                        zfbpara.sendzfbcallbackmessage = exc.Message;
                    }
                }
                else//验证失败
                {
                    zfbpara.sendzfbcallbackmessage = "fail";
                }
            }
            else
            {
                zfbpara.sendzfbcallbackmessage = "无通知参数";
            }

            return(zfbpara);
        }
        /// <summary>
        /// 支付宝移动端返回签名认证
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public ZFBReturnPara_Model ZFBCallBack(HttpContext context, bool isTouch, bool isMobile)
        {
            ZFBReturnPara_Model zfbpara = new ZFBReturnPara_Model();

            zfbpara.iscallbacksuccess = false;
            SortedDictionary <string, string> sPara = GetRequestPost(context);

            if (sPara.Count > 0)
            {
                bool verifyResult = Com.Alipay.Touch.RSAFromPkcs8.verify(
                    Com.Alipay.Touch.RSAFromPkcs8.GetResponseMysign(sPara,
                                                                    Com.Alipay.Touch.Config.rsa_publickey, "RSA", "UTF-8")
                    , sPara["sign"],
                    Com.Alipay.Touch.Config.rsa_publickey, "UTF-8");

                if (verifyResult)//验证成功
                {
                    #region
                    //退款状态,付款成功 没有此参数
                    string refund_status = sPara["refund_status"];
                    //交易状态
                    string trade_status = sPara["trade_status"];

                    zfbpara.trade_no  = sPara["trade_no"];
                    zfbpara.order_no  = sPara["out_trade_no"];
                    zfbpara.total_fee = sPara["total_fee"];

                    zfbpara.ispaysuccess = ((trade_status == "TRADE_SUCCESS" || trade_status == "TRADE_FINISHED") && refund_status == "") ? true : false;
                    zfbpara.isallreturn  = ((trade_status == "TRADE_SUCCESS" || trade_status == "TRADE_FINISHED") && refund_status == "REFUND_SUCCESS") ? true : false;
                    #endregion
                    zfbpara.iscallbacksuccess      = true;
                    zfbpara.sendzfbcallbackmessage = "success";
                }
                else
                {
                    zfbpara.sendzfbcallbackmessage = "fail";
                }
            }
            else
            {
                zfbpara.sendzfbcallbackmessage = "无通知参数";
            }

            return(zfbpara);
        }
        /// <summary>
        /// 支付宝异步返回订单交易信息 post
        /// </summary>
        /// <param name="context">当前上下文</param>
        /// <returns></returns>
        public ZFBReturnPara_Model ZFBCallBack(HttpContext context)
        {
            ZFBReturnPara_Model zfbpara = new ZFBReturnPara_Model();

            zfbpara.iscallbacksuccess = false;
            SortedDictionary <string, string> sPara = GetRequestPost(context);

            if (sPara.Count > 0)
            {
                Com.Alipay.Notify aliNotify = new Com.Alipay.Notify();
                bool verifyResult           = aliNotify.Verify(sPara, context.Request.Form["notify_id"], context.Request.Form["sign"]);
                if (verifyResult)//验证成功
                {
                    #region
                    //退款状态,付款成功 没有此参数
                    string refund_status = "refund_status".GetFormString();
                    //交易状态
                    string trade_status = "trade_status".GetFormString();

                    zfbpara.trade_no     = context.Request.Form["trade_no"];
                    zfbpara.order_no     = context.Request.Form["out_trade_no"];
                    zfbpara.total_fee    = context.Request.Form["total_fee"];
                    zfbpara.ispaysuccess = ((trade_status == "TRADE_SUCCESS" || trade_status == "TRADE_FINISHED") && refund_status == "") ? true : false;
                    zfbpara.isallreturn  = ((trade_status == "TRADE_SUCCESS" || trade_status == "TRADE_FINISHED") && refund_status == "REFUND_SUCCESS") ? true : false;
                    #endregion
                    zfbpara.iscallbacksuccess      = true;
                    zfbpara.sendzfbcallbackmessage = "success";
                }
                else
                {
                    zfbpara.sendzfbcallbackmessage = "fail";
                }
            }
            else
            {
                zfbpara.sendzfbcallbackmessage = "无通知参数";
            }

            return(zfbpara);
        }
        /// <summary>
        /// 支付宝 返回 前端订单交易信息 get
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public ZFBReturnPara_Model ZFBReturn(HttpContext context)
        {
            ZFBReturnPara_Model zfbpara             = new ZFBReturnPara_Model();
            SortedDictionary <string, string> sPara = GetRequestGet(context);

            if (sPara.Count > 0)//判断是否有带返回参数
            {
                Com.Alipay.Notify aliNotify = new Com.Alipay.Notify();
                bool verifyResult           = aliNotify.Verify(sPara, context.Request.QueryString["notify_id"], context.Request.QueryString["sign"]);
                if (verifyResult)//验证成功
                {
                    #region
                    //交易状态
                    string trade_status = "trade_status".GetUrlString();

                    zfbpara.trade_no  = "trade_no".GetUrlString();
                    zfbpara.order_no  = "out_trade_no".GetUrlString();
                    zfbpara.total_fee = "total_fee".GetUrlString();

                    zfbpara.ispaysuccess = (trade_status == "TRADE_SUCCESS" || trade_status == "TRADE_FINISHED") ? true : false;
                    zfbpara.isallreturn  = false;
                    #endregion
                    zfbpara.iscallbacksuccess      = true;
                    zfbpara.sendzfbcallbackmessage = "success";
                }
                else
                {
                    zfbpara.sendzfbcallbackmessage = "fail";
                }
            }
            else
            {
                zfbpara.sendzfbcallbackmessage = "无通知参数";
            }

            return(zfbpara);
        }
        /// <summary>
        /// 支付宝移动端返回签名认证
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public ZFBReturnPara_Model ZFBCallBack(HttpContext context,bool isTouch,bool isMobile)
        {
            ZFBReturnPara_Model zfbpara = new ZFBReturnPara_Model();
            zfbpara.iscallbacksuccess = false;
            SortedDictionary<string, string> sPara = GetRequestPost(context);
            if (sPara.Count > 0)
            {
                bool verifyResult = Com.Alipay.Touch.RSAFromPkcs8.verify(
                    Com.Alipay.Touch.RSAFromPkcs8.GetResponseMysign(sPara, 
                    Com.Alipay.Touch.Config.rsa_publickey,"RSA","UTF-8")
                    ,sPara["sign"],
                    Com.Alipay.Touch.Config.rsa_publickey,"UTF-8"); 

                if (verifyResult)//验证成功
                {
                    #region
                    //退款状态,付款成功 没有此参数
                    string refund_status = sPara["refund_status"];
                    //交易状态
                    string trade_status = sPara["trade_status"];

                    zfbpara.trade_no = sPara["trade_no"];
                    zfbpara.order_no = sPara["out_trade_no"];
                    zfbpara.total_fee = sPara["total_fee"];

                    zfbpara.ispaysuccess = ((trade_status == "TRADE_SUCCESS" || trade_status == "TRADE_FINISHED") && refund_status == "") ? true : false;
                    zfbpara.isallreturn = ((trade_status == "TRADE_SUCCESS" || trade_status == "TRADE_FINISHED") && refund_status == "REFUND_SUCCESS") ? true : false;
                    #endregion
                    zfbpara.iscallbacksuccess = true;
                    zfbpara.sendzfbcallbackmessage = "success";
                }
                else
                    zfbpara.sendzfbcallbackmessage = "fail";
            }
            else
                zfbpara.sendzfbcallbackmessage = "无通知参数";

            return zfbpara;
        }
        /// <summary>
        /// 支付宝 返回 前端订单交易信息 get
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public ZFBReturnPara_Model ZFBCallBack(HttpContext context, bool isTouch)
        {
            ZFBReturnPara_Model zfbpara = new ZFBReturnPara_Model();
            Dictionary<string, string> sPara = GetRequestInputStream(context);
            if (sPara.Count > 0)//判断是否有带返回参数
            {
                Com.Alipay.Touch.Notify aliNotify = new Com.Alipay.Touch.Notify();
                bool verifyResult = aliNotify.VerifyNotify(sPara, sPara["sign"]);

                if (verifyResult)//验证成功
                {
                    //XML解析notify_data数据
                    try
                    {
                        XmlDocument xmlDoc = new XmlDocument();
                        xmlDoc.LoadXml(sPara["notify_data"]);
                        //商户订单号
                        string out_trade_no = xmlDoc.SelectSingleNode("/notify/out_trade_no").InnerText;
                        //支付宝交易号
                        string trade_no = xmlDoc.SelectSingleNode("/notify/trade_no").InnerText;
                        //交易状态
                        string trade_status = xmlDoc.SelectSingleNode("/notify/trade_status").InnerText;
                        //交易状态
                        string total_fee = xmlDoc.SelectSingleNode("/notify/total_fee").InnerText;

                        if (trade_status == "TRADE_FINISHED" || trade_status == "TRADE_SUCCESS")
                        {
                            zfbpara.trade_no = trade_no;
                            zfbpara.order_no = out_trade_no;
                            zfbpara.total_fee = total_fee;

                            zfbpara.ispaysuccess = (trade_status == "TRADE_SUCCESS" || trade_status == "TRADE_FINISHED") ? true : false;
                            zfbpara.isallreturn = false;
                            zfbpara.iscallbacksuccess = true;
                            zfbpara.sendzfbcallbackmessage = "success";
                        }
                        else
                        {
                            zfbpara.sendzfbcallbackmessage = "fail";
                        }

                    }
                    catch (Exception exc)
                    {
                        zfbpara.sendzfbcallbackmessage = exc.Message;
                    }

                }
                else//验证失败
                {
                    zfbpara.sendzfbcallbackmessage = "fail";
                }
            }
            else
            {
                zfbpara.sendzfbcallbackmessage = "无通知参数";
            }

            return zfbpara;

        }
        /// <summary>
        /// 支付宝 返回 前端订单交易信息 get
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public ZFBReturnPara_Model ZFBReturn(HttpContext context)
        {
            ZFBReturnPara_Model zfbpara = new ZFBReturnPara_Model();
            SortedDictionary<string, string> sPara = GetRequestGet(context);
            if (sPara.Count > 0)//判断是否有带返回参数
            {
                Com.Alipay.Notify aliNotify = new Com.Alipay.Notify();
                bool verifyResult = aliNotify.Verify(sPara, context.Request.QueryString["notify_id"], context.Request.QueryString["sign"]);
                if (verifyResult)//验证成功
                {
                    #region
                    //交易状态
                    string trade_status = "trade_status".GetUrlString();

                    zfbpara.trade_no = "trade_no".GetUrlString();
                    zfbpara.order_no = "out_trade_no".GetUrlString();
                    zfbpara.total_fee = "total_fee".GetUrlString();

                    zfbpara.ispaysuccess = (trade_status == "TRADE_SUCCESS" || trade_status == "TRADE_FINISHED") ? true : false;
                    zfbpara.isallreturn = false;
                    #endregion
                    zfbpara.iscallbacksuccess = true;
                    zfbpara.sendzfbcallbackmessage = "success";
                }
                else
                    zfbpara.sendzfbcallbackmessage = "fail";
            }
            else
                zfbpara.sendzfbcallbackmessage = "无通知参数";

            return zfbpara;

        }