public override HotelPropertyProviderRes Execute(HotelPropertyProviderReq request)
 {
     using (var touricoWorker = new TouricoWorker())
     {
         return(GetRates(touricoWorker, request));
     }
 }
        private HotelPropertyProviderRes GetRates(TouricoWorker touricoWorker, HotelPropertyProviderReq request)
        {
            //Create Request
            var hotelV3Request = this.TransformHotelPropertyDescriptionRequest(request);

            //Call the API    - Get the Detailed Information based on HotelCode
            var hotelDescriptionRes = touricoWorker.Execute <GetHotelDetailsV3Request, GetHotelDetailsV3Response>(hotelV3Request);


            //Tranform Response
            return(this.TransformHotelPropertyDescriptionResponse(
                       hotelDescriptionRes,
                       request.CheckInDate,
                       request.CheckOutDate));
        }
Пример #3
0
        public override HotelAvailabilityProviderRes Execute(HotelAvailabilityProviderReq request)
        {
            if (request.LocationType == ServiceCatalogues.HotelCatalog.Enums.LocationTypes.Unknown)
            {
                //throw new ArgumentNullException(nameof(request.LocationType));
            }
            if (request.CheckInDate <= DateTime.Today)
            {
                throw new ArgumentOutOfRangeException(nameof(request.CheckInDate));
            }
            if (request.CheckInDate >= request.CheckOutDate)
            {
                throw new ArgumentOutOfRangeException(nameof(request.CheckOutDate));
            }
            if (request.TotalAdults < 1)
            {
                throw new ArgumentOutOfRangeException(nameof(request.TotalAdults));
            }

            using (
                var touricoWorker = new TouricoWorker(pipelineManager: PipelineManager)
                )
            {
                //convert request dto to Tourico search request
                SearchHotelsByIdRequest1 TouricoHotelRequest = ConvertToTouricoHotelSearchRequest(request);

                HotelAvailabilityProviderRes hotelSearchResults;

                try
                {
                    var touricoRespone = touricoWorker.Execute <SearchHotelsByIdRequest1, SearchHotelsByIdResponse>(TouricoHotelRequest);

                    if (touricoRespone == null)
                    {
                        throw new ProviderUnavailableException(ProviderTypes.Tourico.ToString(), $"No response to {nameof(SearchHotelsByIdRequest1)}.", null);
                    }

                    //convert response to HotelAvailabilityProviderRes
                    hotelSearchResults = this.ConvertToProviderResponse(touricoRespone, request);
                }
                catch (TouricoProviderException e)
                {
                    throw e;
                }

                return(hotelSearchResults);
            }
        }
Пример #4
0
        public override HotelAvailabilityProviderRes Execute(HotelAvailabilityProviderReq request)
        {
            if (request.LocationType == LocationTypes.Unknown)
            {
                //throw new ArgumentNullException(nameof(request.LocationType));
            }
            if (request.CheckInDate <= DateTime.Today)
            {
                throw new ArgumentOutOfRangeException(nameof(request.CheckInDate));
            }
            if (request.CheckInDate >= request.CheckOutDate)
            {
                throw new ArgumentOutOfRangeException(nameof(request.CheckOutDate));
            }
            if (request.TotalAdults < 1)
            {
                throw new ArgumentOutOfRangeException(nameof(request.TotalAdults));
            }

            using (
                var touricoWorker = new TouricoWorker(pipelineManager: PipelineManager)
                )
            {
                //convert request dto to Tourico search request
                SearchHotelsByIdRequest1 TouricoHotelRequest = ConvertToTouricoHotelSearchRequest(request);

                HotelAvailabilityProviderRes hotelSearchResults;

                try
                {
                    var touricoRespone = touricoWorker.Execute <SearchHotelsByIdRequest1, SearchHotelsByIdResponse>(TouricoHotelRequest);

                    //convert response to HotelAvailabilityProviderRes
                    hotelSearchResults = this.ConvertToProviderResponse(touricoRespone, request);
                }
                catch (Exception ex)
                {
                    throw ex;
                }

                return(hotelSearchResults);
            }
        }