Ejemplo n.º 1
0
        public async Task <ActionResult> Fees(MarketFeesModel marketFees)
        {
            _commandBus.Send(new UpdateFees
            {
                CompanyId = AppConstants.CompanyId,
                Fees      = marketFees.Fees.Select(f => new Fees
                {
                    Market       = f.Key == "Local" ? null : f.Key,
                    Booking      = f.Value.Booking,
                    Cancellation = f.Value.Cancellation,
                    NoShow       = f.Value.NoShow
                }).ToList()
            });

            TempData["Info"] = "Fees updated";

            // Wait for fees to be updated before reloading the page
            await Task.Delay(2000);

            return(RedirectToAction("Fees"));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> Fees()
        {
            var fees            = _feesDao.GetAll();
            var feesPreferences = new MarketFeesModel();

            var localFees = fees.FirstOrDefault(f => !f.Market.HasValue());

            if (localFees == null)
            {
                // Create empty entry
                feesPreferences.Fees.Add("Local",
                                         new FeeStructure
                {
                    Booking      = 0.00m,
                    Cancellation = 0.00m,
                    NoShow       = 0.00m
                });
            }
            else
            {
                feesPreferences.Fees.Add("Local", localFees.SelectOrDefault(f =>
                                                                            new FeeStructure
                {
                    Booking      = f.Booking,
                    Cancellation = f.Cancellation,
                    NoShow       = f.NoShow
                }));
            }

            // Fetch only market fees for markets that are available to the company
            var roamingCompaniesPreferences = await _taxiHailNetworkService.GetRoamingCompanyPreferences(_serverSettings.ServerData.TaxiHail.ApplicationKey);

            if (roamingCompaniesPreferences != null)
            {
                foreach (var market in roamingCompaniesPreferences.Keys)
                {
                    var marketFee = fees.FirstOrDefault(f => f.Market == market);
                    if (marketFee == null)
                    {
                        // Create empty entry
                        feesPreferences.Fees.Add(market,
                                                 new FeeStructure
                        {
                            Booking      = 0.00m,
                            Cancellation = 0.00m,
                            NoShow       = 0.00m
                        });
                    }
                    else
                    {
                        feesPreferences.Fees.Add(market,
                                                 new FeeStructure
                        {
                            Booking      = marketFee.Booking,
                            Cancellation = marketFee.Cancellation,
                            NoShow       = marketFee.NoShow
                        });
                    }
                }
            }

            var paymentSettings = _serverSettings.GetPaymentSettings();

            if (paymentSettings.PaymentMode != PaymentMethod.Cmt &&
                paymentSettings.PaymentMode != PaymentMethod.RideLinqCmt)
            {
                TempData["Info"] = "Fees will only be processed if payment is configured for CMT or CMT RideLinQ";
            }

            return(View(feesPreferences));
        }