private AirPriceReq ConvertToAirPriceReq(AirPriceRQ request) { int counter = 0; AirPriceReq req = new AirPriceReq() { BillingPointOfSaleInfo = new kestrel.AirService.BillingPointOfSaleInfo { OriginApplication = "uAPI" }, TargetBranch = "P7073862", AirItinerary = new AirItinerary { AirSegment = request.Segments.Select(s => new typeBaseAirSegment { Key = s.Key, Group = s.Group, FlightNumber = s.FlightNumber.Number, Carrier = s.FlightNumber.Airline, Origin = s.Origin, Destination = s.Destination, ProviderCode = "1G", DepartureTime = $"{s.DepartureTime.Time.ToString("yyyy-MM-ddTHH:mm:ss.000")}+{s.DepartureTime.GmtOffset.ToString("00")}:00", ArrivalTime = $"{s.ArrivalTime.Time.ToString("yyyy-MM-ddTHH:mm:ss.000")}+{s.ArrivalTime.GmtOffset.ToString("00")}:00", ClassOfService = s.ClassOfService, Connection = s.IsConnection ? new Connection { } : null }).ToArray() }, SearchPassenger = request.Ptcs.Select(ptc => { SearchPassenger pax = new SearchPassenger { Code = ptc.Code, BookingTravelerRef = $"PT{counter++}", }; if (ptc.Age != null) { pax.Age = ptc.Age.ToString(); } return(pax); }).ToArray(), AirPricingCommand = new AirPricingCommand[] { new AirPricingCommand { CabinClass = request.CabinClass, } }, //AirPricingModifiers = new AirPricingModifiers //{ // BrandModifiers = new BrandModifiers // { // ModifierType = BrandModifiersModifierType.FareFamilyDisplay // } //} }; return(req); }
public async Task <AirPriceRS> AirPriceAsync(AirPriceRQ request) { AirPricePortTypeClient client; _LogService = new LogService(); try { _LogService.LogInfo($"AirPriceRQ", request); var binding = GenerateBasicHttpBinding(); var endpoint = new EndpointAddress("https://apac.universal-api.pp.travelport.com/B2BGateway/connect/uAPI/AirService"); client = new AirPricePortTypeClient(binding, endpoint); var httpHeaders = Helper.ReturnHttpHeader(); client.Endpoint.EndpointBehaviors.Add(new HttpHeadersEndpointBehavior(httpHeaders)); var req = ConvertToAirPriceReq(request); _LogService.LogInfo($"uAPI/AirPriceReq", req); var result = await client.serviceAsync(null, req); _LogService.LogInfo($"uAPI/AirPriceRsp", result); var response = ConvertToAirPriceRS(result.AirPriceRsp); _LogService.LogInfo($"AirPriceRS", response); return(response); } catch (Exception ex) { _LogService.LogException(ex, "uAPI.AirService.AirPriceAsync"); throw; } finally { client = null; } }
public async Task <AirPriceRS> Get() { AirPriceRQ rq = new AirPriceRQ { Segments = new List <AirPriceSegment> { new AirPriceSegment { Origin = "HKG", Destination = "DXB", Group = 0, Key = "znpOmA8Q2BKAzonCAAAAAA==", ClassOfService = "U", FlightNumber = new Models.FlightNumber { Airline = "EK", Number = "387" }, DepartureTime = new Models.Timing { Time = new System.DateTime(2018, 6, 13, 7, 50, 0), GmtOffset = 8 }, ArrivalTime = new Models.Timing { Time = new System.DateTime(2018, 6, 13, 11, 50, 0), GmtOffset = 4 }, IsConnection = true, }, new AirPriceSegment { Origin = "DXB", Destination = "DEL", Group = 0, Key = "znpOmA8Q2BKA1onCAAAAAA==", ClassOfService = "U", FlightNumber = new Models.FlightNumber { Airline = "EK", Number = "514" }, DepartureTime = new Models.Timing { Time = new System.DateTime(2018, 6, 13, 15, 25, 0), GmtOffset = 4 }, ArrivalTime = new Models.Timing { Time = new System.DateTime(2018, 6, 13, 20, 20, 0), GmtOffset = (float)5.5 }, IsConnection = false }, new AirPriceSegment { Origin = "DEL", Destination = "DXB", Group = 1, Key = "znpOmA8Q2BKA7onCAAAAAA==", ClassOfService = "U", FlightNumber = new Models.FlightNumber { Airline = "EK", Number = "511" }, DepartureTime = new Models.Timing { Time = new System.DateTime(2018, 6, 18, 11, 00, 0), GmtOffset = (float)5.5 }, ArrivalTime = new Models.Timing { Time = new System.DateTime(2018, 6, 18, 13, 0, 0), GmtOffset = 4 }, IsConnection = true, }, new AirPriceSegment { Origin = "DXB", Destination = "HKG", Group = 1, Key = "znpOmA8Q2BKA9onCAAAAAA==", ClassOfService = "U", FlightNumber = new Models.FlightNumber { Airline = "EK", Number = "386" }, DepartureTime = new Models.Timing { Time = new System.DateTime(2018, 6, 18, 18, 25, 0), GmtOffset = 4 }, ArrivalTime = new Models.Timing { Time = new System.DateTime(2018, 6, 19, 6, 20, 0), GmtOffset = (float)8 }, IsConnection = false }, }, CabinClass = "Economy", Ptcs = new List <AirPricePtc> { new AirPricePtc { Code = "ADT" }, new AirPricePtc { Code = "CNN", Age = 8 }, new AirPricePtc { Code = "CHD", Age = 15 }, new AirPricePtc { Code = "INF", Age = 1 } } }; var rs = await _AirService.AirPriceAsync(rq); return(rs); }
public Task <AirPriceRS> AirPriceAsync(AirPriceRQ request) { throw new System.NotImplementedException(); }