public IActionResult UpdateDealPricing([FromBody] DealsPricing dealsPricing)
        {
            _serviceEndPoint = new ServicesEndPoint.GeneralSevices.ServicesEndPoint(_simbaToursUnitOfWork, _emailService);
            bool result = _serviceEndPoint.UpdateDealPricing(dealsPricing);

            return(Json(result));
        }
        public JsonResult GetSchedulesPricingById(int schedulesPricingId)
        {
            _serviceEndPoint = new ServicesEndPoint.GeneralSevices.ServicesEndPoint(_simbaToursUnitOfWork, _emailService);
            var result = _serviceEndPoint.GetSchedulesPricing().FirstOrDefault(p => p.SchedulesPricingId == schedulesPricingId);

            return(Json(result));
        }
        public IActionResult PostLocation([FromBody] Location location)
        {
            _serviceEndPoint = new ServicesEndPoint.GeneralSevices.ServicesEndPoint(_simbaToursUnitOfWork, _emailService);
            bool result = _serviceEndPoint.PostLocation(location);

            return(Json(new { Result = result }));
        }
        public IActionResult PostVehicle([FromBody] Vehicle vehicle)
        {
            _serviceEndPoint = new ServicesEndPoint.GeneralSevices.ServicesEndPoint(_simbaToursUnitOfWork, _emailService);
            bool result = _serviceEndPoint.PostVehicle(vehicle);

            return(Json(new { Result = result }));
        }
        public JsonResult GetHotelAddressById(int addressId)
        {
            _serviceEndPoint = new ServicesEndPoint.GeneralSevices.ServicesEndPoint(_simbaToursUnitOfWork, _emailService);
            Address result = _serviceEndPoint.GetHotelAddressById(addressId);

            return(Json(result));
        }
        public IActionResult PostHotelPricing([FromBody] HotelPricing hotelPricing)
        {
            _serviceEndPoint = new ServicesEndPoint.GeneralSevices.ServicesEndPoint(_simbaToursUnitOfWork, _emailService);
            bool result = _serviceEndPoint.PostHotelPricing(hotelPricing);

            return(Json(new { Result = result }));
        }
        public JsonResult GetHotelPricingById(int hotelPricingId)
        {
            _serviceEndPoint = new ServicesEndPoint.GeneralSevices.ServicesEndPoint(_simbaToursUnitOfWork, _emailService);
            HotelPricing result = _serviceEndPoint.GetHotelPricingById(hotelPricingId);

            return(Json(result));
        }
Пример #8
0
        public JsonResult GetTourClientByEmail(string emailAddress)
        {
            _serviceEndPoint = new ServicesEndPoint.GeneralSevices.ServicesEndPoint(_simbaToursUnitOfWork, _emailService);
            var tourClient = _serviceEndPoint.GetTourClient(emailAddress);

            return(Json(tourClient));
        }
        public JsonResult GetHotelLocationById(int locationId)
        {
            _serviceEndPoint = new ServicesEndPoint.GeneralSevices.ServicesEndPoint(_simbaToursUnitOfWork, _emailService);
            Location result = _serviceEndPoint.GetLocationById(locationId);

            return(Json(result));
        }
        public IActionResult UpdateHotel([FromBody] Hotel hotel)
        {
            _serviceEndPoint = new ServicesEndPoint.GeneralSevices.ServicesEndPoint(_simbaToursUnitOfWork, _emailService);
            bool result = _serviceEndPoint.UpdateHotel(hotel);

            return(Json(new { Result = result }));
        }
        public IActionResult UpdateSchedulesPricing([FromBody] SchedulesPricing schedulesPricing)
        {
            _serviceEndPoint = new ServicesEndPoint.GeneralSevices.ServicesEndPoint(_simbaToursUnitOfWork, _emailService);
            bool result = _serviceEndPoint.UpdateSchedulesPricing(schedulesPricing);

            return(Json(new { Result = result }));
        }
Пример #12
0
        public JsonResult GetAllHotelDetails()
        {
            _serviceEndPoint = new ServicesEndPoint.GeneralSevices.ServicesEndPoint(_simbaToursUnitOfWork, _emailService);

            var hotel = _serviceEndPoint.GetAllHotelDetails();

            return(Json(hotel));
        }
Пример #13
0
        public JsonResult GetTransportPricing()
        {
            _serviceEndPoint = new ServicesEndPoint.GeneralSevices.ServicesEndPoint(_simbaToursUnitOfWork, _emailService);

            TransportPricing[] pricing = _serviceEndPoint.GetTransportPricing();

            return(Json(pricing));
        }
Пример #14
0
        public JsonResult GetHotelPricing()
        {
            _serviceEndPoint = new ServicesEndPoint.GeneralSevices.ServicesEndPoint(_simbaToursUnitOfWork, _emailService);

            HotelPricing[] deals = _serviceEndPoint.GetHotelPricing();

            return(Json(deals));
        }
Пример #15
0
        public IActionResult MakePayment([FromBody] UserDetailViewModel userDetail)
        {
            _serviceEndPoint = new ServicesEndPoint.GeneralSevices.ServicesEndPoint(_simbaToursUnitOfWork, _emailService);
            TourClient tourClient = _serviceEndPoint.GetTourClient(userDetail.EmailAddress);

            var payPalRedirectUrl = ValidatePayment(tourClient, userDetail.CurrentPayment);

            payPalRedirectUrl += "&clientId=" + tourClient.TourClientId;
            //return Redirect(payPalRedirectUrl);
            return(Json(new { PayPalRedirectUrl = payPalRedirectUrl, PaymentCompletion = "Success", Message = "The payment will be acquired by Paypal reporting, and you will be informed by email whether successful. Wait for the email." }));
        }
Пример #16
0
        public JsonResult GetHotelLocationByHotelId(int hotelId)
        {
            _serviceEndPoint = new ServicesEndPoint.GeneralSevices.ServicesEndPoint(_simbaToursUnitOfWork, _emailService);
            Location result  = _serviceEndPoint.GetHotelLocationByHotelId(hotelId);
            Address  address = _serviceEndPoint.GetHotelAddressById(result.AddressId);

            return(Json(new LocationViewModel {
                LocationName = result.LocationName, Address = new AddressViewModel {
                    AddressId = address.AddressId, AddressLine1 = address.AddressLine1, AddressLine2 = address.AddressLine2, Country = address.Country, PostCode = address.PostCode, Town = address.Town, PhoneNumber = address.PhoneNumber
                }, AddressId = address.AddressId, LocationId = result.LocationId, Country = address.Country
            }));
        }
Пример #17
0
        public IActionResult BookTour([FromBody] TourClientViewModel tourClientModel)
        {
            try
            {
                _serviceEndPoint = new ServicesEndPoint.GeneralSevices.ServicesEndPoint(_simbaToursUnitOfWork, _emailService);
                var tourClient = AutoMapper.Mapper.Map <TourClientViewModel, TourClient>(tourClientModel);

                List <Item>             mealItems    = new List <Item>();
                List <Item>             laguageItems = new List <Item>();
                List <VehicleViewModel> vehicles     = new List <VehicleViewModel>();

                var     unitPayment      = _serviceEndPoint.GetLaguagePricing()[0];
                var     unitPaymentMeal  = _serviceEndPoint.GetMealPricing()[0];
                var     vehiclePayment   = _serviceEndPoint.GetTransportPricing()[0];
                decimal runningCostItems = 0.00M;

                IterateThroughMeals(mealItems, ref runningCostItems, unitPaymentMeal, tourClientModel, tourClient);
                IterateThroughLaguageAssortments(laguageItems, mealItems, ref runningCostItems, unitPaymentMeal, unitPayment, tourClientModel, tourClient);
                IterateThroughVehicles(tourClientModel, vehiclePayment, ref runningCostItems);

                tourClient.GrossTotalCosts += runningCostItems;
                _serviceEndPoint            = new ServicesEndPoint.GeneralSevices.ServicesEndPoint(_simbaToursUnitOfWork, _emailService);
                tourClient.DateCreated      = DateTime.Now;
                tourClient.DateUpdated      = DateTime.Now;

                tourClient.HasFullyPaid = false;

                var isBooked = _serviceEndPoint.BookSafariPackage(tourClient, mealItems.ToArray(), laguageItems.ToArray());
                if (isBooked)
                {
                    var tourClientFullView = _serviceEndPoint.GetTourClientById(tourClient.TourClientId);
                    var payPalRedirectUrl  = ValidatePayment(tourClientFullView, tourClient.CurrentPayment);
                    payPalRedirectUrl += "&clientId=" + tourClient.TourClientId;
                    return(Json(new { Result = isBooked, PayPalRedirectUrl = payPalRedirectUrl, }));
                    //return Redirect(payPalRedirectUrl);
                }
                else
                {
                    return(Json(new { Result = false, Message = "Failed To Book Tour. Please contact the administrators of the site!" }));
                }
            }
            catch (Exception e)
            {
                return(Json(new { Result = false, Message = e.Message, StackTrace = e.StackTrace }));
            }
        }
Пример #18
0
        private string ValidatePayment(TourClient tourClient, decimal amountToPay)
        {
            _serviceEndPoint = new ServicesEndPoint.GeneralSevices.ServicesEndPoint(_simbaToursUnitOfWork, _emailService);
            var productArray = new List <Product>();

            if (tourClient != null)
            {
                productArray.Add(new Product
                {
                    ProductName   = tourClient.Hotel.Location.LocationName + "-" + tourClient.Hotel.HotelName,
                    Amount        = amountToPay,
                    HasPaidInfull = amountToPay == tourClient.GrossTotalCosts - tourClient.PaidInstallments
                });
            }
            _serviceEndPoint.SavePayment(tourClient, amountToPay);
            var paymentGateway = new PaymentGateway(_applicationConstants.Value.BaseUrl, _applicationConstants.Value.BusinessEmail, _applicationConstants.Value.SuccessUrl, _applicationConstants.Value.CancelUrl, _applicationConstants.Value.NotifyUrl, tourClient.EmailAddress);

            return(paymentGateway.MakePaymentByPaypal(productArray));
        }
Пример #19
0
        public JsonResult GetHotelLocations()
        {
            _serviceEndPoint = new ServicesEndPoint.GeneralSevices.ServicesEndPoint(_simbaToursUnitOfWork, _emailService);
            Location[] locations = _serviceEndPoint.GetAllHotelLocations();

            var locationsViewModel = new List <LocationViewModel>();

            Array.ForEach(locations, result =>
            {
                Address address = _serviceEndPoint.GetHotelAddressById(result.AddressId);
                locationsViewModel.Add(new LocationViewModel {
                    LocationName = result.LocationName,
                    Address      = new AddressViewModel {
                        AddressId    = address.AddressId, AddressLine1 = address.AddressLine1,
                        AddressLine2 = address.AddressLine2, Country = address.Country,
                        PostCode     = address.PostCode, Town = address.Town, PhoneNumber = address.PhoneNumber
                    },
                    AddressId = address.AddressId, LocationId = result.LocationId, Country = address.Country
                });
            });
            return(Json(locationsViewModel.ToArray()));
        }
Пример #20
0
        public JsonResult CheckAndValidatePaypalPayments(FormCollection formsCollection)
        {
            decimal amountPaid = Decimal.Parse(formsCollection["amount"]);
            int     clientId   = Int32.Parse(formsCollection["clientId"]);

            try
            {
                _serviceEndPoint = new ServicesEndPoint.GeneralSevices.ServicesEndPoint(_simbaToursUnitOfWork, _emailService);
                var client = _serviceEndPoint.GetTourClientById(clientId);

                client.CurrentPayment    = amountPaid;
                client.PaidInstallments += amountPaid;
                client.HasFullyPaid      = client.GrossTotalCosts <= client.PaidInstallments;

                _serviceEndPoint.UpdateClientPayments(client);
                return(Json(new { Result = "Success" }));
            }
            catch (Exception e)
            {
                //email exception to admin email
                return(Json(new { Result = "Failed" }));
            }
        }