Esempio n. 1
0
        private HotelRateProviderRes ConvertToProviderResponse(AvailabilityRS request)
        {
            Logger.Instance.LogFunctionEntry(this.GetType().Name, "ConvertToProviderResponse");
            HotelRateProviderRes hotelResultRS = new HotelRateProviderRes();

            //if (request.hotels != null)
            //    hotelResultRS.Hotels = request.hotels.hotels;
            //else
            //    hotelResultRS.Hotels = null;
            //Logger.Instance.LogFunctionExit(this.GetType().Name, "ConvertToProviderResponse");
            return(hotelResultRS);
        }
Esempio n. 2
0
        public HotelRateProviderRes Execute(HotelPropertyProviderReq request)
        {
            Logger.Instance.LogFunctionEntry(this.GetType().Name, "Execute");
            Availability avail  = new Availability();
            List <Hotel> hotels = new List <Hotel>();

            if (request.CheckInDate <= DateTime.Today)
            {
                throw new ArgumentOutOfRangeException(nameof(request.CheckInDate));
            }
            if (request.CheckInDate >= request.CheckOutDate)
            {
                throw new ArgumentOutOfRangeException(nameof(request.CheckOutDate));
            }
            if (request.NoOfGuest < 1)
            {
                throw new ArgumentOutOfRangeException(nameof(request.NoOfGuest));
            }

            HotelRateProviderRes hotelSearchResults = null;

            using (var hotelBedsworker = new HotelBedsWorker())
            {
                //convert the request dto to the Hot Beds search api payload
                AvailabilityRQ hotelBedsSearchRq = ConvertToHotelBedsSearchRequest(request);
                try
                {
                    var hotelBedsHotels = hotelBedsworker.GetHotelDetails(hotelBedsSearchRq);

                    //hotelSearchResults = ConvertToProviderResponse(hotelBedsHotels);

                    //if (hotelSearchResults == null)
                    //{
                    //    throw new ProviderUnavailableException(ProviderTypes.HotelBeds.ToString(), $"No response to {nameof(AvailabilityRQ)}.", null);
                    //}
                }
                catch (Exception)
                {
                    throw;
                }
            }
            Logger.Instance.LogFunctionExit(this.GetType().Name, "Execute");
            return(hotelSearchResults);
        }