Пример #1
0
        public ActionResult SubmitParkingPaymentRequest(OnlineOrder model)
        {
            try
            {
                if (model.OrderSource == PayOrderSource.Platform)
                {
                    //int interfaceOrderState = InterfaceOrderServices.OrderWhetherEffective(model.PayDetailID);

                    int interfaceOrderState = InterfaceOrderServices.OrderWhetherEffective(model.PayDetailID, model.PKID, model.InOutID);
                    if (interfaceOrderState != 1)
                    {
                        string msg       = interfaceOrderState == 2 ? "重复支付" : "订单已失效";
                        string companyId = GetCompanyId(model.PKID, string.Empty, string.Empty);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = msg, returnUrl = "/QRCode/Index?companyId=" + companyId + "" }));
                    }
                }
                model.OrderID   = IdGenerator.Instance.GetId();
                model.Status    = OnlineOrderStatus.WaitPay;
                model.OrderType = OnlineOrderType.ParkFee;
                model.Amount    = model.Amount;

                BaseCompany company = CompanyServices.QueryByParkingId(model.PKID);
                if (company == null)
                {
                    throw new MyException("获取单位信息失败");
                }

                if (model.PaymentChannel == PaymentChannel.AliPay)
                {
                    if (string.IsNullOrWhiteSpace(AliPayUserId))
                    {
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取用户信息失败,请重新扫码进入" }));
                    }
                    AliPayApiConfig config = AliPayApiConfigServices.QueryAliPayConfig(company.CPID);
                    if (config == null)
                    {
                        ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "获取支付宝配置信息失败[0001]", "单位编号:" + company.CPID, LogFrom.WeiXin);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取支付宝配置信息失败!" }));
                    }
                    if (!config.Status)
                    {
                        ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "该支付宝暂停使用", "单位编号:" + config.CompanyID, LogFrom.WeiXin);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "该车场暂停使用支付宝支付!" }));
                    }
                    if (model.OrderSource == PayOrderSource.Platform && (CurrLoginAliPayApiConfig == null || CurrLoginAliPayApiConfig.CompanyID != config.CompanyID))
                    {
                        string loginCompanyId = CurrLoginAliPayApiConfig != null ? CurrLoginAliPayApiConfig.CompanyID : string.Empty;
                        ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "支付宝配置信息和当前支付宝配置信息不匹配,不能支付", string.Format("支付单位:{0},用户单位:{1}", config.CompanyID, loginCompanyId), LogFrom.WeiXin);
                        if (CurrLoginAliPayApiConfig == null)
                        {
                            return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取支付宝授权信息失败,请重试!" }));
                        }
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "支付宝配置信息和当前支付宝配置信息不匹配,不能支付!" }));
                    }
                    model.AccountID      = string.Empty;
                    model.CardId         = string.Empty;
                    model.PayeeChannel   = PaymentChannel.AliPay;
                    model.PaymentChannel = PaymentChannel.AliPay;
                    model.PayeeUser      = config.SystemName;
                    model.PayeeAccount   = config.PayeeAccount;
                    model.Payer          = AliPayUserId;
                    model.PayAccount     = AliPayUserId;
                    model.CompanyID      = config.CompanyID;
                }
                else
                {
                    if (string.IsNullOrWhiteSpace(WeiXinOpenId))
                    {
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取用户信息失败,请重新扫码进入" }));
                    }

                    WX_ApiConfig config = WXApiConfigServices.QueryWXApiConfig(company.CPID);
                    if (config == null)
                    {
                        ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "获取微信配置信息失败", "单位编号:" + company.CPID, LogFrom.WeiXin);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取微信配置信息失败!" }));
                    }
                    if (!config.Status)
                    {
                        ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "该车场暂停使用微信支付", "单位编号:" + company.CPID, LogFrom.WeiXin);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "该车场暂停使用微信支付!" }));
                    }
                    if (model.OrderSource == PayOrderSource.Platform && (CurrLoginWeiXinApiConfig == null || config.CompanyID != CurrLoginWeiXinApiConfig.CompanyID))
                    {
                        string loginCompanyId = CurrLoginWeiXinApiConfig != null ? CurrLoginWeiXinApiConfig.CompanyID : string.Empty;
                        ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "车场所属公众号和当前公众号不匹配,不能支付", string.Format("支付单位:{0},微信用户单位:{1}", config.CompanyID, loginCompanyId), LogFrom.WeiXin);
                        if (CurrLoginWeiXinApiConfig == null)
                        {
                            return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取微信授权信息失败,请重试!" }));
                        }
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "车场所属公众号和当前公众号不匹配,不能支付!" }));
                    }

                    model.PayeeUser      = config.SystemName;
                    model.PayeeAccount   = config.PartnerId;
                    model.PayAccount     = WeiXinOpenId;
                    model.Payer          = model.PayAccount;
                    model.AccountID      = model.AccountID;
                    model.CardId         = model.AccountID;
                    model.PayeeChannel   = PaymentChannel.WeiXinPay;
                    model.PaymentChannel = PaymentChannel.WeiXinPay;
                    model.CompanyID      = config.CompanyID;
                }

                bool result = OnlineOrderServices.Create(model);
                if (!result)
                {
                    throw new MyException("生成待缴费订单失败");
                }

                switch (model.PaymentChannel)
                {
                case PaymentChannel.WeiXinPay:
                {
                    return(RedirectToAction("ParkCarPayment", "WeiXinPayment", new { orderId = model.OrderID, source = 1 }));
                }

                case PaymentChannel.AliPay:
                {
                    return(RedirectToAction("ParkCarPayment", "AliPayment", new { orderId = model.OrderID, source = 1 }));
                }

                default: throw new MyException("支付方式错误");
                }
            }
            catch (MyException ex)
            {
                return(RedirectToAction("ComputeParkingFee", "QRCodeParkPayment", new { licensePlate = model.PlateNo, RemindUserContent = ex.Message }));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "保存临停缴费订单失败", ex, LogFrom.WeiXin);
                return(RedirectToAction("ComputeParkingFee", "QRCodeParkPayment", new { licensePlate = model.PlateNo, RemindUserContent = "提交支付失败" }));
            }
        }
Пример #2
0
        public ActionResult SaveRecharge(decimal Amount)
        {
            try
            {
                BaseVillage village = VillageServices.QueryVillageByRecordId(SellerLoginUser.VID);
                if (village == null)
                {
                    throw new MyException("获取小区信息失败");
                }

                WX_ApiConfig config = WXApiConfigServices.QueryWXApiConfig(village.CPID);
                if (config == null)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXin_XFJM", "获取微信配置信息失败", "单位编号:" + village.CPID, LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取微信配置信息失败!" }));
                }
                if (!config.Status)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXin_XFJM", "该车场暂停使用微信支付", "单位编号:" + village.CPID, LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "该车场暂停使用微信支付!" }));
                }
                if (config.CompanyID != WeiXinUser.CompanyID)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXin_XFJM", "微信用户所属公众号和当前公众号不匹配,不能支付", string.Format("支付单位:{0},微信用户单位:{1}", config.CompanyID, WeiXinUser.CompanyID), LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "微信用户所属公众号和当前公众号不匹配,不能支付!" }));
                }
                if (CurrLoginWeiXinApiConfig == null || config.CompanyID != CurrLoginWeiXinApiConfig.CompanyID)
                {
                    string loginCompanyId = CurrLoginWeiXinApiConfig != null ? CurrLoginWeiXinApiConfig.CompanyID : string.Empty;
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXin_XFJM", "车场所属公众号和当前公众号不匹配,不能支付", string.Format("支付单位:{0},微信用户单位:{1}", config.CompanyID, loginCompanyId), LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "车场所属公众号和当前公众号不匹配,不能支付!" }));
                }

                OnlineOrder order = new OnlineOrder();
                order.OrderID        = IdGenerator.Instance.GetId();
                order.InOutID        = SellerLoginUser.SellerID;
                order.PKID           = SellerLoginUser.SellerID;
                order.Status         = OnlineOrderStatus.WaitPay;
                order.PayAccount     = WeiXinUser.OpenID;
                order.Payer          = WeiXinUser.OpenID;
                order.PKName         = SellerLoginUser.SellerName;
                order.Amount         = Amount;
                order.PayeeUser      = config.SystemName;
                order.PayeeAccount   = config.PartnerId;
                order.OrderType      = OnlineOrderType.SellerRecharge;
                order.PaymentChannel = PaymentChannel.WeiXinPay;
                order.PayeeChannel   = PaymentChannel.WeiXinPay;
                order.AccountID      = WeiXinUser.AccountID;
                order.Amount         = Amount;
                order.CardId         = WeiXinUser.AccountID;
                order.CompanyID      = config.CompanyID;
                order.OrderTime      = DateTime.Now;
                order.Remark         = "商家充值";
                bool result = OnlineOrderServices.Create(order);
                if (!result)
                {
                    throw new MyException("充值失败[保存订单失败]");
                }

                return(RedirectToAction("SellerRechargePayment", "WeiXinPayment", new { orderId = order.OrderID }));
            }
            catch (MyException ex)
            {
                return(PageAlert("Index", "SellerRecharge", new { RemindUserContent = ex.Message }));
            }
            catch (Exception ex) {
                ExceptionsServices.AddExceptionToDbAndTxt("WeiXin_XFJM", "提交商家充值信息失败", ex, LogFrom.WeiXin);
                return(PageAlert("Index", "SellerRecharge", new { RemindUserContent = "提交商家充值信息失败" }));
            }
        }
Пример #3
0
        public ActionResult SubmitParkingPaymentRequest(OnlineOrder model)
        {
            try
            {
                if (model.OrderSource == PayOrderSource.Platform)
                {
                    int interfaceOrderState = InterfaceOrderServices.OrderWhetherEffective(model.PayDetailID);
                    if (interfaceOrderState != 1)
                    {
                        string msg = interfaceOrderState == 2 ? "重复支付" : "订单已失效";
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = msg, returnUrl = "/H5ParkingPayment/Index" }));
                    }
                }
                model.OrderID   = IdGenerator.Instance.GetId();
                model.Status    = OnlineOrderStatus.WaitPay;
                model.OrderType = OnlineOrderType.ParkFee;
                model.Amount    = model.Amount;

                BaseCompany company = CompanyServices.QueryByParkingId(model.PKID);
                if (company == null)
                {
                    throw new MyException("获取单位信息失败");
                }

                if (model.PaymentChannel == PaymentChannel.AliPay)
                {
                    AliPayApiConfig config = AliPayApiConfigServices.QueryAliPayConfig(company.CPID);
                    if (config == null)
                    {
                        ExceptionsServices.AddExceptionToDbAndTxt("H5ParkingPaymentError", "获取支付宝配置信息失败[0001]", "单位编号:" + company.CPID, LogFrom.WeiXin);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取支付宝配置信息失败!" }));
                    }
                    if (!config.Status)
                    {
                        ExceptionsServices.AddExceptionToDbAndTxt("H5ParkingPaymentError", "该支付宝暂停使用", "单位编号:" + config.CompanyID, LogFrom.WeiXin);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "该车场暂停使用支付宝支付!" }));
                    }
                    AliPayApiConfig requestConfig = AliPayApiConfigServices.QueryAliPayConfig(GetRequestCompanyId);
                    if (requestConfig == null)
                    {
                        throw new MyException("获取请求单位微信配置失败");
                    }

                    if (config.CompanyID != requestConfig.CompanyID)
                    {
                        ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "支付的支付宝配置和请求的支付配置不匹配,不能支付", string.Format("支付单位:{0},请求单位:{1}", config.CompanyID, requestConfig.CompanyID), LogFrom.WeiXin);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "支付的支付宝配置和请求的支付配置不匹配,不能支付!" }));
                    }
                    model.AccountID      = LoginAccountID;
                    model.CardId         = string.Empty;
                    model.PayeeChannel   = PaymentChannel.AliPay;
                    model.PaymentChannel = PaymentChannel.AliPay;
                    model.PayeeUser      = config.SystemName;
                    model.PayeeAccount   = config.PayeeAccount;
                    model.PayAccount     = string.Empty;
                    model.Payer          = model.PayAccount;
                    model.CompanyID      = config.CompanyID;
                }
                else
                {
                    WX_ApiConfig config = WXApiConfigServices.QueryWXApiConfig(company.CPID);
                    if (config == null)
                    {
                        ExceptionsServices.AddExceptionToDbAndTxt("H5ParkingPaymentError", "获取微信配置信息失败", "单位编号:" + company.CPID, LogFrom.WeiXin);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取微信配置信息失败!" }));
                    }
                    if (!config.Status)
                    {
                        ExceptionsServices.AddExceptionToDbAndTxt("H5ParkingPaymentError", "该车场暂停使用微信支付", "单位编号:" + company.CPID, LogFrom.WeiXin);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "该车场暂停使用微信支付!" }));
                    }
                    WX_ApiConfig requestConfig = WXApiConfigServices.QueryWXApiConfig(GetRequestCompanyId);
                    if (requestConfig == null)
                    {
                        throw new MyException("获取请求单位微信配置失败");
                    }

                    if (config.CompanyID != requestConfig.CompanyID)
                    {
                        ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "微信支付配置和当前请求微信支付配置不匹配,不能支付", string.Format("支付单位:{0},请求单位:{1}", config.CompanyID, requestConfig.CompanyID), LogFrom.WeiXin);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "微信支付配置和当前请求微信支付配置不匹配,不能支付!" }));
                    }
                    model.PayeeUser      = config.SystemName;
                    model.PayeeAccount   = config.PartnerId;
                    model.PayAccount     = string.Empty;
                    model.Payer          = model.PayAccount;
                    model.AccountID      = LoginAccountID;
                    model.CardId         = model.AccountID;
                    model.PayeeChannel   = PaymentChannel.WeiXinPay;
                    model.PaymentChannel = PaymentChannel.WeiXinPay;
                    model.CompanyID      = config.CompanyID;
                }

                bool result = OnlineOrderServices.Create(model);
                if (!result)
                {
                    throw new MyException("生成待缴费订单失败");
                }

                switch (model.PaymentChannel)
                {
                case PaymentChannel.WeiXinPay:
                {
                    return(RedirectToAction("ParkCarPayment", "H5WeiXinPayment", new { orderId = model.OrderID }));
                }

                case PaymentChannel.AliPay:
                {
                    return(RedirectToAction("AliPayRequest", "H5Order", new { orderId = model.OrderID, requestSource = 1 }));
                }

                default: throw new MyException("支付方式错误");
                }
            }
            catch (MyException ex)
            {
                return(RedirectToAction("ComputeParkingFee", "H5CodeParkPayment", new { licensePlate = model.PlateNo, RemindUserContent = ex.Message }));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("H5ParkingPaymentError", "保存临停缴费订单失败", ex, LogFrom.WeiXin);
                return(RedirectToAction("ComputeParkingFee", "H5CodeParkPayment", new { licensePlate = model.PlateNo, RemindUserContent = "提交支付失败" }));
            }
        }
Пример #4
0
        public ActionResult SubmitBookingPayment(OnlineOrder model)
        {
            try
            {
                BaseCompany company = CompanyServices.QueryByParkingId(model.PKID);
                if (company == null)
                {
                    throw new MyException("获取单位信息失败");
                }

                WX_ApiConfig config = WXApiConfigServices.QueryWXApiConfig(company.CPID);
                if (config == null)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "获取微信配置信息失败", "单位编号:" + company.CPID, LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取微信配置信息失败!" }));
                }
                if (!config.Status)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "该车场暂停使用微信支付", "单位编号:" + company.CPID, LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "该车场暂停使用微信支付!" }));
                }
                if (config.CompanyID != WeiXinUser.CompanyID)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "微信用户所属公众号和当前公众号不匹配,不能支付", string.Format("支付单位:{0},微信用户单位:{1}", config.CompanyID, WeiXinUser.CompanyID), LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "微信用户所属公众号和当前公众号不匹配,不能支付!" }));
                }
                if (CurrLoginWeiXinApiConfig == null || config.CompanyID != CurrLoginWeiXinApiConfig.CompanyID)
                {
                    string loginCompanyId = CurrLoginWeiXinApiConfig != null ? CurrLoginWeiXinApiConfig.CompanyID : string.Empty;
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "车场所属公众号和当前公众号不匹配,不能支付", string.Format("支付单位:{0},微信用户单位:{1}", config.CompanyID, loginCompanyId), LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "车场所属公众号和当前公众号不匹配,不能支付!" }));
                }

                model.OrderID    = IdGenerator.Instance.GetId();
                model.Status     = OnlineOrderStatus.WaitPay;
                model.PayAccount = WeiXinUser.OpenID;
                model.Payer      = WeiXinUser.OpenID;
                model.PayeeUser  = config.SystemName;
                model.OrderType  = OnlineOrderType.PkBitBooking;
                model.AccountID  = WeiXinUser.AccountID;
                model.OrderTime  = DateTime.Now;
                model.CompanyID  = config.CompanyID;
                bool result = OnlineOrderServices.Create(model);
                if (!result)
                {
                    throw new MyException("生成车位预约订单失败");
                }
                switch (model.PaymentChannel)
                {
                case PaymentChannel.WeiXinPay:
                {
                    return(RedirectToAction("BookingBitNoPayment", "WeiXinPayment", new { orderId = model.OrderID }));
                }

                default: throw new MyException("支付方式错误");
                }
            }
            catch (MyException ex)
            {
                return(PageAlert("SaveBooking", "ParkBitBooking", new { plateNo = model.PlateNo, parkingId = model.PKID, areaId = model.CardId, startTime = model.BookingStartTime, endTime = model.BookingEndTime, RemindUserContent = ex.Message }));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("WeiXinWeb", "预约失败", ex, LogFrom.WeiXin);
                return(PageAlert("SaveBooking", "ParkBitBooking", new { plateNo = model.PlateNo, parkingId = model.PKID, areaId = model.CardId, startTime = model.BookingStartTime, endTime = model.BookingEndTime, RemindUserContent = "预约失败" }));
            }
        }
Пример #5
0
        public ActionResult SubmitMonthRenewals(string cardId, int month, double paymoney, PaymentChannel paytype, DateTime afterdate, string plateno, int source)
        {
            try
            {
                TxtLogServices.WriteTxtLog("1");

                TxtLogServices.WriteTxtLog(plateno);
                TxtLogServices.WriteTxtLog(cardId);
                TxtLogServices.WriteTxtLog(source.ToString());
                //TxtLogServices.WriteTxtLog(carInfos.Count().ToString());

                List <ParkUserCarInfo> carInfos = source == 1
                    ?RechargeService.GetMonthCarInfoByPlateNumber(plateno)
                    : RechargeService.GetMonthCarInfoByAccountID(WeiXinUser.AccountID);

                ParkUserCarInfo card = carInfos.FirstOrDefault(p => p.CardID == cardId);

                if (card == null)
                {
                    TxtLogServices.WriteTxtLog(carInfos.Count().ToString());
                    TxtLogServices.WriteTxtLog("2");
                }
                TxtLogServices.WriteTxtLog("3");

                CheckMonthCardOrder(card, month, paymoney, paytype, afterdate);
                TxtLogServices.WriteTxtLog("4");
                BaseCompany company = CompanyServices.QueryByParkingId(card.PKID);
                if (company == null)
                {
                    throw new MyException("获取单位信息失败");
                }

                WX_ApiConfig config = WXApiConfigServices.QueryWXApiConfig(company.CPID);
                if (config == null)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "获取微信配置信息失败", "单位编号:" + company.CPID, LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取微信配置信息失败!" }));
                }
                if (!config.Status)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "该车场暂停使用微信支付", "单位编号:" + company.CPID, LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "该车场暂停使用微信支付!" }));
                }
                if (config.CompanyID != WeiXinUser.CompanyID)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "微信用户所属公众号和当前公众号不匹配,不能支付", string.Format("支付单位:{0},微信用户单位:{1}", config.CompanyID, WeiXinUser.CompanyID), LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "微信用户所属公众号和当前公众号不匹配,不能支付!" }));
                }
                if (CurrLoginWeiXinApiConfig == null || config.CompanyID != CurrLoginWeiXinApiConfig.CompanyID)
                {
                    string loginCompanyId = CurrLoginWeiXinApiConfig != null ? CurrLoginWeiXinApiConfig.CompanyID : string.Empty;
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "车场所属公众号和当前公众号不匹配,不能支付", string.Format("支付单位:{0},微信用户单位:{1}", config.CompanyID, loginCompanyId), LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "车场所属公众号和当前公众号不匹配,不能支付!" }));
                }

                OnlineOrder model = new OnlineOrder();
                model.OrderID        = IdGenerator.Instance.GetId();
                model.CardId         = card.CardID;
                model.PKID           = card.PKID;
                model.PKName         = card.PKName;
                model.EntranceTime   = card.EndDate;
                model.ExitTime       = afterdate;
                model.MonthNum       = month;
                model.Amount         = (decimal)paymoney;
                model.Status         = OnlineOrderStatus.WaitPay;
                model.PaymentChannel = PaymentChannel.WeiXinPay;
                model.Payer          = WeiXinUser.OpenID;
                model.PayAccount     = WeiXinUser.OpenID;
                model.OrderTime      = DateTime.Now;
                model.PayeeChannel   = paytype;
                model.AccountID      = WeiXinUser.AccountID;
                model.OrderType      = OnlineOrderType.MonthCardRecharge;
                model.PlateNo        = card.PlateNumber;
                model.PayeeUser      = config.SystemName;
                model.PayeeAccount   = config.PartnerId;
                model.CompanyID      = config.CompanyID;
                bool result = OnlineOrderServices.Create(model);
                if (!result)
                {
                    throw new MyException("续期失败[保存订单失败]");
                }

                Response.Cookies.Add(new HttpCookie("SmartSystem_MonthCardPayment_Month", string.Format("{0},{1}", month, (int)paytype)));

                switch (model.PaymentChannel)
                {
                case PaymentChannel.WeiXinPay:
                {
                    return(RedirectToAction("MonthCardPayment", "WeiXinPayment", new { orderId = model.OrderID }));
                }

                default: throw new MyException("支付方式错误");
                }
            }
            catch (MyException ex)
            {
                return(PageAlert("MonthCardRenewal", "CardRenewal", new { cardId = cardId, RemindUserContent = ex.Message }));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("WeiXinWeb", string.Format("获取续费信息失败,编号:" + cardId), ex, LogFrom.WeiXin);
                return(PageAlert("MonthCardRenewal", "CardRenewal", new { cardId = cardId, RemindUserContent = "提交支付失败" }));
            }
        }
Пример #6
0
        public ActionResult SubmitMonthRenewals(string cardId, int month, double paymoney, PaymentChannel paytype, DateTime afterdate, string plateno, int source)
        {
            try
            {
                List <ParkUserCarInfo> carInfos = new List <ParkUserCarInfo>();
                if (source == 1)
                {
                    carInfos = RechargeService.GetMonthCarInfoByPlateNumber(plateno);
                }
                else
                {
                    if (UserAccount != null)
                    {
                        carInfos = RechargeService.GetMonthCarInfoByAccountID(UserAccount.AccountID);
                    }
                }
                ParkUserCarInfo card = carInfos.FirstOrDefault(p => p.CardID == cardId);
                if (card == null)
                {
                    throw new MyException("获月卡信息失败");
                }
                CheckMonthCardOrder(card, month, paymoney, paytype, afterdate);

                BaseCompany company = CompanyServices.QueryByParkingId(card.PKID);
                if (company == null)
                {
                    throw new MyException("获取单位信息失败");
                }

                OnlineOrder model = new OnlineOrder();
                if (paytype == PaymentChannel.AliPay)
                {
                    AliPayApiConfig config = AliPayApiConfigServices.QueryAliPayConfig(company.CPID);
                    if (config == null)
                    {
                        ExceptionsServices.AddExceptionToDbAndTxt("H5CardRenewalError", "获取支付宝配置信息失败[0001]", "单位编号:" + company.CPID, LogFrom.WeiXin);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取支付宝配置信息失败!" }));
                    }
                    if (!config.Status)
                    {
                        ExceptionsServices.AddExceptionToDbAndTxt("H5CardRenewalError", "该支付宝暂停使用", "单位编号:" + config.CompanyID, LogFrom.WeiXin);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "该车场暂停使用支付宝支付!" }));
                    }
                    AliPayApiConfig requestConfig = AliPayApiConfigServices.QueryAliPayConfig(GetRequestCompanyId);
                    if (requestConfig == null)
                    {
                        throw new MyException("获取请求单位微信配置失败");
                    }

                    if (config.CompanyID != requestConfig.CompanyID)
                    {
                        ExceptionsServices.AddExceptionToDbAndTxt("H5CardRenewalError", "支付的支付宝配置和请求的支付配置不匹配,不能支付", string.Format("支付单位:{0},请求单位:{1}", config.CompanyID, requestConfig.CompanyID), LogFrom.WeiXin);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "支付的支付宝配置和请求的支付配置不匹配,不能支付!" }));
                    }
                    model.PayeeUser      = config.SystemName;
                    model.PayeeAccount   = config.PayeeAccount;
                    model.PayeeChannel   = PaymentChannel.AliPay;
                    model.PaymentChannel = PaymentChannel.AliPay;
                    model.CompanyID      = config.CompanyID;
                }
                else
                {
                    WX_ApiConfig config = WXApiConfigServices.QueryWXApiConfig(company.CPID);
                    if (config == null)
                    {
                        ExceptionsServices.AddExceptionToDbAndTxt("H5CardRenewalError", "获取微信配置信息失败", "单位编号:" + company.CPID, LogFrom.WeiXin);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取微信配置信息失败!" }));
                    }
                    if (!config.Status)
                    {
                        ExceptionsServices.AddExceptionToDbAndTxt("H5CardRenewalError", "该车场暂停使用微信支付", "单位编号:" + company.CPID, LogFrom.WeiXin);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "该车场暂停使用微信支付!" }));
                    }
                    WX_ApiConfig requestConfig = WXApiConfigServices.QueryWXApiConfig(GetRequestCompanyId);
                    if (requestConfig == null)
                    {
                        throw new MyException("获取请求单位微信配置失败");
                    }

                    if (config.CompanyID != requestConfig.CompanyID)
                    {
                        ExceptionsServices.AddExceptionToDbAndTxt("H5CardRenewalError", "微信支付配置和当前请求微信支付配置不匹配,不能支付", string.Format("支付单位:{0},请求单位:{1}", config.CompanyID, requestConfig.CompanyID), LogFrom.WeiXin);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "微信支付配置和当前请求微信支付配置不匹配,不能支付!" }));
                    }
                    model.PayeeUser      = config.SystemName;
                    model.PayeeAccount   = config.PartnerId;
                    model.PayeeChannel   = PaymentChannel.WeiXinPay;
                    model.PaymentChannel = PaymentChannel.WeiXinPay;
                    model.CompanyID      = config.CompanyID;
                }

                model.OrderID      = IdGenerator.Instance.GetId();
                model.CardId       = card.CardID;
                model.PKID         = card.PKID;
                model.PKName       = card.PKName;
                model.EntranceTime = card.EndDate;
                model.ExitTime     = afterdate;
                model.MonthNum     = month;
                model.Amount       = (decimal)paymoney;
                model.Status       = OnlineOrderStatus.WaitPay;

                model.OrderTime = DateTime.Now;
                model.AccountID = LoginAccountID;
                model.OrderType = OnlineOrderType.MonthCardRecharge;
                model.PlateNo   = card.PlateNumber;

                bool result = OnlineOrderServices.Create(model);
                if (!result)
                {
                    throw new MyException("续期失败[保存订单失败]");
                }

                Response.Cookies.Add(new HttpCookie("SmartSystem_MonthCardPayment_Month", string.Format("{0},{1}", month, (int)paytype)));

                switch (model.PaymentChannel)
                {
                case PaymentChannel.WeiXinPay:
                {
                    return(RedirectToAction("MonthCardPayment", "H5WeiXinPayment", new { orderId = model.OrderID }));
                }

                case PaymentChannel.AliPay:
                {
                    return(RedirectToAction("AliPayRequest", "H5Order", new { orderId = model.OrderID, requestSource = 2 }));
                }

                default: throw new MyException("支付方式错误");
                }
            }
            catch (MyException ex)
            {
                return(PageAlert("MonthCardRenewal", "H5CardRenewal", new { cardId = cardId, RemindUserContent = ex.Message }));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("H5CardRenewalError", string.Format("获取续费信息失败,编号:" + cardId), ex, LogFrom.WeiXin);
                return(PageAlert("MonthCardRenewal", "CardRenewal", new { cardId = cardId, RemindUserContent = "提交支付失败" }));
            }
        }
Пример #7
0
        public string Pay()
        {
            string sTag = Request["paytype"];
            //string sBody = Request["body"];
            string sAmount      = Request["fee"];
            string sPayAccount  = Request["auth_code"];
            string sPlateNumber = Request["PlateNumber"];
            string sPKID        = Request["PKID"];

            if (sTag.IsEmpty() || (sTag != "0" && sTag != "1" && sTag != "2"))
            {
                return("2");
            }

            //if (string.IsNullOrEmpty(sBody))
            //{
            //    return "2sBody";
            //}
            if (string.IsNullOrEmpty(sAmount))
            {
                return("2");
            }

            if (sTag != "2")
            {
                if (string.IsNullOrEmpty(sPayAccount))
                {
                    return("2");
                }
            }
            if (string.IsNullOrEmpty(sPlateNumber))
            {
                return("2");
            }
            if (string.IsNullOrEmpty(sPKID))
            {
                return("2");
            }

            OnlineOrder model = new OnlineOrder();

            model.OrderTime = DateTime.Now;

            TempParkingFeeResult result = RechargeService.WXTempParkingFee(sPlateNumber, sPKID, sPayAccount, model.OrderTime);

            if (result.Result == APPResult.NoNeedPay)
            {
                return("3"); //不需要交费
            }
            if (result.Result == APPResult.RepeatPay)
            {
                return("4"); //重复交费
            }

            decimal dAmount = decimal.Parse(sAmount) / 100;

            //if (result.Pkorder.Amount != dAmount)
            //{
            //    return "6"; //金额不一致
            //}
            try
            {
                RechargeService.CheckCalculatingTempCost(result.Result);
            }
            catch (Exception ex)
            {
                return(((int)result.Result).ToString());
            }

            if (result.OrderSource == PayOrderSource.Platform)
            {
                bool testResult = CarService.WXTestClientProxyConnectionByPKID(result.ParkingID);
                if (!testResult)
                {
                    throw new MyException("车场网络异常,暂无法缴停车费!");
                }
                //int interfaceOrderState = InterfaceOrderServices.OrderWhetherEffective(result.Pkorder.OrderNo);

                int interfaceOrderState = InterfaceOrderServices.OrderWhetherEffective(result.Pkorder.OrderNo, result.ParkingID, result.Pkorder.TagID);
                if (interfaceOrderState != 1)
                {
                    if (interfaceOrderState == 2)
                    {
                        return("4"); //重复交费
                    }
                    else
                    {
                        return("5"); //订单已失效
                    }
                }
            }

            model.ParkCardNo   = result.CardNo;
            model.PKID         = result.ParkingID;
            model.PKName       = result.ParkName;
            model.InOutID      = result.Pkorder.TagID;
            model.PlateNo      = result.PlateNumber;
            model.EntranceTime = result.EntranceDate;
            model.ExitTime     = model.OrderTime.AddMinutes(result.OutTime);
            //model.Amount = result.Pkorder.Amount;
            model.Amount         = dAmount;
            model.PayDetailID    = result.Pkorder.OrderNo;
            model.DiscountAmount = result.Pkorder.DiscountAmount;
            // model.OrderSource = PayOrderSource.HAND;
            model.ExternalPKID = result.ExternalPKID;

            model.OrderID   = IdGenerator.Instance.GetId();
            model.Status    = OnlineOrderStatus.WaitPay;
            model.OrderType = OnlineOrderType.ParkFee;

            BaseCompany company = CompanyServices.QueryByParkingId(model.PKID);

            if (company == null)
            {
                throw new MyException("获取单位信息失败");
            }

            if (sTag == "0")
            {
                WX_ApiConfig config = WXApiConfigServices.QueryWXApiConfig(company.CPID);
                if (config == null)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "获取微信配置信息失败", "单位编号:" + company.CPID, LogFrom.WeiXin);
                    return("-1");
                }
                if (!config.Status)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "该车场暂停使用微信支付", "单位编号:" + company.CPID, LogFrom.WeiXin);
                    return("-1");
                }

                model.PayeeUser      = config.SystemName;
                model.PayeeAccount   = config.PartnerId;
                model.PayAccount     = sPayAccount;
                model.Payer          = sPayAccount;
                model.AccountID      = model.AccountID;
                model.CardId         = model.AccountID;
                model.PayeeChannel   = PaymentChannel.WeiXinPay;
                model.PaymentChannel = PaymentChannel.WeiXinPay;
                model.CompanyID      = config.CompanyID;

                bool isSuc = OnlineOrderServices.Create(model);
                if (!isSuc)
                {
                    throw new MyException("生成待缴费订单失败");
                }
            }
            else if (sTag == "1")
            {
                //支付宝
                AliPayApiConfig config = AliPayApiConfigServices.QueryAliPayConfig(company.CPID);
                if (config == null)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "获取支付宝配置信息失败[0001]", "单位编号:" + company.CPID, LogFrom.WeiXin);
                    return("-1");
                }
                if (!config.Status)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "该支付宝暂停使用", "单位编号:" + config.CompanyID, LogFrom.WeiXin);
                    return("-1");
                }

                model.AccountID      = string.Empty;
                model.CardId         = string.Empty;
                model.PayeeChannel   = PaymentChannel.AliPay;
                model.PaymentChannel = PaymentChannel.AliPay;
                model.PayeeUser      = config.SystemName;
                model.PayeeAccount   = config.PayeeAccount;
                model.Payer          = sPayAccount;
                model.PayAccount     = sPayAccount;
                model.CompanyID      = config.CompanyID;

                bool isSuc = OnlineOrderServices.Create(model);
                if (!isSuc)
                {
                    throw new MyException("生成待缴费订单失败");
                }
            }
            else if (sTag == "2")
            {
                //现金支付的
                model.AccountID  = string.Empty;
                model.CardId     = string.Empty;
                model.Payer      = sPayAccount;
                model.PayAccount = sPayAccount;
                model.CompanyID  = company.CPID;
            }

            //调用刷卡支付,如果内部出现异常则在页面上显示异常原因
            try
            {
                //int status=1;

                string tradeNo   = "";
                string sDataInfo = "";
                if (sTag == "0")    //微信
                {
                    if (!MicroPay.Run(model, out sDataInfo))
                    {
                        return("-2");
                    }
                    else
                    {
                        tradeNo = sDataInfo;
                        //发送通知开闸
                        bool isPayState = OnlineOrderServices.PaySuccess(model.OrderID, tradeNo, DateTime.Now, sPayAccount);
                        if (!isPayState)
                        {
                            throw new Exception("修改微信订单状态失败");
                        }

                        TxtLogServices.WriteTxtLogEx("WXPayReturn", string.Format("WXPayResult:{0}支付完成", tradeNo));
                    }
                }
                else if (sTag == "1")   //支付宝
                {
                    if (AliPayPay.Run(model, out sDataInfo) == false)
                    {
                        return("-3");
                    }
                    else
                    {
                        tradeNo = sDataInfo;

                        bool isPayState = OnlineOrderServices.PaySuccess(model.OrderID, tradeNo, DateTime.Now, sPayAccount);
                        if (!isPayState)
                        {
                            throw new Exception("修改支付宝订单状态失败");
                        }

                        TxtLogServices.WriteTxtLogEx("AliPayReturn", string.Format("AliPayShowResult:{0}支付完成", tradeNo));
                    }
                }
                else if (sTag == "2") //现金支付的
                {
                    TempStopPaymentResult payResult = RechargeService.WXTempStopPayment(result.Pkorder.OrderNo, (int)OrderPayWay.Cash, dAmount, sPKID, "", model.OrderID.ToString(), DateTime.Now);
                    TxtLogServices.WriteTxtLogEx("CashReturn", string.Format("CashShowResult:{1}:{0} 支付完成", payResult.ToXml(System.Text.Encoding.UTF8), dAmount));
                    if (payResult.Result != APPResult.Normal)
                    {
                        return("5");
                    }
                }

                //不是预支付的订单 就暂时不修改了
                //bool results = OnlineOrderServices.UpdatePrepayIdById(tradeNo, model.OrderID);
                //Response.Write("<span style='color:#00CD00;font-size:20px'>" + result + "</span>");
                ParkingFeeService.DeleteParkingFee(model.PlateNo + model.PKID);
                return("0");
            }
            //catch (WxPayException ex)
            //{
            //    return "1";
            //    //Response.Write("<span style='color:#FF0000;font-size:20px'>" + ex.ToString() + "</span>");
            //}
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("PayError", "该支付失败", "单位编号:" + model.CompanyID + "<br/>" + ex.StackTrace, LogFrom.UnKnown);
                return("-4");
                //Response.Write("<span style='color:#FF0000;font-size:20px'>" + ex.ToString() + "</span>");
            }
        }
Пример #8
0
        public ActionResult Czmx(decimal paymoney)
        {
            string auth = AppUserToken;

            if (auth.IsEmpty())
            {
                //没有登录
                //
                return(RedirectToAction("Index", "ErrorPrompt", new { message = "用户登录失败" }));
            }
            else if (auth == "-1")
            {
                return(RedirectToAction("Register", "ParkingPayment"));
            }

            //生成一个订单

            try
            {
                TxtLogServices.WriteTxtLog("4");
                BaseCompany company = CompanyServices.QueryCompanyByRecordId(CurrLoginWeiXinApiConfig.CompanyID);
                if (company == null)
                {
                    throw new MyException("获取单位信息失败");
                }

                WX_ApiConfig config = WXApiConfigServices.QueryWXApiConfig(company.CPID);
                if (config == null)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "获取微信配置信息失败", "单位编号:" + company.CPID, LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取微信配置信息失败!" }));
                }
                if (!config.Status)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "该车场暂停使用微信支付", "单位编号:" + company.CPID, LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "该车场暂停使用微信支付!" }));
                }
                if (config.CompanyID != WeiXinUser.CompanyID)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "微信用户所属公众号和当前公众号不匹配,不能支付", string.Format("支付单位:{0},微信用户单位:{1}", config.CompanyID, WeiXinUser.CompanyID), LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "微信用户所属公众号和当前公众号不匹配,不能支付!" }));
                }
                if (CurrLoginWeiXinApiConfig == null || config.CompanyID != CurrLoginWeiXinApiConfig.CompanyID)
                {
                    string loginCompanyId = CurrLoginWeiXinApiConfig != null ? CurrLoginWeiXinApiConfig.CompanyID : string.Empty;
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "车场所属公众号和当前公众号不匹配,不能支付", string.Format("支付单位:{0},微信用户单位:{1}", config.CompanyID, loginCompanyId), LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "车场所属公众号和当前公众号不匹配,不能支付!" }));
                }
                string sPhone = "";
                //获取绑定的手机
                WX_Account account = WeiXinAccountService.GetAccountByID(WeiXinUser.AccountID);
                if (account != null && !account.MobilePhone.IsEmpty())
                {
                    sPhone = account.MobilePhone;
                }

                if (sPhone.IsEmpty())
                {
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "您没有绑定APP账号,不能支付!" }));
                }


                OnlineOrder model = new OnlineOrder();
                model.OrderID        = IdGenerator.Instance.GetId();
                model.CardId         = "";
                model.PKID           = "";
                model.PKName         = "";
                model.EntranceTime   = DateTime.MinValue;
                model.ExitTime       = DateTime.MinValue;
                model.MonthNum       = 0;
                model.Amount         = paymoney;
                model.Status         = OnlineOrderStatus.WaitPay;
                model.PaymentChannel = PaymentChannel.WeiXinPay;
                model.Payer          = WeiXinUser.OpenID;
                model.PayAccount     = WeiXinUser.OpenID;
                model.OrderTime      = DateTime.Now;
                model.PayeeChannel   = PaymentChannel.WeiXinPay;
                model.AccountID      = WeiXinUser.AccountID;
                model.OrderType      = OnlineOrderType.APPRecharge;
                model.PlateNo        = sPhone;
                model.PayeeUser      = config.SystemName;
                model.PayeeAccount   = config.PartnerId;
                model.CompanyID      = config.CompanyID;
                model.Remark         = "APP余额充值";
                bool result = OnlineOrderServices.Create(model);
                if (!result)
                {
                    throw new MyException("余额失败[保存订单失败]");
                }

                switch (model.PaymentChannel)
                {
                case PaymentChannel.WeiXinPay:
                {
                    return(RedirectToAction("BalancePayment", "WeiXinPayment", new { orderId = model.OrderID }));
                }

                default: throw new MyException("支付方式错误");
                }
            }
            catch (MyException ex)
            {
                return(RedirectToAction("Index", "ErrorPrompt", new { message = ex.Message, returnUrl = "/PurseData/Index" }));;
            }
            catch (Exception ex)
            {
                return(RedirectToAction("Index", "ErrorPrompt", new { message = ex.Message, returnUrl = "/PurseData/Index" }));
            }
        }
Пример #9
0
        public ActionResult SubmitParkingPaymentRequest(OnlineOrder model)
        {
            try
            {
                int time = WXOtherConfigServices.GetTempParkingWeiXinPayTimeOut(model.CompanyID);
                if (model.OrderTime.AddMinutes(time - 1) < DateTime.Now)
                {
                    throw new MyException("页面等待超时,请重新点击“立即结算”按钮");
                }
                if (model.OrderSource == PayOrderSource.Platform)
                {
                    //int interfaceOrderState = InterfaceOrderServices.OrderWhetherEffective(model.PayDetailID);
                    int interfaceOrderState = InterfaceOrderServices.OrderWhetherEffective(model.PayDetailID, model.PKID, model.InOutID);
                    if (interfaceOrderState != 1)
                    {
                        string msg = interfaceOrderState == 2 ? "重复支付" : "订单已失效";
                        return(PageAlert("LicensePlatePayment", "ParkingPayment", new { RemindUserContent = msg }));
                    }
                }

                BaseCompany company = CompanyServices.QueryByParkingId(model.PKID);
                if (company == null)
                {
                    throw new MyException("获取单位信息失败");
                }

                WX_ApiConfig config = WXApiConfigServices.QueryWXApiConfig(company.CPID);
                if (config == null)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "获取微信配置信息失败", "单位编号:" + company.CPID, LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取微信配置信息失败!" }));
                }
                if (!config.Status)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "该车场暂停使用微信支付", "单位编号:" + company.CPID, LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "该车场暂停使用微信支付!" }));
                }
                if (config.CompanyID != WeiXinUser.CompanyID)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "微信用户所属公众号和当前公众号不匹配,不能支付", string.Format("支付单位:{0},微信用户单位:{1}", config.CompanyID, WeiXinUser.CompanyID), LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "微信用户所属公众号和当前公众号不匹配,不能支付!" }));
                }
                if (model.OrderSource == PayOrderSource.Platform && (CurrLoginWeiXinApiConfig == null || config.CompanyID != CurrLoginWeiXinApiConfig.CompanyID))
                {
                    string loginCompanyId = CurrLoginWeiXinApiConfig != null ? CurrLoginWeiXinApiConfig.CompanyID : string.Empty;
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "车场所属公众号和当前公众号不匹配,不能支付", string.Format("支付单位:{0},微信用户单位:{1}", config.CompanyID, loginCompanyId), LogFrom.WeiXin);
                    if (CurrLoginWeiXinApiConfig == null)
                    {
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取微信授权信息失败,请重试!" }));
                    }
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "车场所属公众号和当前公众号不匹配,不能支付!" }));
                }

                model.OrderID      = IdGenerator.Instance.GetId();
                model.Status       = OnlineOrderStatus.WaitPay;
                model.PayAccount   = WeiXinUser.OpenID;
                model.Payer        = WeiXinUser.OpenID;
                model.PayeeUser    = config.SystemName;
                model.PayeeAccount = config.PartnerId;
                model.OrderType    = OnlineOrderType.ParkFee;
                model.AccountID    = WeiXinUser.AccountID;
                model.Amount       = model.Amount;
                model.CardId       = WeiXinUser.AccountID;
                model.CompanyID    = config.CompanyID;
                bool result = OnlineOrderServices.Create(model);
                if (!result)
                {
                    throw new MyException("生成待缴费订单失败");
                }
                DateTime maxWaitTime = model.OrderTime.AddMinutes(time);
                switch (model.PaymentChannel)
                {
                case PaymentChannel.WeiXinPay:
                {
                    return(RedirectToAction("ParkCarPayment", "WeiXinPayment", new { orderId = model.OrderID, maxWaitTime = maxWaitTime }));
                }

                default: throw new MyException("支付方式错误");
                }
            }
            catch (MyException ex)
            {
                return(PageAlert("ComputeParkingFee", "ParkingPayment", new { licensePlate = model.PlateNo, RemindUserContent = ex.Message }));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "保存临停缴费订单失败", ex, LogFrom.WeiXin);
                return(PageAlert("ComputeParkingFee", "ParkingPayment", new { licensePlate = model.PlateNo, RemindUserContent = "提交支付失败" }));
            }
        }