Ejemplo n.º 1
0
        /// <summary>
        /// 订单退款
        /// </summary>
        /// <param name="transaction_Id">微信交易单号</param>
        /// <param name="orderNo">我们自己的单号</param>
        /// <param name="totalFee">订单金额(分)</param>
        /// <param name="refundNo">退款单号(我们自己定义)</param>
        /// <param name="refundFee">退款金额(分)</param>
        /// <returns></returns>
        public bool UnifiedOrderRefund(string transaction_Id, string orderNo, string totalFee, string refundNo, string refundFee)
        {
            UnifiedWxPayModel model    = UnifiedWxPayModel.CreateUnifiedModel(WeiXinConst.AppId, WeiXinConst.PartnerId, WeiXinConst.PartnerKey);
            string            postData = model.CreateOrderRefundXml(orderNo, transaction_Id, totalFee, refundNo, refundFee);

            //退款需要用到证书, 要配置WeiXineConst CertPath 和 CertPwd
            return(WeiXinHelper.Refund(postData, WeiXinConst.CertPath, WeiXinConst.CertPwd));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 到微信服务器查询 订单支付的结果 (jsapi支付返回ok,我们要判断下服务器支付状态,如果没有支付成功,到微信服务器查询)
        /// </summary>
        /// <param name="orderNo"></param>
        public bool QueryOrder(string orderNo)
        {
            //这里应先判断服务器 订单支付状态,如果接到通知,并已经支付成功,就不用 执行下面的查询了
            UnifiedWxPayModel        model   = UnifiedWxPayModel.CreateUnifiedModel(WeiXinConst.AppId, WeiXinConst.PartnerId, WeiXinConst.PartnerKey);
            UnifiedOrderQueryMessage message = WeiXinHelper.UnifiedOrderQuery(model.CreateOrderQueryXml(orderNo));

            //此处主动查询的结果,只做查询用(不能作为支付成功的依据)
            return(message.Success);
        }
Ejemplo n.º 3
0
        //
        // GET: /V3Jsapi/


        /// <summary>
        ///
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public ActionResult Pay()
        {
            string code        = "";                               //网页授权获得的code
            string orderNo     = "";                               //文档中的out_trade_no
            string description = "";                               //商品描述
            string totalFee    = "1";                              //订单金额(单位:分)
            string createIp    = "127.0.0.1";
            string notifyUrl   = "";                               //通知url
            string openId      = WeiXinHelper.GetUserOpenId(code); //通过网页授权code获取用户openid(或者之前有存储用户的openid 也可以直接拿来用)

            //prepayid 只有第一次支付时生成,如果需要再次支付,必须拿之前生成的prepayid。
            //也就是说一个orderNo 只能对应一个prepayid
            string prepayid = string.Empty;

            #region 之前生成过 prepayid,此处可略过

            //创建Model
            UnifiedWxPayModel model = UnifiedWxPayModel.CreateUnifiedModel(WeiXinConst.AppId, WeiXinConst.PartnerId, WeiXinConst.PartnerKey);

            //预支付
            UnifiedPrePayMessage result = WeiXinHelper.UnifiedPrePay(model.CreatePrePayPackage(description, orderNo, totalFee, createIp, notifyUrl, openId));

            if (result == null ||
                !result.ReturnSuccess ||
                !result.ResultSuccess ||
                string.IsNullOrEmpty(result.Prepay_Id))
            {
                throw new Exception("获取PrepayId 失败");
            }

            //预支付订单
            prepayid = result.Prepay_Id;

            #endregion

            //JSAPI 支付参数的Model
            PayModel payModel = new PayModel()
            {
                AppId     = model.AppId,
                Package   = string.Format("prepay_id={0}", prepayid),
                Timestamp = ((DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000).ToString(),
                Noncestr  = CommonUtil.CreateNoncestr(),
            };

            Dictionary <string, string> nativeObj = new Dictionary <string, string>();
            nativeObj.Add("appId", payModel.AppId);
            nativeObj.Add("package", payModel.Package);
            nativeObj.Add("timeStamp", payModel.Timestamp);
            nativeObj.Add("nonceStr", payModel.Noncestr);
            nativeObj.Add("signType", payModel.SignType);
            payModel.PaySign = model.GetCftPackage(nativeObj); //生成JSAPI 支付签名


            return(View(payModel));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 微信支付通知(貌似比较臃肿,待优化)
        /// </summary>
        /// <returns></returns>
        public void Notify()
        {
            ReturnMessage returnMsg = new ReturnMessage()
            {
                Return_Code = "SUCCESS", Return_Msg = ""
            };
            string        xmlString = GetXmlString(Request);
            NotifyMessage message   = null;

            try
            {
                //此处应记录日志
                message = HttpClientHelper.XmlDeserialize <NotifyMessage>(xmlString);

                #region 验证签名并处理通知
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(xmlString);

                Dictionary <string, string> dic = new Dictionary <string, string>();
                string sign = string.Empty;
                foreach (XmlNode node in doc.FirstChild.ChildNodes)
                {
                    if (node.Name.ToLower() != "sign")
                    {
                        dic.Add(node.Name, node.InnerText);
                    }
                    else
                    {
                        sign = node.InnerText;
                    }
                }

                UnifiedWxPayModel model = UnifiedWxPayModel.CreateUnifiedModel(WeiXinConst.AppId, WeiXinConst.PartnerId, WeiXinConst.PartnerKey);
                if (model.ValidateMD5Signature(dic, sign))
                {
                    //处理通知
                }
                else
                {
                    throw new Exception("签名未通过!");
                }

                #endregion
            }
            catch (Exception ex)
            {
                //此处记录异常日志
                returnMsg.Return_Code = "FAIL";
                returnMsg.Return_Msg  = ex.Message;
            }
            Response.Write(returnMsg.ToXmlString());
            Response.End();
        }
Ejemplo n.º 5
0
        public override void VerifyNotify(int timeout, PayeeInfo payee, GatewayInfo gateway)
        {
            if (param.Count < 1 ||
                string.IsNullOrWhiteSpace(gateway.Data) ||
                gateway.DataList.Count < 4)
            {
                this.OnNotifyVerifyFaild();
                log.AppendFormat(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " YSWL.Payment.PaymentInterface.WeChat.v3.WeChatNotify CHECK GATEWAY DATA 验证失败:" + gateway.DataList.Count);
                Core.Globals.WriteText(log);
                return;
            }

            //if ((((notify_id == null) || (partner == null) || (trade_state == null)) || ((transaction_id == null) ||
            //    (total_fee == null))) || (((out_trade_no == null) || (trade_mode == null))))
            //{
            //    this.OnNotifyVerifyFaild();

            //}
            //else if (!trade_mode.Equals("1") || !trade_state.Equals("0"))
            //{
            //    this.OnNotifyVerifyFaild();
            //}

            try
            {
                UnifiedWxPayModel model = UnifiedWxPayModel.CreateUnifiedModel(gateway.DataList[3], payee.Partner, payee.PrimaryKey);
                if (!model.ValidateMD5Signature(param, sign))
                {
                    log.AppendFormat(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " YSWL.Payment.PaymentInterface.WeChat.v3.WeChatNotify.OnNotifyVerifyFaild 验证失败:" + param + "|sign:" + sign);
                    this.OnNotifyVerifyFaild();
                }
                else
                {
                    //log.AppendFormat(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " YSWL.Payment.PaymentInterface.WeChat.v3.WeChatNotify.OnPaidToMerchant 处理通知成功!");
                    //处理通知
                    this.OnPaidToMerchant();
                }
            }
            catch (Exception ex)
            {
                //此处记录异常日志
                log.AppendFormat(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " YSWL.Payment.PaymentInterface.WeChat.v3.WeChatNotify.VerifyNotify 验证失败:" + ex.Message);
            }
            this.OnNotifyVerifyFaild();
            if (log.Length > 0)
            {
                Core.Globals.WriteText(log);
            }
        }
Ejemplo n.º 6
0
        public void ProcessRequest(HttpContext context)
        {
            string prepayid = string.Empty;

            if (context.Request["openid"] != null && context.Request["price"] != null && context.Request["title"] != null)
            {
                string orderNo     = DateTime.Now.ToString("yyyyMMddhhmmssfff");                                   //文档中的out_trade_no
                string description = context.Request["title"].ToString();                                          //商品描述
                string totalFee    = (Convert.ToDecimal(context.Request["price"].ToString()) * 100).ToString("0"); //订单金额(单位:分)
                string createIp    = "127.0.0.1";
                string notifyUrl   = "https://api.uifang.com/payway.ashx";                                         //通知url
                // string openId = WeiXinHelper.GetUserOpenId(code);//通过网页授权code获取用户openid(或者之前有存储用户的openid 也可以直接拿来用)
                createIp = "127.0.0.1";
                //   code = "031937cca83477222807bef025b247L";
                string openId = "";

                //openId = context.Request["openid"].ToString();
                openId = context.Request["openid"].ToString();
                // string openId = WeiXinHelper.GetUserOpenId(code);
                //prepayid 只有第一次支付时生成,如果需要再次支付,必须拿之前生成的prepayid。
                //也就是说一个orderNo 只能对应一个prepayid


                //创建Model
                UnifiedWxPayModel model = UnifiedWxPayModel.CreateUnifiedModel("wx65cd51f5b9c0cac6", "1491450372", "asd57491714asd57491714asd5749171");

                //预支付
                UnifiedPrePayMessage result = WeiXinHelper.UnifiedPrePay(model.CreatePrePayPackage(description, orderNo, totalFee, createIp, notifyUrl, openId));

                if (result == null ||
                    !result.ReturnSuccess ||
                    !result.ResultSuccess ||
                    string.IsNullOrEmpty(result.Prepay_Id))
                {
                    prepayid = result.Return_Msg.ToString();
                    //  viewdata.state = false;
                    //    viewdata.error = openId + "," + code + "," + "," + result.Return_Msg.ToString();
                }
                else
                {
                    //预支付订单
                    prepayid = result.Prepay_Id;
                    PayModel payModel = new PayModel()
                    {
                        AppId     = model.AppId,
                        Package   = string.Format("prepay_id={0}", prepayid),
                        Timestamp = ((DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000).ToString(),
                        Noncestr  = CommonUtil.CreateNoncestr(),
                    };
                    Dictionary <string, string> nativeObj = new Dictionary <string, string>();
                    nativeObj.Add("appId", payModel.AppId);
                    nativeObj.Add("package", payModel.Package);
                    nativeObj.Add("timeStamp", payModel.Timestamp);
                    nativeObj.Add("nonceStr", payModel.Noncestr);
                    nativeObj.Add("signType", payModel.SignType);
                    payModel.PaySign = model.GetCftPackage(nativeObj); //生成JSAPI 支付签名
                    payModel.OrderId = orderNo;
                    prepayid         = JsonConvert.SerializeObject(payModel);
                }
            }
            context.Response.ContentType = "text/plain";
            context.Response.Write(prepayid);
        }
Ejemplo n.º 7
0
        public override void SendRequest()
        {
            string action = HttpContext.Current.Request.QueryString["action"];

            if (string.IsNullOrWhiteSpace(action))
            {
                action = "show";
                //HttpContext.Current.Response.Write("NO ACTION");
                //HttpContext.Current.Response.End();
                //return;
            }
            action = action.ToLower();

            //Utils.WxPayHelper wxPayHelper = new Utils.WxPayHelper();
            ////先设置基本信息
            //wxPayHelper.SetAppId(this.appid);
            //wxPayHelper.SetAppKey(this.key2);
            //wxPayHelper.SetPartnerKey(this.key);
            //wxPayHelper.SetSignType("SHA1");
            ////设置请求package信息
            //wxPayHelper.SetParameter("bank_type", bank_type);
            //wxPayHelper.SetParameter("body", body); //商品描述
            //wxPayHelper.SetParameter("partner", partner); //partner 商户号
            //wxPayHelper.SetParameter("out_trade_no", out_trade_no); //商家订单号
            //wxPayHelper.SetParameter("total_fee", total_fee); //商品金额,以分为单位
            //wxPayHelper.SetParameter("fee_type", fee_type); //币种,1人民币
            //wxPayHelper.SetParameter("notify_url", notify_url);
            //wxPayHelper.SetParameter("spbill_create_ip", spbill_create_ip);//用户的公网ip,不是商户服务器IP
            //wxPayHelper.SetParameter("input_charset", input_charset);

            //System.Console.Out.WriteLine("生成app支付package:");
            //System.Console.Out.WriteLine(wxPayHelper.CreateAppPackage("test"));
            //System.Console.Out.WriteLine("生成jsapi支付package:");
            //string jsApiPackage = wxPayHelper.CreateBizPackage();
            //System.Console.Out.WriteLine(jsApiPackage);
            //System.Console.Out.WriteLine("生成原生支付url:");
            //System.Console.Out.WriteLine(wxPayHelper.CreateNativeUrl("abc"));
            //System.Console.Out.WriteLine("生成原生支付package:");
            //System.Console.Out.WriteLine(wxPayHelper.CreateNativePackage("0", "ok"));

            //DONE: 输出JS进行网关交互
            string resultJson;

            switch (action)
            {
            case "show":
                Configuration.GatewayProvider provider =
                    Configuration.PayConfiguration.GetConfig().Providers["wechat_v3"] as
                    Configuration.GatewayProvider;
                if (provider == null)
                {
                    resultJson = "{\"STATUS\":\"ERROR\",\"DATA\":\"GATEWAY PROVIDER NOT FOND\"}";
                    break;
                }

                //prepayid 只有第一次支付时生成,如果需要再次支付,必须拿之前生成的prepayid。
                //也就是说一个orderNo 只能对应一个prepayid
                string prepayid = string.Empty;

                #region 之前生成过 prepayid,此处可略过

                //创建Model
                UnifiedWxPayModel    model  = UnifiedWxPayModel.CreateUnifiedModel(this.appid, this.partner, this.key);
                UnifiedPrePayMessage result = UnifiedPrePay(model, TradeType.JSAPI);

                //预支付订单
                prepayid = result.Prepay_Id;

                #endregion

                //JSAPI 支付参数的Model
                PayModel payModel = new PayModel()
                {
                    AppId     = model.AppId,
                    Package   = string.Format("prepay_id={0}", prepayid),
                    Timestamp = ((DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000).ToString(),
                    Noncestr  = CommonUtil.CreateNoncestr()
                };

                Dictionary <string, string> nativeObj = new Dictionary <string, string>();
                nativeObj.Add("appId", payModel.AppId);
                nativeObj.Add("package", payModel.Package);
                nativeObj.Add("timeStamp", payModel.Timestamp);
                nativeObj.Add("nonceStr", payModel.Noncestr);
                nativeObj.Add("signType", payModel.SignType);
                payModel.PaySign = model.GetCftPackage(nativeObj);     //生成JSAPI 支付签名
                nativeObj.Add("paySign", payModel.PaySign);

                var    entries = nativeObj.Select(d => string.Format("\"{0}\":\"{1}\"", d.Key, d.Value));
                string data    = "{" + string.Join(",", entries.ToArray()) + "}";

                resultJson = "{\"STATUS\":\"SUCCESS\",\"DATA\":" + data + "}";

                this.RedirectToGateway(string.Format(CultureInfo.InvariantCulture,
                                                     HttpContext.Current.Server.HtmlDecode(provider.Attributes["urlFormat"]),
                                                     this.out_trade_no, this.gatewayInfo.Data, resultJson));
                return;

            case "app":
                Configuration.GatewayProvider providerApp =
                    Configuration.PayConfiguration.GetConfig().Providers["wechat_v3"] as
                    Configuration.GatewayProvider;
                if (providerApp == null)
                {
                    resultJson = "{\"STATUS\":\"ERROR\",\"DATA\":\"GATEWAY PROVIDER NOT FOND\"}";
                    break;
                }

                //prepayid 只有第一次支付时生成,如果需要再次支付,必须拿之前生成的prepayid。
                //也就是说一个orderNo 只能对应一个prepayid
                string prepayidApp = string.Empty;

                #region 之前生成过 prepayid,此处可略过

                //创建Model
                UnifiedWxPayModel    modelApp  = UnifiedWxPayModel.CreateUnifiedModel(this.appid, this.partner, this.key);
                UnifiedPrePayMessage resultApp = UnifiedPrePay(modelApp, TradeType.APP);

                //预支付订单
                prepayidApp = resultApp.Prepay_Id;

                #endregion

                //APP 支付参数的Model
                PayModel payModelApp = new PayModel()
                {
                    AppId = modelApp.AppId
                };
                Dictionary <string, string> nativeObjApp = new Dictionary <string, string>();
                nativeObjApp.Add("appid", modelApp.AppId);
                nativeObjApp.Add("partnerid", this.partner);
                nativeObjApp.Add("prepayid", prepayidApp);
                nativeObjApp.Add("package", "Sign=WXPay");
                nativeObjApp.Add("noncestr", CommonUtil.CreateNoncestr());
                nativeObjApp.Add("timestamp", ((DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000).ToString());
                payModelApp.PaySign = modelApp.GetCftPackage(nativeObjApp);     //生成APP 支付签名
                nativeObjApp.Add("sign", payModelApp.PaySign);

                var    entriesApp = nativeObjApp.Select(d => string.Format("\"{0}\":\"{1}\"", d.Key, d.Value));
                string dataApp    = "{" + string.Join(",", entriesApp.ToArray()) + "}";

                resultJson = "{\"STATUS\":\"SUCCESS\",\"DATA\":" + dataApp + "}";

                this.RedirectToGateway(string.Format(CultureInfo.InvariantCulture,
                                                     HttpContext.Current.Server.HtmlDecode(providerApp.Attributes["urlFormat"]),
                                                     this.out_trade_no, this.gatewayInfo.Data, resultJson));
                return;

            case "bizpackage":
                resultJson = "{\"STATUS\":\"ERROR\",\"DATA\":\"NotImplemented\"}";
                break;

            case "qr":
                Configuration.GatewayProvider providerQR =
                    Configuration.PayConfiguration.GetConfig().Providers["wechat_v3"] as
                    Configuration.GatewayProvider;
                if (providerQR == null)
                {
                    resultJson = "{\"STATUS\":\"ERROR\",\"DATA\":\"GATEWAY PROVIDER NOT FOND\"}";
                    break;
                }

                #region 生成统一支付

                //创建Model
                UnifiedWxPayModel    modelQR  = UnifiedWxPayModel.CreateUnifiedModel(this.appid, this.partner, this.key);
                UnifiedPrePayMessage resultQR = UnifiedPrePay(modelQR, TradeType.NATIVE);

                //返回二维码支付URL
                resultJson = "{\"STATUS\":\"SUCCESS\",\"DATA\":\"" + resultQR.Code_Url + "\",\"Result_Code\":\"" + resultQR.Result_Code + "\"}";
                #endregion
                break;

            default:
                resultJson = "{\"STATUS\":\"ERROR\",\"DATA\":\"NotImplemented\"}";
                break;
            }

            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.ContentType = "application/json";
            HttpContext.Current.Response.Write(resultJson);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 创建用户入会申请订单
        /// </summary>
        /// <param name="context"></param>
        private void LeaguerApplyCreateOrder(HttpContext context)
        {
            string goodsID       = context.Request["goodsid"];
            string goodsName     = context.Request["goodsname"];
            string goodsPrice    = context.Request["goodsprice"];
            string phone         = context.Request["phone"];
            string realName      = context.Request["realName"];
            string address       = context.Request["address"];
            string birthday      = context.Request["birthday"];
            string email         = context.Request["email"];
            string idCard        = context.Request["idcard"];
            string sex           = context.Request["sex"];
            string childName     = context.Request["childname"];
            string childBirthday = context.Request["childbirthday"];
            string childSex      = context.Request["childsex"];
            string openId        = context.Request["openId"];
            string avatarUrl     = context.Request["avatarUrl"];
            string wxNickName    = context.Request["wxNickName"];

            //验证参数完整性
            if (string.IsNullOrEmpty(goodsID) || goodsID == "undefined" || string.IsNullOrEmpty(goodsName) || goodsName == "undefined" || string.IsNullOrEmpty(goodsPrice) || goodsPrice == "undefined" || string.IsNullOrEmpty(phone) ||
                string.IsNullOrEmpty(realName) || string.IsNullOrEmpty(birthday) || string.IsNullOrEmpty(address) || string.IsNullOrEmpty(idCard) ||
                string.IsNullOrEmpty(sex))
            {
                context.Response.Write("{\"errMsg\":\"参数错误\"}");
                return;
            }

            IMallClient _client = new DefaultMallClient(Url, secretkey, appId);
            DTOLeaguerApplyCreateOrderVer1_2 rCreateOrder = new DTOLeaguerApplyCreateOrderVer1_2
            {
                BussinessID   = bussinessID,
                GoodsID       = goodsID,
                GoodsPrice    = decimal.Parse(goodsPrice),
                GoodsName     = goodsName,
                Address       = address,
                Birthday      = birthday,
                Email         = email,
                IDCard        = idCard,
                ChildName     = childName,
                ChildSex      = Int32.Parse(childSex),
                ChildBirthday = childBirthday,
                TPOrderNo     = Guid.NewGuid().ToString().Substring(0, 8),
                UserPass      = "******",
                Sex           = Int32.Parse(sex),
                RealName      = realName,
                Phone         = phone,
                OrderMoney    = decimal.Parse(goodsPrice),
                Summary       = "openid:" + openId + " wxNickName:" + wxNickName //+ " avatarUrl:" + avatarUrl,
            };

            //创建签名
            rCreateOrder.SetSign(rCreateOrder, appId, secretkey);
            //创建入会订单
            var rCreateOrderresponse = _client.Execute(rCreateOrder);

            if (rCreateOrderresponse.IsSuccess == false)
            {
                context.Response.Write("{\"errMsg\":\"" + rCreateOrderresponse.ResponseStatus.Message + "\"}");
                return;
            }

            #region 创建微信支付
            string orderNo     = rCreateOrder.TPOrderNo; //文档中的out_trade_no
            string description = rCreateOrder.GoodsName; //商品描述
            // Convert.ToDecimal(context.Request["price"].ToString()) * 100).ToString("0");//订单金额(单位:分)
            string totalFee = "1";                       //(rCreateOrderresponse.TotleMoney*100 ).ToString("0") ;

            string createIp  = "127.0.0.1";
            string notifyUrl = "https://api.uifang.com/payway.ashx"; //通知url
                                                                     // string openId = WeiXinHelper.GetUserOpenId(code);//通过网页授权code获取用户openid(或者之前有存储用户的openid 也可以直接拿来用)
            createIp = "127.0.0.1";
            //   code = "031937cca83477222807bef025b247L";
            // string openId = WeiXinHelper.GetUserOpenId(code);
            //prepayid 只有第一次支付时生成,如果需要再次支付,必须拿之前生成的prepayid。
            //也就是说一个orderNo 只能对应一个prepayid


            //创建Model
            UnifiedWxPayModel model = UnifiedWxPayModel.CreateUnifiedModel("wx65cd51f5b9c0cac6", partnerId, "asd57491714asd57491714asd5749171");

            //预支付
            UnifiedPrePayMessage result = WeiXinHelper.UnifiedPrePay(model.CreatePrePayPackage(description, orderNo, totalFee, createIp, notifyUrl, openId));
            string prepayid             = string.Empty;
            string resultStr            = string.Empty;
            if (result == null || !result.ReturnSuccess || !result.ResultSuccess || string.IsNullOrEmpty(result.Prepay_Id))
            {
                resultStr = result.Return_Msg.ToString();
                //  viewdata.state = false;
                //  viewdata.error = openId + "," + code + "," + "," + result.Return_Msg.ToString();
            }
            else
            {
                //预支付订单
                prepayid = result.Prepay_Id;
                PayModel payModel = new PayModel()
                {
                    AppId     = model.AppId,
                    Package   = string.Format("prepay_id={0}", prepayid),
                    Timestamp = ((DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000).ToString(),
                    Noncestr  = CommonUtil.CreateNoncestr(),
                };
                Dictionary <string, string> nativeObj = new Dictionary <string, string>();
                nativeObj.Add("appId", payModel.AppId);
                nativeObj.Add("package", payModel.Package);
                nativeObj.Add("timeStamp", payModel.Timestamp);
                nativeObj.Add("nonceStr", payModel.Noncestr);
                nativeObj.Add("signType", payModel.SignType);
                payModel.PaySign = model.GetCftPackage(nativeObj); //生成JSAPI 支付签名
                payModel.OrderId = orderNo;
                //之前返回的订单号
                payModel.MallOrderId = rCreateOrderresponse.OrderID;
                resultStr            = JsonConvert.SerializeObject(payModel);
            }
            #endregion
            context.Response.ContentType = "text/plain";
            context.Response.Write(resultStr);

            //context.Response.Write(JsonMapper.ToJson(rCreateOrderresponse));
        }