Esempio n. 1
0
        /// <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);
        }
Esempio n. 2
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);
        }