public async Task <Enh.EnhancedAirBookRQResponse> CreateEnhanced ( Session session, string pnr, IList <FlightDescription> flightDescriptions ) { var enhacnedReq = GetEnhancedRequest(pnr, flightDescriptions); var enhacnedReqSer = JsonConvert.SerializeObject(enhacnedReq, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); //File.WriteAllText("enhacnedReqSer.txt", enhacnedReqSer); //Process.Start("enhacnedReqSer.txt"); var enhacned = await _client.GetEnhancedAirBook(session, enhacnedReq); enhacned.Should().NotBeNull(); var resp = JsonConvert.SerializeObject(enhacned.EnhancedAirBookRS, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); _logger.Debug(resp); return(enhacned); }
public async Task EnhancedAirBookTest() { { //var odi = new Enh.EnhancedAirBookRQOTA_AirBookRQFlightSegment //{ // DepartureDateTime = "2019-02-21T09:30", // FlightNumber = "1815", // NumberInParty = "1", // ResBookDesigCode = "Y", // Status = "NN", // InstantPurchase = false, // DestinationLocation = new Enh.EnhancedAirBookRQOTA_AirBookRQFlightSegmentDestinationLocation { LocationCode = "JFK" }, // MarketingAirline = new Enh.EnhancedAirBookRQOTA_AirBookRQFlightSegmentMarketingAirline { Code = "DL", FlightNumber = "1815" }, // OriginLocation = new Enh.EnhancedAirBookRQOTA_AirBookRQFlightSegmentOriginLocation { LocationCode = "LAS" } //}; } var sessionManager = new SessionManager(_logger); var session = await sessionManager.CreateSession(_credentials, "SessionCreateRQ"); var odi = new Enh.EnhancedAirBookRQOTA_AirBookRQFlightSegment { DepartureDateTime = "2019-04-16T11:02:00", FlightNumber = "1366", NumberInParty = "1", ResBookDesigCode = "Y", Status = "NN", InstantPurchase = false, DestinationLocation = new Enh.EnhancedAirBookRQOTA_AirBookRQFlightSegmentDestinationLocation { LocationCode = "LAX" }, MarketingAirline = new Enh.EnhancedAirBookRQOTA_AirBookRQFlightSegmentMarketingAirline { Code = "AA", FlightNumber = "1366" }, OperatingAirline = new Enh.EnhancedAirBookRQOTA_AirBookRQFlightSegmentOperatingAirline { Code = "AA" }, OriginLocation = new Enh.EnhancedAirBookRQOTA_AirBookRQFlightSegmentOriginLocation { LocationCode = "LAS" } }; var client = new SabreApi(_logger); var enhacnedReq = new Enh.EnhancedAirBookRQ { version = "3.9.0", HaltOnError = true, IgnoreOnError = true, OTA_AirBookRQ = new Enh.EnhancedAirBookRQOTA_AirBookRQ { HaltOnStatus = new Enh.EnhancedAirBookRQOTA_AirBookRQHaltOnStatus[] { new Enh.EnhancedAirBookRQOTA_AirBookRQHaltOnStatus { Code = "UC" } }, RetryRebook = new Enh.EnhancedAirBookRQOTA_AirBookRQRetryRebook { Option = true }, RedisplayReservation = new Enh.EnhancedAirBookRQOTA_AirBookRQRedisplayReservation { NumAttempts = "5", WaitInterval = "2000" }, OriginDestinationInformation = new Enh.EnhancedAirBookRQOTA_AirBookRQFlightSegment[] { odi } }, PostProcessing = new Enh.EnhancedAirBookRQPostProcessing { IgnoreAfter = false, RedisplayReservation = new Enh.EnhancedAirBookRQPostProcessingRedisplayReservation { WaitInterval = "5000" } }, PreProcessing = new Enh.EnhancedAirBookRQPreProcessing { IgnoreBefore = false, UniqueID = new Enh.EnhancedAirBookRQPreProcessingUniqueID { ID = "PCOLDH" } }, //OTA_AirPriceRQ = new Enh.EnhancedAirBookRQOTA_AirPriceRQ[] //{ // new Enh.EnhancedAirBookRQOTA_AirPriceRQ // { // PriceRequestInformation = new Enh.EnhancedAirBookRQOTA_AirPriceRQPriceRequestInformation // { // OptionalQualifiers=new Enh.EnhancedAirBookRQOTA_AirPriceRQPriceRequestInformationOptionalQualifiers // { // PricingQualifiers = new Enh.EnhancedAirBookRQOTA_AirPriceRQPriceRequestInformationOptionalQualifiersPricingQualifiers // { // CurrencyCode = "USD", // PassengerType = new Enh.EnhancedAirBookRQOTA_AirPriceRQPriceRequestInformationOptionalQualifiersPricingQualifiersPassengerType[] // { // new Enh.EnhancedAirBookRQOTA_AirPriceRQPriceRequestInformationOptionalQualifiersPricingQualifiersPassengerType // { // Code="ADT", // Quantity="1", // Force=true // } // } // } // } // } // } //} }; var schedule = await client.GetEnhancedAirBook(session, enhacnedReq); schedule.Should().NotBeNull(); var resp = JsonConvert.SerializeObject(schedule.EnhancedAirBookRS); _logger.Debug(resp); var response = await sessionManager.CloseSession(session); response.Should().Be("Approved"); }