示例#1
0
        /// <summary>
        /// 添加到活跃表
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        private InnerResponse Insertliveteral(jmp_terminal model)
        {
            InnerResponse Inn = new InnerResponse();

            try
            {
                JMP.MDL.jmp_liveteral mo    = new JMP.MDL.jmp_liveteral(); //活跃实体类型
                JMP.BLL.jmp_liveteral hybll = new JMP.BLL.jmp_liveteral(); //活跃业务逻辑层
                mo.l_teral_key = model.t_key;
                mo.l_time      = DateTime.Now;
                mo.l_appid     = model.t_appid;
                int cg = 0;
                cg = hybll.Add(mo);
                if (cg > 0)
                {
                    Inn = Inn.InfoToResponse(InfoErrorCode.Code100);
                }
                else
                {
                    Inn = Inn.InfoToResponse(InfoErrorCode.Code101);
                }
            }
            catch (Exception e)
            {
                string bcxx = "报错提示" + e.Message + "报错对象:" + e.Source + "报错方法:" + e.TargetSite + "报错信息:" + e.ToString() + "报错位置:" + e.StackTrace.ToString();//报错信息
                //AddLocLog.AddLog(1, 4, "", "接口错误信息", "添加到活跃表,报错信息:" + bcxx);//写入报错日志
                PayApiGlobalErrorLogger.Log("添加到活跃表,报错信息:" + bcxx, summary: "接口错误信息");
                Inn = Inn.InfoToResponse(InfoErrorCode.Code101);
            }

            return(Inn);
        }
示例#2
0
        /// <summary>
        /// 验证签名和订单有效性
        /// </summary>
        /// <param name="mod">查询到的订单实体</param>
        /// <param name="mode">接收到的参数实体</param>
        /// <returns></returns>
        private InnerResponse checkSign(PayBankModels mode, JMP.MDL.jmp_order mod)
        {
            InnerResponse Inn         = new InnerResponse();
            int           bizcodeTime = Int32.Parse(ConfigurationManager.AppSettings["bizcodeTime"]);

            //规则=JMP.TOOL.MD5.md5strGet((mod.o_code + mod.o_price), true).ToUpper();
            if (!VerificationCode(mode.code, bizcodeTime, mod.o_app_id))
            {
                return(Inn = Inn.ToResponse(ErrorCode.Code8988));
            }
            string sign = JMP.TOOL.MD5.md5strGet((mod.o_code + mode.price), true).ToUpper();

            if (mode.price == mod.o_price && sign == mode.sign)
            {
                int  szsj = int.Parse(ConfigurationManager.AppSettings["EffectiveTime"].ToString());
                bool pdsj = DateTime.ParseExact(mode.code.Substring(0, 14), "yyyyMMddHHmmss", CultureInfo.InvariantCulture) > DateTime.Parse(DateTime.Now.AddMinutes(-(szsj)).ToString("yyyy-MM-dd HH:mm:ss")) ? true : false;//判断是否在规定时间范围内
                if (pdsj == false)
                {
                    Inn = Inn.ToResponse(ErrorCode.Code8992);
                }
                else
                {
                    Inn = Inn.ToResponse(ErrorCode.Code100);
                }
            }
            else
            {
                Inn = Inn.ToResponse(ErrorCode.Code9989);
            }
            return(Inn);
        }
示例#3
0
        /// <summary>
        ///添加到终端属性表
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        private InnerResponse InsertNew(jmp_terminal model)
        {
            InnerResponse Inn = new InnerResponse();

            try
            {
                model.t_time = DateTime.Now;
                int cg = 0;
                JMP.BLL.jmp_terminal zdbll = new JMP.BLL.jmp_terminal();//终端属性业务逻辑层
                cg = zdbll.Add(model);
                if (cg > 0)
                {
                    Inn = Inn.InfoToResponse(InfoErrorCode.Code100);
                }
                else
                {
                    Inn = Inn.InfoToResponse(InfoErrorCode.Code101);
                }
            }
            catch (Exception e)
            {
                string bcxx = "报错提示" + e.Message + "报错对象:" + e.Source + "报错方法:" + e.TargetSite + "报错信息:" + e.ToString() + "报错位置:" + e.StackTrace.ToString();//报错信息
                //AddLocLog.AddLog(1, 4, "", "接口错误信息", "添加到终端属性表,报错信息:" + bcxx);//写入报错日志
                PayApiGlobalErrorLogger.Log("添加到终端属性表,报错信息:" + bcxx, summary: "接口错误信息");
                Inn = Inn.InfoToResponse(InfoErrorCode.Code101);
            }

            return(Inn);
        }
示例#4
0
 /// <summary>
 /// 初始化接口返回参数方法
 /// </summary>
 /// <param name="response">接受参数实体</param>
 /// <param name="errorCode">参数接口枚举</param>
 /// <returns></returns>
 public static InnerResponse InfoToResponse(this InnerResponse response, InfoErrorCode errorCode)
 {
     response.ErrorCode = errorCode.InfoGetValue();
     response.Message   = errorCode.InfoGetDescription();
     response.Success   = false;
     if (errorCode == InfoErrorCode.Code100)
     {
         response.Success = true;
     }
     return(response);
 }
示例#5
0
        /// <summary>
        /// 验证参数是否合法
        /// </summary>
        /// <param name="mode">参数实体</param>
        /// <param name="json">获取到的json字符串</param>
        /// <returns></returns>
        private InnerResponse VerificationParameter(JmPayParameter.Models.Initialization mode, string json)
        {
            InnerResponse Inn = new InnerResponse();

            try
            {
                if (string.IsNullOrEmpty(mode.t_key) || mode.t_key.Length > 64)
                {
                    return(Inn = Inn.InfoToResponse(InfoErrorCode.Code9997));
                }
                if (string.IsNullOrEmpty(mode.t_mark) || mode.t_mark.Length > 32)
                {
                    return(Inn = Inn.InfoToResponse(InfoErrorCode.Code9995));
                }
                if (string.IsNullOrEmpty(mode.t_imsi) || mode.t_imsi.Length > 32)
                {
                    return(Inn = Inn.InfoToResponse(InfoErrorCode.Code9994));
                }
                if (string.IsNullOrEmpty(mode.t_brand) || mode.t_brand.Length > 32)
                {
                    return(Inn = Inn.InfoToResponse(InfoErrorCode.Code9993));
                }
                if (string.IsNullOrEmpty(mode.t_system) || mode.t_system.Length > 32)
                {
                    return(Inn = Inn.InfoToResponse(InfoErrorCode.Code9992));
                }
                if (string.IsNullOrEmpty(mode.t_hardware) || mode.t_hardware.Length > 32)
                {
                    return(Inn = Inn.InfoToResponse(InfoErrorCode.Code9991));
                }
                if (string.IsNullOrEmpty(mode.t_sdkver) || mode.t_sdkver.Length > 16)
                {
                    return(Inn = Inn.InfoToResponse(InfoErrorCode.Code9990));
                }
                if (string.IsNullOrEmpty(mode.t_screen) || mode.t_screen.Length > 16)
                {
                    return(Inn = Inn.InfoToResponse(InfoErrorCode.Code9989));
                }
                if (string.IsNullOrEmpty(mode.t_network) || mode.t_network.Length > 16)
                {
                    return(Inn = Inn.InfoToResponse(InfoErrorCode.Code9988));
                }
                Inn = Inn.InfoToResponse(InfoErrorCode.Code100);
            }
            catch (Exception e)
            {
                string bcxx = "报错提示" + e.Message + "报错对象:" + e.Source + "报错方法:" + e.TargetSite + "报错信息:" + e.ToString() + "报错位置:" + e.StackTrace.ToString();//报错信息
                //AddLocLog.AddLog(1, 4, "", "接口错误信息", "报错信息:支付接口验证参数错误,获取到的参数:" + json + ",报错信息:" + bcxx);//写入报错日志
                PayApiGlobalErrorLogger.Log("报错信息:支付接口验证参数错误,获取到的参数:" + json + ",报错信息:" + bcxx, summary: "接口错误信息");
                Inn = Inn.InfoToResponse(InfoErrorCode.Code9998);
            }
            return(Inn);
        }
示例#6
0
文件: PreOrder.cs 项目: dmhai/dxpay
        /// <summary>
        /// 验证数据是否合法
        /// </summary>
        /// <param name="dict">请求参数键值集合</param>
        /// <param name="json">参数json字符串</param>
        /// <param name="bizcodeTime">缓存时间从配置文件中读取的</param>
        /// <param name="app">应用实体</param>
        /// <returns></returns>
        private InnerResponse ValidationParameter(RequestParameter mode, string json, int bizcodeTime)
        {
            InnerResponse Inn = new InnerResponse();

            try
            {
                if (string.IsNullOrEmpty(mode.timestamp) || mode.timestamp.Length != 10)
                {
                    return(Inn = Inn.ToResponse(ErrorCode.Code9985));
                }
                if (!VerificationTimestamp(mode.timestamp, bizcodeTime))
                {
                    return(Inn = Inn.ToResponse(ErrorCode.Code9984));
                }
                if (string.IsNullOrEmpty(mode.bizcode) && mode.bizcode.Length > 64)
                {
                    return(Inn = Inn.ToResponse(ErrorCode.Code9997));
                }
                if (mode.appid <= 0)
                {
                    return(Inn = Inn.ToResponse(ErrorCode.Code9998));
                }
                if (VerificationCode(mode.bizcode, mode.appid))
                {
                    return(Inn = Inn.ToResponse(ErrorCode.Code9988));
                }
                if (string.IsNullOrEmpty(mode.goodsname) || mode.goodsname.Length > 16)
                {
                    return(Inn = Inn.ToResponse(ErrorCode.Code9993));
                }
                if (mode.price <= 0)
                {
                    return(Inn = Inn.ToResponse(ErrorCode.Code9992));
                }
                if (!string.IsNullOrEmpty(mode.privateinfo) && mode.privateinfo.Length > 64)
                {
                    return(Inn = Inn.ToResponse(ErrorCode.Code9991));
                }
                if (!JMP.TOOL.Regular.IsDem(mode.price.ToString()))
                {
                    return(Inn = Inn.ToResponse(ErrorCode.Code9986));
                }
                Inn = Inn.ToResponse(ErrorCode.Code100);
            }
            catch (Exception e)
            {
                PayApiGlobalErrorLogger.Log("报错信息103:支付接口验证参数错误,获取到的参数:" + json + ",报错信息:" + e.ToString(), summary: "接口错误信息");
                Inn = Inn.ToResponse(ErrorCode.Code103);
            }
            return(Inn);
        }
示例#7
0
        /// <summary>
        /// 验证接受参数是否合法以及有效性
        /// </summary>
        /// <param name="mode">接受的参数实体</param>
        /// <returns></returns>
        private InnerResponse InspectParameter(PayBankModels mode)
        {
            InnerResponse Inn = new InnerResponse();

            if (string.IsNullOrEmpty(mode.code))
            {
                return(Inn = Inn.ToResponse(ErrorCode.Code8999));
            }
            if (string.IsNullOrEmpty(mode.sign))
            {
                return(Inn = Inn.ToResponse(ErrorCode.Code8998));
            }
            if (mode.price <= 0)
            {
                return(Inn = Inn.ToResponse(ErrorCode.Code8997));
            }
            if (string.IsNullOrEmpty(mode.goodsname))
            {
                return(Inn = Inn.ToResponse(ErrorCode.Code8996));
            }
            if (mode.apptype <= 0)
            {
                return(Inn = Inn.ToResponse(ErrorCode.Code8995));
            }
            if (mode.paymode > 3 || mode.paymode < 1)
            {
                return(Inn = Inn.ToResponse(ErrorCode.Code8994));
            }
            if (string.IsNullOrEmpty(mode.paytype))
            {
                return(Inn = Inn.ToResponse(ErrorCode.Code8993));
            }
            else
            {
                try
                {
                    int type = int.Parse(mode.paytype);
                    if (type < 1 || type > 8)
                    {
                        return(Inn = Inn.ToResponse(ErrorCode.Code8993));
                    }
                }
                catch
                {
                    return(Inn = Inn.ToResponse(ErrorCode.Code8993));
                }
            }
            Inn = Inn.ToResponse(ErrorCode.Code100);
            return(Inn);
        }
示例#8
0
        /// <summary>
        /// sdk收银台模式返回数据组装
        /// </summary>
        /// <param name="mode">参数实体</param>
        /// <param name="ip">ip地址</param>
        /// <returns></returns>
        public InnerResponse BankSdk(PayBankModels mode, string ip)
        {
            InnerResponse Inn = new InnerResponse();

            try
            {
                string json = JMP.TOOL.JsonHelper.Serialize(mode);
                Inn           = Inn.ToResponse(ErrorCode.Code100);
                Inn.ExtraData = JMP.TOOL.AesHelper.AesEncrypt(json, ConfigurationManager.AppSettings["encryption"].ToString());
            }
            catch (Exception e)
            {
                //string bcxx = "报错提示" + e.Message + "报错对象:" + e.Source + "报错方法:" + e.TargetSite + "报错信息:" + e.ToString() + "报错位置:" + e.StackTrace.ToString();//报错信息
                //JMP.TOOL.AddLocLog.AddLog(1, 4, ip, "收银台sdk模式返回加密地址接口错误信息", "报错信息:" + bcxx);//写入报错日志
                PayApiGlobalErrorLogger.Log("报错信息103:" + e.ToString(), summary: "收银台sdk模式返回加密地址接口错误信息");
                Inn = Inn.ToResponse(ErrorCode.Code103);
            }
            return(Inn);
        }
示例#9
0
        /// <summary>
        /// 初始化接口主通道
        /// </summary>
        /// <param name="mode">参数实体</param>
        /// <param name="json">参数json字符串</param>
        /// <param name="CacheTime">缓存时间</param>
        /// <param name="ip">ip地址</param>
        /// <returns></returns>
        public InnerResponse InfoPass(JmPayParameter.Models.Initialization mode, string json, int CacheTime, string ip)
        {
            InnerResponse Inn = new InnerResponse();

            Inn = VerificationParameter(mode, json);
            if (Inn.Success == true)
            {
                if (mode.t_appid > 0)
                {
                    SelectAPP       selectAPP = new SelectAPP();
                    JMP.MDL.jmp_app app       = selectAPP.SelectAppId(mode.t_appid, CacheTime);
                    if (app != null)
                    {
                        jmp_terminal model = EntityEvaluation(mode, ip);
                        if (mode != null)
                        {
                            if (mode.t_isnew == 1)
                            {
                                Inn = Insertliveteral(model);
                            }
                            else
                            {
                                Inn = InsertNew(model);
                            }
                        }
                        else
                        {
                            Inn = Inn.InfoToResponse(InfoErrorCode.Code9998);
                        }
                    }
                    else
                    {
                        Inn = Inn.InfoToResponse(InfoErrorCode.Code9996);
                    }
                }
                else
                {
                    Inn = Inn.InfoToResponse(InfoErrorCode.Code9996);
                }
            }
            return(Inn);
        }
示例#10
0
文件: PreOrder.cs 项目: dmhai/dxpay
        /// <summary>
        /// 预下单接口通道
        /// </summary>
        /// <param name="json">json字符串</param>
        /// <param name="mode">参数实体类型</param>
        /// <param name="CacheTime">缓存时间</param>
        /// <param name="UserIp">ip地址</param>
        /// <returns></returns>
        public InnerResponse OrderInterface(string json, RequestParameter mode, int CacheTime, string UserIp)
        {
            InnerResponse Inn = new InnerResponse();

            if (!string.IsNullOrEmpty(json))
            {
                pr.ip = UserIp;
                //订单缓存时间
                int bizcodeTime = Int32.Parse(ConfigurationManager.AppSettings["bizcodeTime"]);
                Inn = ValidationParameter(mode, json, bizcodeTime);
                if (Inn.Success)
                {
                    SelectAPP selectAPP = new SelectAPP();
                    jmp_app   app       = selectAPP.SelectAppId(mode.appid, CacheTime);
                    if (app != null)
                    {
                        Apprate apprate = new Apprate();
                        if (mode.paytype > 0 && !apprate.SelectApprate(mode.appid, mode.paytype, CacheTime))
                        {
                            return(Inn = Inn.ToResponse(ErrorCode.Code8987));
                        }
                        pr.appkey = app.a_key;
                        Inn       = ValidationApp(mode, json, app);
                        if (Inn.Success == true)
                        {
                            Inn = DownOrder(mode, json);
                            if (Inn.Success == true)
                            {
                                //设置缓存
                                SetUpCache(mode.bizcode, mode.appid, bizcodeTime);
                                Inn = judge(mode.paytype, app.a_platform_id, app.a_rid, CacheTime, app.a_id);
                            }
                        }
                    }
                    else
                    {
                        Inn = Inn.ToResponse(ErrorCode.Code9998);
                    }
                }
            }
            return(Inn);
        }
示例#11
0
文件: PreOrder.cs 项目: dmhai/dxpay
        /// <summary>
        /// 添加订单入库
        /// </summary>
        /// <param name="mode">传入参数实体</param>
        /// <param name="json">传入参数json字符串</param>
        /// <returns></returns>
        private InnerResponse DownOrder(RequestParameter mode, string json)
        {
            InnerResponse Inn = new InnerResponse();

            JMP.MDL.jmp_order mod          = new JMP.MDL.jmp_order(); //订单表实体类
            JMP.BLL.jmp_order jmp_orderbll = new JMP.BLL.jmp_order(); //订单表业务逻辑层
            mod.o_address     = mode.address;
            mod.o_showaddress = mode.showaddress;
            mod.o_app_id      = mode.appid;
            mod.o_bizcode     = mode.bizcode;
            mod.o_term_key    = mode.termkey;
            mod.o_paymode_id  = mode.paytype.ToString();
            mod.o_goodsname   = mode.goodsname;
            mod.o_price       = mode.price;
            mod.o_privateinfo = mode.privateinfo;
            Random r = new Random(BitConverter.ToInt32(Guid.NewGuid().ToByteArray(), 0));

            mod.o_code        = DateTime.Now.ToString("yyyyMMddHHmmssfff") + r.Next(111111111, 999999999).ToString() + r.Next(1111, 9999).ToString();
            mod.o_state       = 0;
            mod.o_times       = 0;
            mod.o_noticestate = 0;
            mod.o_ctime       = DateTime.Now;
            mod.o_noticetimes = DateTime.Now;
            mod.o_ptime       = DateTime.Now;
            int cg = 0;

            cg = jmp_orderbll.AddOrder(mod);
            if (cg > 0)
            {
                pr.orderid   = cg;
                pr.code      = mod.o_code;
                pr.goodsname = mode.goodsname;
                pr.price     = mode.price;
                Inn          = Inn.ToResponse(ErrorCode.Code100);
            }
            else
            {
                PayApiGlobalErrorLogger.Log("报错信息:支付信息生成订单失败,获取到的参数:" + json, summary: "接口错误信息");
                Inn = Inn.ToResponse(ErrorCode.Code101);
            }
            return(Inn);
        }
示例#12
0
文件: PreOrder.cs 项目: dmhai/dxpay
        /// <summary>
        /// 判断支付平台,根据支付平台返回对应信息
        /// </summary>
        /// <param name="paytype">支付类型</param>
        /// <param name="paymode">关联平台(1:安卓,2:ios,3:H5)</param>
        /// <param name="apptype">风控配置表id</param>
        /// <param name="CacheTime">缓存时间</param>
        /// <param name="appid">应用id</param>
        /// <returns></returns>
        private InnerResponse judge(int paytype, int paymode, int apptype, int CacheTime, int appid)
        {
            InnerResponse Inn = new InnerResponse();

            JmPayParameter.JsonStr Jsonstr = new JsonStr();
            JmPayParameter.PayTypeFactory.PayTypeFactory payTypeFactory = new PayTypeFactory.PayTypeFactory();
            if (paytype == 0)
            {
                #region 收银台模式
                //收银台模式
                if (paymode == 3)
                {
                    PayBankModels modes = Jsonstr.ParameterEntity(pr.code, pr.goodsname, pr.price, pr.ThispayType, apptype, paymode);
                    //h5模式
                    Inn = Jsonstr.BankJsonStr(modes, pr.ip);
                    //设置为跳转模式
                    Inn.IsJump = true;
                }
                else
                {
                    //获取优先级设置(微信wap和微信appid根据优先级返回其中之一)
                    int SdkPriority = Int32.Parse(ConfigurationManager.AppSettings["SdkPriority"].ToString());
                    //判断收银台模式优先返回微信调用方式
                    if (SdkPriority == 2 && pr.ThispayType.Contains("2") && pr.ThispayType.Contains("5"))
                    {
                        pr.ThispayType = pr.ThispayType.Replace("5", "@").Replace(",@", "");
                    }
                    else if (SdkPriority == 5 && pr.ThispayType.Contains("2") && pr.ThispayType.Contains("5"))
                    {
                        pr.ThispayType = pr.ThispayType.Replace("2", "@").Replace(",@", "");
                    }

                    PayBankModels modes = Jsonstr.ParameterEntity(pr.code, pr.goodsname, pr.price, pr.ThispayType, apptype, paymode);
                    //sdk模式
                    Inn = Jsonstr.BankSdk(modes, pr.ip);
                }
                #endregion
            }
            else
            {
                if (paymode == 3)
                {
                    #region H5模式
                    if (paytype == 6 || paytype == 7)
                    {
                        try
                        {
                            var payType = payTypeFactory.Create(paytype);
                            var channel = payType.LoadChannel(paymode, apptype, CacheTime, appid);
                            JmPayParameter.PlaceOrder.PlaceOrderFactory placeOrderFactory = new PlaceOrder.PlaceOrderFactory();
                            //返回支付信息
                            Inn = placeOrderFactory.Create(channel.PassName, paymode, apptype, pr.code, pr.goodsname, pr.price, pr.orderid, pr.ip, appid);
                        }
                        catch (Exc e)
                        {
                            Inn = e.Response;
                            return(Inn);
                        }
                    }
                    else
                    {
                        PayBankModels modes = Jsonstr.ParameterEntity(pr.code, pr.goodsname, pr.price, paytype.ToString(), apptype, paymode);
                        //h5模式
                        Inn = Jsonstr.H5JsonStr(modes, pr.ip);
                        //设置为跳转模式
                        //Inn.IsJump = true;
                    }
                    #endregion
                }
                else
                {
                    #region sdk模式
                    //sdk模式
                    try
                    {
                        var payType = payTypeFactory.Create(paytype);
                        var channel = payType.LoadChannel(paymode, apptype, CacheTime, appid);
                        JmPayParameter.PlaceOrder.PlaceOrderFactory placeOrderFactory = new PlaceOrder.PlaceOrderFactory();
                        //返回支付信息
                        Inn = placeOrderFactory.Create(channel.PassName, paymode, apptype, pr.code, pr.goodsname, pr.price, pr.orderid, pr.ip, appid);
                    }
                    catch (Exc e)
                    {
                        Inn = e.Response;
                        return(Inn);
                    }
                    #endregion
                }
            }
            return(Inn);
        }
示例#13
0
文件: PreOrder.cs 项目: dmhai/dxpay
        /// <summary>
        /// 验证数据是否合法(需要使用查询数据)
        /// </summary>
        /// <param name="mode">请求参数实体</param>
        /// <param name="json">参数json字符串</param>
        /// <param name="app">应用实体</param>
        /// <returns></returns>
        private InnerResponse ValidationApp(RequestParameter mode, string json, jmp_app app)
        {
            InnerResponse Inn = new InnerResponse();

            try
            {
                if (app == null)
                {
                    return(Inn = Inn.ToResponse(ErrorCode.Code9998));
                }
                //验证签名的方式  price + bizcode+timestamp+appkey
                string Verificationsign = mode.price + mode.bizcode + mode.timestamp + app.a_key;
                string sign             = JMP.TOOL.MD5.md5strGet(Verificationsign, true).ToUpper();
                if (mode.sign != sign)
                {
                    PayApiDetailErrorLogger.DownstreamErrorLog("报错信息9989:支付接口签名验证失败,获取到的参数:" + json + ",组装的签名字符串:" + Verificationsign + ",我们生产的签名:" + sign, summary: "接口错误信息", appId: app.a_id, errorType: EnumForLogForApi.ErrorType.Other);

                    return(Inn = Inn.ToResponse(ErrorCode.Code9989));
                }
                //判断终端唯一标示码。ios和安卓模式为必传
                if (app.a_platform_id < 3 && app.a_platform_id > 0)
                {
                    if (string.IsNullOrEmpty(mode.termkey) || mode.termkey.Length > 64)
                    {
                        return(Inn = Inn.ToResponse(ErrorCode.Code9996));
                    }
                }
                else
                {
                    mode.termkey = "";
                }
                if (string.IsNullOrEmpty(mode.address))
                {
                    mode.address = app.a_notifyurl;
                }
                else
                {
                    if (mode.address.Length > 200)
                    {
                        return(Inn = Inn.ToResponse(ErrorCode.Code9995));
                    }
                }

                if (app.a_platform_id == 3)
                {
                    if (string.IsNullOrEmpty(mode.showaddress))
                    {
                        mode.showaddress = app.a_showurl;
                    }
                    else
                    {
                        if (mode.showaddress.Length > 200)
                        {
                            return(Inn = Inn.ToResponse(ErrorCode.Code9994));
                        }
                    }
                }

                if (mode.paytype < 0 || mode.paytype > 8)
                {
                    return(Inn = Inn.ToResponse(ErrorCode.Code9990));
                }
                else
                {
                    if (mode.paytype > 0 && !app.a_paymode_id.Contains(mode.paytype.ToString()))
                    {
                        return(Inn = Inn.ToResponse(ErrorCode.Code105));
                    }
                    else
                    {
                        pr.ThispayType = app.a_paymode_id;
                    }
                }
                Inn = Inn.ToResponse(ErrorCode.Code100);
            }
            catch (Exception e)
            {
                PayApiGlobalErrorLogger.Log("报错信息103:支付接口验证参数错误,获取到的参数:" + json + ",报错信息:" + e.ToString(), summary: "接口错误信息");
                Inn = Inn.ToResponse(ErrorCode.Code103);
            }
            return(Inn);
        }
示例#14
0
        /// <summary>
        /// H5和收银台模式下单主通道
        /// </summary>
        /// <param name="mode">接受参数modes实体</param>
        /// <param name="CacheTime"></param>
        /// <param name="ip"></param>
        /// <returns></returns>
        public InnerResponse H5OrBankEntrance(PayBankModels mode, int CacheTime, string ip)
        {
            InnerResponse Inn = new InnerResponse();

            if (mode != null)
            {
                Inn = InspectParameter(mode);
                if (Inn.Success == true)
                {
                    JMP.MDL.jmp_order mod = new JMP.MDL.jmp_order();
                    mod = SelectCode(mode.code, CacheTime, mode.paytype);
                    if (mod != null && mod.o_state == 0)
                    {
                        Inn = checkSign(mode, mod);
                        if (Inn.Success == true)
                        {
                            Apprate apprate = new Apprate();
                            if (Int32.Parse(mode.paytype) > 0 && !apprate.SelectApprate(mod.o_app_id, Int32.Parse(mode.paytype), CacheTime))
                            {
                                return(Inn = Inn.ToResponse(ErrorCode.Code8987));
                            }
                            if (UpdateCode(mod.o_id, int.Parse(mode.paytype)))
                            {
                                try
                                {
                                    JmPayParameter.PayTypeFactory.PayTypeFactory payTypeFactory = new PayTypeFactory.PayTypeFactory();
                                    var payType = payTypeFactory.Create(int.Parse(mode.paytype));
                                    if (mode.paytype == "4" && (mode.paymode == 2 || mode.paymode == 1))
                                    {
                                        mode.paymode = 3;
                                    }
                                    var channel = payType.LoadChannel(mode.paymode, mode.apptype, CacheTime, mod.o_app_id);
                                    JmPayParameter.PlaceOrder.PlaceOrderFactory placeOrderFactory = new PlaceOrder.PlaceOrderFactory();
                                    //返回支付信息
                                    Inn = placeOrderFactory.Create(channel.PassName, mode.paymode, mode.apptype, mode.code, mode.goodsname, mode.price, mod.o_id, ip, mod.o_app_id);
                                }
                                catch (Exc e)
                                {
                                    Inn = e.Response;
                                    return(Inn);
                                }
                            }
                            else
                            {
                                PayApiDetailErrorLogger.DownstreamErrorLog("报错信息:支付接口收银台模式报错,修改订单失败:订单id:" + mod.o_id + ",支付方式:" + mode.paymode + ",订单编号:" + mode.code, summary: "接口错误信息", appId: mod.o_app_id, errorType: EnumForLogForApi.ErrorType.RequestRepeat);
                                Inn = Inn.ToResponse(ErrorCode.Code8999);
                            }
                        }
                    }
                    else
                    {
                        Inn = Inn.ToResponse(ErrorCode.Code8991);
                    }
                }
            }
            else
            {
                PayApiGlobalErrorLogger.Log("报错信息103:支付接口收银台模式报错,未获取到下单参数,接收参数的实体为空", summary: "接口错误信息");
                Inn = Inn.ToResponse(ErrorCode.Code103);
            }
            return(Inn);
        }