Esempio n. 1
0
        public ActionResult Index()
        {
            var mobileAutoPayments = repo.MobileAutoPayments.GetAll(m => m.CustomerID == WebSecurity.CurrentUserId).ToList();
            var model = mobileAutoPayments.Select(m => new MobileAutoPayModel()
            {
                MobileAutoPayID = m.MobileAutoPayID,
                Amount          = m.Amount,
                IntervalHours   = m.Interval.Hours,
                IntervalMinutes = m.Interval.Minutes,
                IntervalDays    = m.Interval.Days,
                MobileNumber    = m.MobileNumber,
                CardNumber      = CardAccountModule.ConvertCardNumberString(service.GetCardAccountById(m.PayCardId).CardNumber),
                Operator        = m.MobileOperator,
                StartDate       = m.StartDate,
                StartHours      = m.StartDate.Hour,
                StartMinutes    = m.StartDate.Minute,
                LastPayDate     = m.LastExecutionDate
            }).ToList();

            var customer = repo.Customers.GetSingle(WebSecurity.CurrentUserId);

            ViewBag.FirstName  = customer.FirstName;
            ViewBag.MiddleName = customer.MiddleName;
            ViewBag.LastName   = customer.LastName;
            return(View(model));
        }
Esempio n. 2
0
        public PartialViewResult CardAccountsPartial(string cardNumber, string cardId)
        {
            var cardAccounts = service.GetCardAccountsByCustomerId(WebSecurity.CurrentUserId);

            foreach (var c in cardAccounts)
            {
                if (c.ExpiredDate <= Time.GetTime() && c.Status != "Истек срок действия" && !c.IsLocked)
                {
                    c.Status = "Истек срок действия";
                }
            }
            if (cardAccounts.Any())
            {
                IEnumerable <CardAccountModel> cardAcountModels = cardAccounts
                                                                  .Select(c => new CardAccountModel()
                {
                    CardAccount = c,
                    Currency    = service.GetBankAccountCurrencyShortString(c.BankAccountID),
                    Balance     = service.GetBankAccountBalance(c.BankAccountID),
                    CardNumber  = CardAccountModule.ConvertCardNumberString(c.CardNumber)
                });

                var cardExists =
                    cardAccounts.Any(c => (c.CardNumber == cardNumber) || (c.CardAccountID.ToString() == cardId));
                var selectCardId = cardExists
                    ? cardAccounts.First(c => (c.CardNumber == cardNumber) || (c.CardAccountID.ToString() == cardId))
                                   .CardAccountID.ToString()
                    : cardAccounts.First().CardAccountID.ToString();

                CardAccountsModel model = new CardAccountsModel()
                {
                    CardAccounts        = cardAcountModels,
                    SelectCardAccountId = selectCardId
                };

                return(PartialView("CardAccountsPartial", model));
            }
            else
            {
                CardAccountsModel model = new CardAccountsModel()
                {
                    CardAccounts        = new List <CardAccountModel>(),
                    SelectCardAccountId = "0"
                };

                return(PartialView("CardAccountsPartial", model));
            }
        }
Esempio n. 3
0
        public PartialViewResult CardAccountsSelectPartial()
        {
            var cardAccounts = service.GetCardAccountsByCustomerId(WebSecurity.CurrentUserId);

            if (cardAccounts.Any())
            {
                IEnumerable <CardAccountModel> cardAcountModels = cardAccounts
                                                                  .Select(c => new CardAccountModel()
                {
                    CardAccount = c,
                    Currency    = service.GetBankAccountCurrencyShortString(c.BankAccountID),
                    Balance     = service.GetBankAccountBalance(c.BankAccountID),
                    CardNumber  = CardAccountModule.ConvertCardNumberString(c.CardNumber)
                });

                return(PartialView("CardAccountsSelectPartial", cardAcountModels));
            }
            else
            {
                return(PartialView("CardAccountsSelectPartial", new List <CardAccountModel>()));
            }
        }
Esempio n. 4
0
        public ActionResult Details(string Id)
        {
            var custome = repo.Customers.GetSingle(WebSecurity.CurrentUserId);

            ViewBag.FirstName  = custome.FirstName;
            ViewBag.MiddleName = custome.MiddleName;
            ViewBag.LastName   = custome.LastName;

            if (Id == null)
            {
                return(View("Index"));
            }
            var autoPay = repo.MobileAutoPayments.GetSingle(Int32.Parse(Id));

            if (autoPay == null)
            {
                return(View("Index"));
            }

            CardAccount        c     = service.GetCardAccountById(autoPay.PayCardId);
            MobileAutoPayModel model = new MobileAutoPayModel()
            {
                CardNumber      = CardAccountModule.ConvertCardNumberString(c.CardNumber),
                Amount          = autoPay.Amount,
                IntervalDays    = autoPay.Interval.Days,
                IntervalHours   = autoPay.Interval.Hours,
                CardAccountID   = autoPay.PayCardId,
                IntervalMinutes = autoPay.Interval.Minutes,
                LastPayDate     = autoPay.LastExecutionDate,
                StartDate       = autoPay.StartDate,
                MobileNumber    = autoPay.MobileNumber,
                Operator        = autoPay.MobileOperator
            };

            return(View(model));
        }
Esempio n. 5
0
        public ActionResult SSIS(SSISPaymentModel model, FormCollection collection)
        {
            int cardId;

            if (!int.TryParse(collection["item.CardAccount.CardAccountID"], out cardId))
            {
                ModelState.Clear();
                ModelState.AddModelError("CustomError", "Карта не найдена");
                return(View(model));
            }
            else if (ModelState.IsValid)
            {
                Customer customer = rep.Customers.GetSingle(WebSecurity.CurrentUserId);
                if (customer.IsLocked)
                {
                    ModelState.Clear();
                    ModelState.AddModelError("CustomError", "Ваш аккаунт заблокирован");
                    return(View(model));
                }
                model.CardAccountID = cardId;
                CardAccount c = service.GetCardAccountById(cardId);
                if (c == null)
                {
                    ModelState.Clear();
                    ModelState.AddModelError("CustomError", "Карта не найдена");
                    return(View(model));
                }
                model.CardNumber = CardAccountModule.ConvertCardNumberString(c.CardNumber);
                if (c.IsLocked)
                {
                    ModelState.Clear();
                    ModelState.AddModelError("CustomError", "Ваша платежная карта заблокирована");
                    return(View(model));
                }
                if (c.ExpiredDate < Time.GetTime())
                {
                    c.Status = "Истек срок действия";
                    service.UpdateCardAccount(c);
                    ModelState.Clear();
                    ModelState.AddModelError("CustomError", "Истек срок действия карты");
                    return(View(model));
                }
                var bankAccount = service.GetBankAccountById(c.BankAccountID);
                if (bankAccount == null)
                {
                    ModelState.Clear();
                    ModelState.AddModelError("CustomError", "Ошибка базы");
                    return(View(model));
                }
                if (bankAccount.CurrencyID != 1)
                {
                    ModelState.Clear();
                    ModelState.AddModelError("CustomError", "Оплата в системе ЕРИП возможна только в беларусских рублях");
                    return(View(model));
                }
                if (model.Amount <= 0)
                {
                    ModelState.Clear();
                    ModelState.AddModelError("CustomError", "Сумма должна быть больше нуля");
                    return(View(model));
                }
                if (!service.IsEnoughBalance(cardId, model.Amount))
                {
                    ModelState.Clear();
                    ModelState.AddModelError("CustomError", "Недостаточно средств на счете");
                    return(View(model));
                }
                return(RedirectToAction("ConfirmSSIS", model));
            }
            else
            {
                return(View(model));
            }
        }
Esempio n. 6
0
        public ActionResult Transfer(TransferModel paymentInfo, FormCollection collection)
        {
            int cardId;

            if (!int.TryParse(collection["item.CardAccount.CardAccountID"], out cardId))
            {
                ModelState.Clear();
                ModelState.AddModelError("CustomError", "Карта не найдена");
                return(View(paymentInfo));
            }
            else if (ModelState.IsValid)
            {
                Customer customer = rep.Customers.GetSingle(WebSecurity.CurrentUserId);
                if (customer.IsLocked)
                {
                    ModelState.Clear();
                    ModelState.AddModelError("CustomError", "Ваш аккаунт заблокирован");
                    return(View(paymentInfo));
                }
                paymentInfo.CardId = cardId;
                CardAccount c = service.GetCardAccountById(cardId);
                if (c == null)
                {
                    ModelState.Clear();
                    ModelState.AddModelError("CustomError", "Карта не найдена");
                    return(View(paymentInfo));
                }
                paymentInfo.CardNumber = CardAccountModule.ConvertCardNumberString(c.CardNumber);
                if (c.IsLocked)
                {
                    ModelState.Clear();
                    ModelState.AddModelError("CustomError", "Ваша платежная карта заблокирована");
                    return(View(paymentInfo));
                }
                if (c.ExpiredDate < Time.GetTime())
                {
                    c.Status = "Истек срок действия";
                    service.UpdateCardAccount(c);
                    ModelState.Clear();
                    ModelState.AddModelError("CustomError", "Истек срок действия карты");
                    return(View(paymentInfo));
                }
                var targetCard = service.GetCardAccountByNumber(paymentInfo.TargetCardAccountNumber);
                if (targetCard == null)
                {
                    ModelState.Clear();
                    ModelState.AddModelError("CustomError", "Не найдена карта с таким номером");
                    return(View(paymentInfo));
                }
                var bankAccount       = service.GetBankAccountById(c.BankAccountID);
                var targetBankAccount = service.GetBankAccountById(targetCard.BankAccountID);
                if (targetBankAccount == null || bankAccount == null)
                {
                    ModelState.Clear();
                    ModelState.AddModelError("CustomError", "Ошибка базы");
                    return(View(paymentInfo));
                }
                paymentInfo.TargetCardAccountId = targetCard.CardAccountID;
                if (targetBankAccount.BankAccountID == bankAccount.BankAccountID)
                {
                    ModelState.Clear();
                    ModelState.AddModelError("CustomError", "Нельзя переводить на этот же счет");
                    return(View(paymentInfo));
                }
                var currency       = service.GetCurrencyById(bankAccount.CurrencyID);
                var targetCurrency = service.GetCurrencyById(targetBankAccount.CurrencyID);
                if (currency.CurrencyID != targetCurrency.CurrencyID)
                {
                    ModelState.Clear();
                    ModelState.AddModelError("CustomError", "Разные валюты");
                    return(View(paymentInfo));
                }
                if (paymentInfo.Amount <= 0)
                {
                    ModelState.Clear();
                    ModelState.AddModelError("CustomError", "Сумма должна быть больше нуля");
                    return(View(paymentInfo));
                }
                if (!service.IsEnoughBalance(cardId, paymentInfo.Amount))
                {
                    ModelState.Clear();
                    ModelState.AddModelError("CustomError", "Недостаточно средств на счете");
                    return(View(paymentInfo));
                }
                return(RedirectToAction("ConfirmTransfer", paymentInfo));
            }
            else
            {
                return(View(paymentInfo));
            }
        }
Esempio n. 7
0
        public ActionResult Index(FormCollection collection)
        {
            List <HistoryItemModel>       HistoryItems = new List <HistoryItemModel>();
            Dictionary <int, CardAccount> CardAccounts = new Dictionary <int, CardAccount>();
            RouteValueDictionary          RouteValues  = new RouteValueDictionary();

            #region parsing

            List <string> cardIds = new List <string>();
            if (collection["item.CardAccount.CardAccountID"] == null)
            {
                return(View("Index", (object)"Не найдена информация о платежных картах"));
            }
            cardIds = collection["item.CardAccount.CardAccountID"].Split(',').Where(id => id != "false").ToList();

            if (cardIds.Any() == false)
            {
                return(View("Index", (object)"Не выбрана ни одна из карт"));
            }
            RouteValues.Add("item.CardAccount.CardAccountID", collection["item.CardAccount.CardAccountID"]);


            var      dateFrom = collection["datepicker-from"];
            var      dateTo   = collection["datepicker-to"];
            DateTime DateFrom;
            DateTime DateTo;
            try
            {
                DateFrom = String.IsNullOrEmpty(dateFrom) ? DateTime.MinValue : DateTime.Parse(dateFrom);
                DateTo   = String.IsNullOrEmpty(dateTo) ? DateTime.MaxValue : DateTime.Parse(dateTo);
            }
            catch (Exception ex)
            {
                return(View("Index", (object)ex.Message));
            }
            RouteValues.Add("datepicker-from", collection["datepicker-from"]);
            RouteValues.Add("datepicker-to", collection["datepicker-to"]);

            var arbitraryPaymentsParam = collection["arbitrary_payments"];
            var ssispPaymentsParam     = collection["ssisp_payments"];
            var mobilePaymentsParam    = collection["mobile_payments"];
            var transferPaymentsParam  = collection["transfer_payments"];
            if ((arbitraryPaymentsParam == null) && (ssispPaymentsParam == null) && (mobilePaymentsParam == null) &&
                (transferPaymentsParam == null))
            {
                return(View("Index", (object)"Ни один из типов платежей не выбран"));
            }

            RouteValues.Add("arbitrary_payments", collection["arbitrary_payments"]);
            RouteValues.Add("ssisp_payments", collection["ssisp_payments"]);
            RouteValues.Add("mobile_payments", collection["mobile_payments"]);
            RouteValues.Add("transfer_payments", collection["transfer_payments"]);
            #endregion parsing

            #region fill

            foreach (var cardId in cardIds)
            {
                var id = Int32.Parse(cardId);
                CardAccounts.Add(id, service.GetCardAccountById(id));
            }

            if (arbitraryPaymentsParam != null)
            {
                foreach (var cardId in cardIds)
                {
                    var payments = service.GetArbitraryTransactionsByCardId(Int32.Parse(cardId), DateFrom, DateTo);
                    if (payments != null && payments.Any())
                    {
                        foreach (var payment in payments)
                        {
                            HistoryItems.Add(new HistoryItemModel()
                            {
                                Amount        = payment.Amount,
                                CardNumber    = CardAccountModule.ConvertCardNumberString(CardAccounts[payment.CardAccountID].CardNumber),
                                Currency      = service.GetBankAccountCurrencyShortString(CardAccounts[payment.CardAccountID].BankAccountID),
                                Date          = payment.Date,
                                Recipient     = payment.Recipient,
                                TransactionId = payment.ArbitraryTransactionID,
                                Type          = payment.Type
                            });
                        }
                    }
                }
            }
            if (ssispPaymentsParam != null)
            {
                foreach (var cardId in cardIds)
                {
                    var payments = service.GetSSISTransactionsByCardId(Int32.Parse(cardId), DateFrom, DateTo);
                    if (payments != null && payments.Any())
                    {
                        foreach (var payment in payments)
                        {
                            HistoryItems.Add(new HistoryItemModel()
                            {
                                Amount        = payment.Amount,
                                CardNumber    = CardAccountModule.ConvertCardNumberString(CardAccounts[payment.CardAccountID].CardNumber),
                                Currency      = service.GetBankAccountCurrencyShortString(CardAccounts[payment.CardAccountID].BankAccountID),
                                Date          = payment.Date,
                                Recipient     = rep.SSISPayments.GetSingle(payment.SSISPaymentID).Name,
                                TransactionId = payment.SSISTransactionID,
                                Type          = payment.Type
                            });
                        }
                    }
                }
            }
            if (mobilePaymentsParam != null)
            {
                foreach (var cardId in cardIds)
                {
                    var payments = service.GetMobileTransactionsByCardId(Int32.Parse(cardId), DateFrom, DateTo);
                    if (payments != null && payments.Any())
                    {
                        foreach (var payment in payments)
                        {
                            HistoryItems.Add(new HistoryItemModel()
                            {
                                Amount        = payment.Amount,
                                CardNumber    = CardAccountModule.ConvertCardNumberString(CardAccounts[payment.CardAccountID].CardNumber),
                                Currency      = service.GetBankAccountCurrencyShortString(CardAccounts[payment.CardAccountID].BankAccountID),
                                Date          = payment.Date,
                                Recipient     = payment.MobileProvider,
                                TransactionId = payment.MobileTransactionID,
                                Type          = payment.Type
                            });
                        }
                    }
                }
            }
            if (transferPaymentsParam != null)
            {
                foreach (var cardId in cardIds)
                {
                    var payments = service.GetTransferTransactionsByCardId(Int32.Parse(cardId), DateFrom, DateTo);
                    if (payments != null && payments.Any())
                    {
                        foreach (var payment in payments)
                        {
                            HistoryItems.Add(new HistoryItemModel()
                            {
                                Amount        = payment.Amount,
                                CardNumber    = CardAccountModule.ConvertCardNumberString(CardAccounts[payment.CardAccountID].CardNumber),
                                Currency      = service.GetBankAccountCurrencyShortString(CardAccounts[payment.CardAccountID].BankAccountID),
                                Date          = payment.Date,
                                Recipient     = payment.Number,
                                TransactionId = payment.TransferTransactionID,
                                Type          = payment.Type
                            });
                        }
                    }
                }
            }
            #endregion fill

            HistoryListModel model = new HistoryListModel()
            {
                BackRouteValues = RouteValues,
                Items           = HistoryItems.OrderBy(x => x.Date).ToList()
            };

            return(View("HistoryList", model));
        }
Esempio n. 8
0
        public ActionResult HistoryList(FormCollection collection)
        {
            var id   = collection["id"];
            var type = collection["type"];

            if (id == null || type == null)
            {
                return(RedirectToAction("Index"));
            }

            RouteValueDictionary RouteValues = new RouteValueDictionary();

            RouteValues.Add("item.CardAccount.CardAccountID", collection["item.CardAccount.CardAccountID"]);
            RouteValues.Add("datepicker-from", collection["datepicker-from"]);
            RouteValues.Add("datepicker-to", collection["datepicker-to"]);
            RouteValues.Add("arbitrary_payments", collection["arbitrary_payments"]);
            RouteValues.Add("ssisp_payments", collection["ssisp_payments"]);
            RouteValues.Add("mobile_payments", collection["mobile_payments"]);
            RouteValues.Add("transfer_payments", collection["transfer_payments"]);

            if (type == PaymentType.Mobile.ToString())
            {
                var mobileTransaction = service.GetMobileTransactionById(Int32.Parse(id));
                var cardAccout        = service.GetCardAccountById(mobileTransaction.CardAccountID);
                var bankAccout        = service.GetBankAccountById(cardAccout.BankAccountID);
                var currency          = service.GetCurrencyById(bankAccout.CurrencyID);

                HistoryPaymentDetails info = new HistoryPaymentDetails();
                info.BackRouteValues = RouteValues;
                info.Dictionary      = new Dictionary <string, string>();
                info.Dictionary.Add("Дата", mobileTransaction.Date.ToString());
                info.Dictionary.Add("Номер карты", CardAccountModule.ConvertCardNumberString(cardAccout.CardNumber));
                info.Dictionary.Add("Оператор", mobileTransaction.MobileProvider);
                info.Dictionary.Add("Номер телефона", mobileTransaction.Phone);
                info.Dictionary.Add("Сумма", mobileTransaction.Amount + " " + currency.ShortName);

                return(View("Details", info));
            }

            if (type == PaymentType.Arbitrary.ToString())
            {
                var transaction = service.GetArbitraryTransactionById(Int32.Parse(id));
                var cardAccout  = service.GetCardAccountById(transaction.CardAccountID);
                var bankAccout  = service.GetBankAccountById(cardAccout.BankAccountID);
                var currency    = service.GetCurrencyById(bankAccout.CurrencyID);

                HistoryPaymentDetails info = new HistoryPaymentDetails();
                info.BackRouteValues = RouteValues;
                info.Dictionary      = new Dictionary <string, string>();
                info.Dictionary.Add("Дата", transaction.Date.ToString());
                info.Dictionary.Add("Номер карты", CardAccountModule.ConvertCardNumberString(cardAccout.CardNumber));
                info.Dictionary.Add("УНП", transaction.UNP);
                info.Dictionary.Add("Номер счета получателя", transaction.RecipientAccount);
                info.Dictionary.Add("Получатель", transaction.Recipient);
                info.Dictionary.Add("Цель", transaction.Target);
                info.Dictionary.Add("Сумма", transaction.Amount + " " + currency.ShortName);

                return(View("Details", info));
            }

            if (type == PaymentType.Transfer.ToString())
            {
                var transaction = service.GetTransferTransactionById(Int32.Parse(id));
                var cardAccout  = service.GetCardAccountById(transaction.CardAccountID);
                var bankAccout  = service.GetBankAccountById(cardAccout.BankAccountID);
                var currency    = service.GetCurrencyById(bankAccout.CurrencyID);

                HistoryPaymentDetails info = new HistoryPaymentDetails();
                info.BackRouteValues = RouteValues;
                info.Dictionary      = new Dictionary <string, string>();
                info.Dictionary.Add("Дата", transaction.Date.ToString());
                info.Dictionary.Add("Номер карты", CardAccountModule.ConvertCardNumberString(cardAccout.CardNumber));
                string targetNumber = service.GetCardAccountById(transaction.TargetCardAccountID).CardNumber;
                info.Dictionary.Add("Номер карты получателя", CardAccountModule.ConvertCardNumberString(targetNumber));
                info.Dictionary.Add("Сумма", transaction.Amount + " " + currency.ShortName);

                return(View("Details", info));
            }

            if (type == PaymentType.SSIS.ToString())
            {
                var transaction = service.GetSSISTransactionById(Int32.Parse(id));
                var cardAccout  = service.GetCardAccountById(transaction.CardAccountID);
                var bankAccout  = service.GetBankAccountById(cardAccout.BankAccountID);
                var currency    = service.GetCurrencyById(bankAccout.CurrencyID);
                var payment     = rep.SSISPayments.GetSingle(transaction.SSISPaymentID);

                HistoryPaymentDetails info = new HistoryPaymentDetails();
                info.BackRouteValues = RouteValues;
                info.Dictionary      = new Dictionary <string, string>();
                info.Dictionary.Add("Дата", transaction.Date.ToString());
                info.Dictionary.Add("Номер карты", CardAccountModule.ConvertCardNumberString(cardAccout.CardNumber));
                info.Dictionary.Add("Имя ЕРИП платежа", payment.Name);
                info.Dictionary.Add(payment.NumberLabel, transaction.Number);
                info.Dictionary.Add("Сумма", transaction.Amount + " " + currency.ShortName);

                return(View("Details", info));
            }

            return(View("Index"));
        }
Esempio n. 9
0
        public ActionResult Create(MobileAutoPayModel model, FormCollection collection)
        {
            var custome = repo.Customers.GetSingle(WebSecurity.CurrentUserId);

            ViewBag.FirstName  = custome.FirstName;
            ViewBag.MiddleName = custome.MiddleName;
            ViewBag.LastName   = custome.LastName;

            string language = "ru";
            string culture  = "RU";

            Thread.CurrentThread.CurrentCulture   = CultureInfo.GetCultureInfo(string.Format("{0}-{1}", language, culture));
            Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(string.Format("{0}-{1}", language, culture));

            DateTime date =
                DateTime.ParseExact(collection["StartDate"], "dd.MM.yyyy", CultureInfo.CurrentCulture);

            model.StartDate = date;
            ModelState.Clear();

            int cardId;

            if (!int.TryParse(collection["item.CardAccount.CardAccountID"], out cardId))
            {
                ModelState.Clear();
                ModelState.AddModelError("CustomError", "Карта не найдена");
                return(View(model));
            }
            else if (ModelState.IsValid)
            {
                if ((model.IntervalDays <= 0) && (model.IntervalHours <= 0) && (model.IntervalMinutes <= 0))
                {
                    ModelState.Clear();
                    ModelState.AddModelError("CustomError", "Интервал должен быть положительным");
                    return(View(model));
                }
                Customer customer = repo.Customers.GetSingle(WebSecurity.CurrentUserId);
                if (customer.IsLocked)
                {
                    ModelState.Clear();
                    ModelState.AddModelError("CustomError", "Ваш аккаунт заблокирован");
                    return(View(model));
                }
                model.CardAccountID = cardId;
                CardAccount c = service.GetCardAccountById(cardId);
                if (c == null)
                {
                    ModelState.Clear();
                    ModelState.AddModelError("CustomError", "Карта не найдена");
                    return(View(model));
                }
                model.CardNumber = CardAccountModule.ConvertCardNumberString(c.CardNumber);
                if (c.IsLocked)
                {
                    ModelState.Clear();
                    ModelState.AddModelError("CustomError", "Ваша платежная карта заблокирована");
                    return(View(model));
                }
                if (c.ExpiredDate < Time.GetTime())
                {
                    c.Status = "Истек срок действия";
                    service.UpdateCardAccount(c);
                    ModelState.Clear();
                    ModelState.AddModelError("CustomError", "Истек срок действия карты");
                    return(View(model));
                }

                var bankAccount = service.GetBankAccountById(c.BankAccountID);
                if (bankAccount == null)
                {
                    ModelState.Clear();
                    ModelState.AddModelError("CustomError", "Ошибка базы");
                    return(View(model));
                }
                if (bankAccount.CurrencyID != 1)
                {
                    ModelState.Clear();
                    ModelState.AddModelError("CustomError", "Оплату мобильной связи можно проводить только беларусскими рублями");
                    return(View(model));
                }
                if (model.Amount <= 0)
                {
                    ModelState.Clear();
                    ModelState.AddModelError("CustomError", "Сумма должна быть больше нуля");
                    return(View(model));
                }
                if (!service.IsEnoughBalance(cardId, model.Amount))
                {
                    ModelState.Clear();
                    ModelState.AddModelError("CustomError", "Недостаточно средств на счете");
                    return(View(model));
                }
                model.StartDate = model.StartDate.AddMinutes(model.StartMinutes);
                model.StartDate = model.StartDate.AddHours(model.StartHours);
                return(RedirectToAction("ConfirmAutoPay", model));
            }
            else
            {
                return(View(model));
            }
        }