internal IDictionary <String, String> AllAirportsList() { ReferenceDataRetrieveReq retrieveReq = new ReferenceDataRetrieveReq(); ReferenceDataRetrieveRsp retrieveRsp; IDictionary <String, String> airportsList = new Dictionary <String, String>(); retrieveReq.BillingPointOfSaleInfo = new BillingPointOfSaleInfo() { OriginApplication = "UAPI" }; retrieveReq.TargetBranch = CommonUtility.GetConfigValue(ProjectConstants.G_TARGET_BRANCH); retrieveReq.TypeCode = "CityAirport"; retrieveReq.ReferenceDataSearchModifiers = new ReferenceDataSearchModifiers() { MaxResults = "20000", StartFromResult = "0", ProviderCode = "1G" }; ReferenceDataRetrievePortTypeClient client = new ReferenceDataRetrievePortTypeClient("ReferenceDataRetrievePort", WsdlService.UTIL_ENDPOINT); client.ClientCredentials.UserName.UserName = Helper.RetrunUsername(); client.ClientCredentials.UserName.Password = Helper.ReturnPassword(); try { var httpHeaders = Helper.ReturnHttpHeader(); client.Endpoint.EndpointBehaviors.Add(new HttpHeadersEndpointBehavior(httpHeaders)); retrieveRsp = client.service(retrieveReq); if (retrieveRsp != null) { IEnumerator dataItems = retrieveRsp.ReferenceDataItem.GetEnumerator(); int count = 0; while (dataItems.MoveNext() && count < 50)//We have added 50 Airports in the List, You can add all if you want, Just remove the count { ReferenceDataItem item = (ReferenceDataItem)dataItems.Current; airportsList.Add(item.Code, item.Name); count++; } } return(airportsList); } catch (Exception se) { Console.WriteLine("Error : " + se.Message); client.Abort(); return(null); } }
internal UniversalRecordRetrieveRsp RetrieveRecord(string urLocatorCode) { UniversalRecordRetrieveReq univRetReq = new UniversalRecordRetrieveReq(); UniversalRecordRetrieveRsp univRetRsp; univRetReq.TargetBranch = CommonUtility.GetConfigValue(ProjectConstants.G_TARGET_BRANCH); BillingPointOfSaleInfo billSaleInfo = new BillingPointOfSaleInfo(); billSaleInfo.OriginApplication = "UAPI"; univRetReq.BillingPointOfSaleInfo = billSaleInfo; univRetReq.Item = urLocatorCode; UniversalRecordRetrieveServicePortTypeClient client = new UniversalRecordRetrieveServicePortTypeClient("UniversalRecordRetrieveServicePort", WsdlService.UNIVERSAL_ENDPOINT); client.ClientCredentials.UserName.UserName = Helper.RetrunUsername(); client.ClientCredentials.UserName.Password = Helper.ReturnPassword(); try { var httpHeaders = Helper.ReturnHttpHeader(); client.Endpoint.EndpointBehaviors.Add(new HttpHeadersEndpointBehavior(httpHeaders)); univRetRsp = client.service(null, univRetReq); //Console.WriteLine(lowFareSearchRsp.AirSegmentList.Count()); IEnumerator airReservationDetails = univRetRsp.UniversalRecord.Items.GetEnumerator(); String airLocatorCode; while (airReservationDetails.MoveNext()) { ConsoleApplication1.UniversalService.typeBaseAirReservation airReservation = (ConsoleApplication1.UniversalService.typeBaseAirReservation)airReservationDetails.Current; airLocatorCode = airReservation.LocatorCode; if (!string.IsNullOrEmpty(airLocatorCode)) { AirTicketTest ticketing = new AirTicketTest(); ticketing.GenerateTicket(airLocatorCode); } } return(univRetRsp); } catch (Exception se) { Console.WriteLine("Error : " + se.Message); client.Abort(); return(null); } }
/*public void getPNR(UniversalRecordRetrieveRsp uniRecRsp, string gPNR) // parameter is AirRetrieve ReservationRsp * { * string xml = ""; * string xmlRqt = ""; * AirRetrieveDocumentReq docReq = new AirRetrieveDocumentReq(); * docReq.TraceId = "doesntmatter-8176"; * docReq.TargetBranch = "P7038265";//Set the optional value for targrt baranch * docReq.AuthorizedBy = "ANSHKUMAR"; * AirService.BillingPointOfSaleInfo billSaleInfo = new AirService.BillingPointOfSaleInfo(); * billSaleInfo.OriginApplication = "UAPI"; * docReq.BillingPointOfSaleInfo = billSaleInfo; * List<ItemsChoiceType1> airResList = new List<ItemsChoiceType1>(); * foreach (object ob in uniRecRsp.UniversalRecord.Items) * { * ConsoleApplication1.UniversalService.AirReservation airRes = ob as ConsoleApplication1.UniversalService.AirReservation; * airResList.Add(airRes.LocatorCode); * docReq.ItemsElementName = airResList.ToArray * } * //docReq. * AirRetrieveDocumentBinding binding = new AirRetrieveDocumentBinding(); * binding.Url = "https://emea.universal-api.pp.travelport.com/B2BGateway/connect/uAPI/AirService"; * binding.Credentials = new NetworkCredential("Universal API/uAPI5453181403-7d06a0d1", "7k*CN/6z!f"); * AirRetrieveDocumentRsp docRsp = binding.service(docReq); * //-----------------------Request------------------------------------- * System.Xml.Serialization.XmlSerializer writerRqt = new XmlSerializer(docReq.GetType()); * XmlSerializer serializerRqt = new XmlSerializer(typeof(AirTicketingReq)); * using (StringWriter textWriter = new StringWriter()) * { * writerRqt.Serialize(textWriter, docRsp);// Converting the response 'rsp' to a text writer * xmlRqt = textWriter.ToString(); // Converting the textWritier to string. * } * //------------------------------------------------------------------- * System.Xml.Serialization.XmlSerializer writer = new XmlSerializer(docRsp.GetType()); * AirTicketingRsp result = new AirTicketingRsp(); * XmlSerializer serializer = new XmlSerializer(typeof(AirTicketingRsp)); * using (StringWriter textWriter = new StringWriter()) * { * writer.Serialize(textWriter, docRsp);// Converting the response 'rsp' to a text writer * xml = textWriter.ToString(); // Converting the textWritier to string. * } * using (TextReader reader = new StringReader(xml)) * { * result = (AirService.AirTicketingRsp)serializer.Deserialize(reader); * } * //string PNR = ""; * }*/ internal static AirRetrieveDocumentRsp GetPNR(UniversalService.UniversalRecordRetrieveRsp univRetRsp) { AirRetrieveDocumentReq docReq = new AirRetrieveDocumentReq(); AirRetrieveDocumentRsp docRsp; docReq.TraceId = "doesntmatter-8176"; docReq.TargetBranch = CommonUtility.GetConfigValue(ProjectConstants.G_TARGET_BRANCH);//Set the optional value for targrt baranch docReq.AuthorizedBy = "USER"; AirService.BillingPointOfSaleInfo billSaleInfo = new AirService.BillingPointOfSaleInfo(); billSaleInfo.OriginApplication = "UAPI"; docReq.BillingPointOfSaleInfo = billSaleInfo; docReq.ProviderCode = "1G"; List <ItemsChoiceType1> airResList = new List <ItemsChoiceType1>(); List <AirReservationLocatorCode> airResValueList = new List <AirReservationLocatorCode>(); foreach (object ob in univRetRsp.UniversalRecord.Items) { ConsoleApplication1.UniversalService.AirReservation airRes = ob as ConsoleApplication1.UniversalService.AirReservation; airResValueList.Add(new AirReservationLocatorCode() { Value = airRes.LocatorCode }); airResList.Add((ItemsChoiceType1)Enum.Parse(typeof(ItemsChoiceType1), ConsoleApplication1.AirService.ItemsChoiceType1.AirReservationLocatorCode.ToString())); docReq.ItemsElementName = airResList.ToArray(); docReq.Items = airResValueList.ToArray(); break; } //docReq.UniversalRecordLocatorCode = univRetRsp.UniversalRecord.LocatorCode; AirRetrieveDocumentPortTypeClient client = new AirRetrieveDocumentPortTypeClient("AirRetrieveDocumentBindingPort", WsdlService.AIR_ENDPOINT); client.ClientCredentials.UserName.UserName = Helper.RetrunUsername(); client.ClientCredentials.UserName.Password = Helper.ReturnPassword(); try { var httpHeaders = Helper.ReturnHttpHeader(); client.Endpoint.EndpointBehaviors.Add(new HttpHeadersEndpointBehavior(httpHeaders)); docRsp = client.service(docReq); return(docRsp); } catch (Exception se) { Console.WriteLine("Error : " + se.Message); client.Abort(); return(null); } }
internal static AirPriceRsp AirPrice(List <typeBaseAirSegment> pricingSegments) { AirPriceReq priceReq = new AirPriceReq(); AirPriceRsp priceRsp; AddPointOfSale(priceReq, "UAPI"); AirItinerary itinerary = new AirItinerary(); List <typeBaseAirSegment> itinerarySegments = new List <typeBaseAirSegment>(); IEnumerator airSegments = pricingSegments.GetEnumerator(); while (airSegments.MoveNext()) { typeBaseAirSegment seg = (typeBaseAirSegment)airSegments.Current; seg.ProviderCode = "1G"; seg.FlightDetailsRef = null; seg.ClassOfService = "Y"; itinerarySegments.Add(seg); } itinerary.AirSegment = itinerarySegments.ToArray(); priceReq.AirItinerary = itinerary; priceReq.SearchPassenger = AddSearchPassenger(); priceReq.AirPricingModifiers = new AirPricingModifiers() { PlatingCarrier = priceReq.AirItinerary.AirSegment[0].Carrier }; List <AirPricingCommand> pricingCommands = new List <AirPricingCommand>(); AirPricingCommand command = new AirPricingCommand() { CabinClass = "Economy"//You can use Economy,PremiumEconomy,Business etc. }; pricingCommands.Add(command); priceReq.AirPricingCommand = pricingCommands.ToArray(); priceReq.TargetBranch = CommonUtility.GetConfigValue(ProjectConstants.G_TARGET_BRANCH); AirPricePortTypeClient client = new AirPricePortTypeClient("AirPricePort", WsdlService.AIR_ENDPOINT); client.ClientCredentials.UserName.UserName = Helper.RetrunUsername(); client.ClientCredentials.UserName.Password = Helper.ReturnPassword(); try { var httpHeaders = Helper.ReturnHttpHeader(); client.Endpoint.EndpointBehaviors.Add(new HttpHeadersEndpointBehavior(httpHeaders)); priceRsp = client.service(null, priceReq); return(priceRsp); } catch (Exception se) { Console.WriteLine("Error : " + se.Message); client.Abort(); return(null); } }
internal void GenerateTicket(string airLocatorCode) { AirTicketingReq airTicketReq = new AirTicketingReq(); AirTicketingRsp airTicketRsp; airTicketReq.BillingPointOfSaleInfo = new BillingPointOfSaleInfo() { OriginApplication = "UAPI" }; airTicketReq.AirReservationLocatorCode = new AirReservationLocatorCode() { Value = airLocatorCode }; List <AirTicketingModifiers> ticketingModifiers = new List <AirTicketingModifiers>(); List <FormOfPayment> fopList = new List <FormOfPayment>(); fopList.Add(new FormOfPayment() { FulfillmentIDType = typeFulfillmentIDType.CreditCard, Type = "Credit", Item = new CreditCard() { Number = "4111111111111111", ExpDate = "2016-06", CVV = "123", Type = "VI", BillingAddress = new typeStructuredAddress() { AddressName = "Home", Street = new string[] { "2914 N. Dakota Avenue" }, City = "Denver", State = new State() { Value = "CO" }, PostalCode = "80206", Country = "US" } } }); ticketingModifiers.Add(new AirTicketingModifiers() { FormOfPayment = fopList.ToArray() }); airTicketReq.AirTicketingModifiers = ticketingModifiers.ToArray(); airTicketReq.TargetBranch = Utility.CommonUtility.GetConfigValue(ProjectConstants.G_TARGET_BRANCH); AirTicketingPortTypeClient client = new AirTicketingPortTypeClient("AirTicketingPort", WsdlService.AIR_ENDPOINT); client.ClientCredentials.UserName.UserName = Helper.RetrunUsername(); client.ClientCredentials.UserName.Password = Helper.ReturnPassword(); try { var httpHeaders = Helper.ReturnHttpHeader(); client.Endpoint.EndpointBehaviors.Add(new HttpHeadersEndpointBehavior(httpHeaders)); airTicketRsp = client.service(airTicketReq); //Console.WriteLine(lowFareSearchRsp.AirSegmentList.Count()); } catch (Exception e) { Console.WriteLine("Error in Tickting : " + e.Message); } }
internal AirCreateReservationRsp AirBook(AirService.AirPricingSolution lowestPrice, AirService.AirItinerary airItinerary) { AirCreateReservationReq reservationReq = new AirCreateReservationReq(); AirCreateReservationRsp reservationRsp; BillingPointOfSaleInfo billSaleInfo = new BillingPointOfSaleInfo(); billSaleInfo.OriginApplication = "UAPI"; reservationReq.BillingPointOfSaleInfo = billSaleInfo; reservationReq.ContinuityCheckOverride = new ContinuityCheckOverride() { Key = "1T", Value = "true" }; reservationReq.BookingTraveler = AddBookingTraveler(airItinerary); reservationReq.FormOfPayment = AddFormOfPayment(); reservationReq.AirPricingSolution = AddAirPriceSolution(lowestPrice, airItinerary); List <ActionStatus> statusList = new List <ActionStatus>(); ActionStatus actionStatus = new ActionStatus() { ProviderCode = "1G", Type = ActionStatusType.TAW, TicketDate = reservationReq.AirPricingSolution.AirPricingInfo[0].LatestTicketingTime }; statusList.Add(actionStatus); reservationReq.ActionStatus = statusList.ToArray(); reservationReq.TargetBranch = CommonUtility.GetConfigValue(ProjectConstants.G_TARGET_BRANCH); reservationReq.RetainReservation = typeRetainReservation.Both; AirCreateReservationPortTypeClient client = new AirCreateReservationPortTypeClient("AirCreateReservationPort", WsdlService.AIR_ENDPOINT); client.ClientCredentials.UserName.UserName = Helper.RetrunUsername(); client.ClientCredentials.UserName.Password = Helper.ReturnPassword(); try { var httpHeaders = Helper.ReturnHttpHeader(); client.Endpoint.EndpointBehaviors.Add(new HttpHeadersEndpointBehavior(httpHeaders)); /*SupportedVersions versions = new SupportedVersions(); * * versions.airVersion = "air_v29_0"; * versions.urVersion = "universal_v29_0";*/ reservationRsp = client.service(null, reservationReq); //Console.WriteLine(lowFareSearchRsp.AirSegmentList.Count()); return(reservationRsp); } catch (Exception se) { Console.WriteLine("Error : " + se.Message); client.Abort(); return(null); } }
internal AirFareDisplayRsp GetAirFareDisplayDetails(List <typeBaseAirSegment> pricingSegments) { AirFareDisplayReq fareDisplayReq = new AirFareDisplayReq(); AirFareDisplayRsp fareDisplayRsp; fareDisplayReq.TargetBranch = CommonUtility.GetConfigValue(ProjectConstants.G_TARGET_BRANCH); string depart = ""; IEnumerator <typeBaseAirSegment> segments = pricingSegments.GetEnumerator(); if (segments.MoveNext()) { typeBaseAirSegment seg = segments.Current; if (seg.Origin != null) { fareDisplayReq.Origin = seg.Origin; } if (seg.Destination != null) { fareDisplayReq.Destination = seg.Destination; } if (seg.DepartureTime != null) { depart = seg.DepartureTime; } fareDisplayReq.ProviderCode = "1G"; } fareDisplayReq.BillingPointOfSaleInfo = new BillingPointOfSaleInfo() { OriginApplication = "UAPI" }; fareDisplayReq.PassengerType = AddPassengerType(); fareDisplayReq.AirFareDisplayModifiers = AddAirFareDisplayModifiers(depart); AirFareDisplayPortTypeClient client = new AirFareDisplayPortTypeClient("AirFareDisplayPort", WsdlService.AIR_ENDPOINT); client.ClientCredentials.UserName.UserName = Helper.RetrunUsername(); client.ClientCredentials.UserName.Password = Helper.ReturnPassword(); try { var httpHeaders = Helper.ReturnHttpHeader(); client.Endpoint.EndpointBehaviors.Add(new HttpHeadersEndpointBehavior(httpHeaders)); fareDisplayRsp = client.service(fareDisplayReq); return(fareDisplayRsp); } catch (Exception se) { Console.WriteLine("Error : " + se.Message); client.Abort(); return(null); } }
internal AirFareRulesRsp GetAirFareRules(AirFareDisplayRsp fareDisplayRsp, AirReservationLocatorCode reservationLocatorCode) { AirFareRulesReq rulesReq = new AirFareRulesReq(); AirFareRulesRsp rulesRsp = null; if (fareDisplayRsp != null) { rulesReq.TargetBranch = CommonUtility.GetConfigValue(ProjectConstants.G_TARGET_BRANCH); rulesReq.FareRuleType = typeFareRuleType.@long;//We cna use @short to get short fareRules rulesReq.BillingPointOfSaleInfo = new BillingPointOfSaleInfo() { OriginApplication = "UAPI" }; IEnumerator fareDisplay = fareDisplayRsp.FareDisplay.GetEnumerator(); if (fareDisplay.MoveNext())//There can be multiple fareDiplay in FareDisplayRsp, we are taking the first one here { FareDisplay fare = (FareDisplay)fareDisplay.Current; if (fare.AirFareDisplayRuleKey != null) { List <Object> items = new List <object>(); items.Add(fare.AirFareDisplayRuleKey); rulesReq.Items = items.ToArray(); } } } else if (reservationLocatorCode != null) { rulesReq.TargetBranch = CommonUtility.GetConfigValue(ProjectConstants.G_TARGET_BRANCH); rulesReq.FareRuleType = typeFareRuleType.@long; rulesReq.BillingPointOfSaleInfo = new BillingPointOfSaleInfo() { OriginApplication = "UAPI" }; AirReservationLocatorCode locatorCode = reservationLocatorCode; List <Object> codes = new List <object>(); codes.Add(locatorCode); rulesReq.Items = codes.ToArray(); } AirFareRulesPortTypeClient client = new AirFareRulesPortTypeClient("AirFareRulesPort", WsdlService.AIR_ENDPOINT); client.ClientCredentials.UserName.UserName = Helper.RetrunUsername(); client.ClientCredentials.UserName.Password = Helper.ReturnPassword(); try { var httpHeaders = Helper.ReturnHttpHeader(); client.Endpoint.EndpointBehaviors.Add(new HttpHeadersEndpointBehavior(httpHeaders)); rulesRsp = client.service(rulesReq); //return rulesRsp; } catch (Exception se) { Console.WriteLine("Error : " + se.Message); client.Abort(); return(null); } return(rulesRsp); }
internal IDictionary <String, String> GetAllAiportsFromParticualrCity(String cityName) { ReferenceDataSearchReq refDataSearchReq = new ReferenceDataSearchReq(); ReferenceDataSearchRsp refDataSearchRsp; IDictionary <String, String> airportCityList = new Dictionary <String, String>(); refDataSearchReq.BillingPointOfSaleInfo = new BillingPointOfSaleInfo() { OriginApplication = "UAPI" }; refDataSearchReq.ReferenceDataSearchModifiers = new ReferenceDataSearchModifiers() { MaxResults = "20", ProviderCode = "1G", StartFromResult = "0" }; List <ReferenceDataSearchItem> dataItems = new List <ReferenceDataSearchItem>(); ReferenceDataSearchItem dataItem = new ReferenceDataSearchItem(); dataItem.Type = ReferenceDataSearchItemType.Airport; dataItem.ItemElementName = ItemChoiceType1.Name; dataItem.Item = cityName; dataItems.Add(dataItem); refDataSearchReq.ReferenceDataSearchItem = dataItems.ToArray(); ReferenceDataLookupPortTypeClient client = new ReferenceDataLookupPortTypeClient("ReferenceDataLookupPort", WsdlService.LOOKUP_ENDPOINT); client.ClientCredentials.UserName.UserName = Helper.RetrunUsername(); client.ClientCredentials.UserName.Password = Helper.ReturnPassword(); try { var httpHeaders = Helper.ReturnHttpHeader(); client.Endpoint.EndpointBehaviors.Add(new HttpHeadersEndpointBehavior(httpHeaders)); refDataSearchRsp = client.service(refDataSearchReq); if (refDataSearchRsp != null) { IEnumerator airportsInCity = refDataSearchRsp.Items.GetEnumerator(); while (airportsInCity.MoveNext()) { ReferenceDataSearchRspAirport item = (ReferenceDataSearchRspAirport)airportsInCity.Current; airportCityList.Add(item.Code, item.Name); } } return(airportCityList); } catch (Exception se) { Console.WriteLine("Error : " + se.Message); client.Abort(); return(null); } }