Exemplo n.º 1
0
        public async Task <HotelRoomRS> RecheckPrice(int id, DateTime checkIn, DateTime checkOut,
                                                     string locale, string currency, string rooms, string rateCode, string roomTypeCode)
        {
            HotelRecheckPriceRQ request = new HotelRecheckPriceRQ()
            {
                CheckIn   = checkIn,
                CheckOut  = checkOut,
                Currency  = currency,
                Locale    = locale,
                HotelId   = id,
                Suppliers = new List <string> {
                    "EAN"
                },
                RateCode     = rateCode,
                RoomTypeCode = roomTypeCode,
                Occupancies  = rooms.Split('|').ToList().Select(r =>
                {
                    var occu = new RoomOccupancy
                    {
                        AdultCount = Convert.ToInt32(r.Split(',')[0])
                    };

                    if (r.Split(',').Length > 1)
                    {
                        occu.ChildAges = r.Split(',').Skip(1).Select(c => Convert.ToInt32(c)).ToList();
                    }

                    return(occu);
                }).ToList(),
            };

            return(await _HotelService.HotelRecheckPriceAsync(request));
        }
Exemplo n.º 2
0
        public async Task <HotelRoomRS> HotelRecheckPriceAsync(HotelRecheckPriceRQ request)
        {
            if (!request.Suppliers.Contains("EAN"))
            {
                return(new HotelRoomRS());
            }

            _LogService = new LogService();

            if (string.IsNullOrEmpty(request.Locale))
            {
                request.Locale = "en_US";
            }

            if (string.IsNullOrEmpty(request.Currency))
            {
                request.Currency = "USD";
            }

            try
            {
                _LogService.LogInfo("EAN/HotelRecheckPriceRQ", request);

                var response = await SubmitAsync($"locale={request.Locale ?? "en_US"}" +
                                                 $"&currencyCode={request.Currency ?? "USD"}" +
                                                 $"&hotelId={request.HotelId}" +
                                                 $"&arrivalDate={request.CheckIn.ToString("MM/dd/yyyy")}" +
                                                 $"&departureDate={request.CheckOut.ToString("MM/dd/yyyy")}" +
                                                 $"&rateCode={request.RateCode}" +
                                                 $"&roomTypeCode={request.RoomTypeCode}" +
                                                 $"&includeDetails=true" +
                                                 $"&{OccupancyToString(request.Occupancies)}",
                                                 //+     $"&includeDetails=true",
                                                 RequestType.RoomAvailability);

                var         rs           = JsonConvert.DeserializeObject <HotelRoomAvailRS>(response);
                HotelRoomRS roomResponse = ConvertToHotelRoomRS(rs, request);//, request, sRequest);

                _LogService.LogInfo($"EAN/HotelRecheckPriceRS", roomResponse);

                return(roomResponse);
            }
            catch (Exception ex)
            {
                _LogService.LogException(ex, "Ean.HotelService.HotelRecheckPriceAsync");
                return(new HotelRoomRS());
            }
            finally
            {
                _LogService = null;
            }
        }
Exemplo n.º 3
0
 public Task <HotelRoomRS> HotelRecheckPriceAsync(HotelRecheckPriceRQ request)
 {
     throw new NotImplementedException();
 }