public PriceItineraryResponse retrievePriceItinerary(PriceItineraryRequest priceitinrequest) { PriceItineraryResponse priceitineraryresponse = null; try { priceitineraryresponse = clientapi.GetItineraryPrice(priceitinrequest); } catch (Exception e) { Console.WriteLine(e.Message); } return priceitineraryresponse; }
public static void GetPriceReturn(string signature, GetAvailabilityResponse response, string noofPassenger) { IBookingManager bookingManager = new BookingManagerClient(); DataTable flights = Table_Flights(); DataTable fare = Table_Fare(); foreach (JourneyDateMarket[] jdmArray in response.GetTripAvailabilityResponse.Schedules) { foreach (JourneyDateMarket jdm in jdmArray) { foreach (Journey journey in jdm.Journeys) { PriceItineraryRequest pir = new PriceItineraryRequest(); ItineraryPriceRequest ipr = new ItineraryPriceRequest(); ipr.PriceItineraryBy = PriceItineraryBy.JourneyBySellKey; ipr.SellByKeyRequest = new SellJourneyByKeyRequestData(); ipr.SellByKeyRequest.ActionStatusCode = "NN"; SellKeyList[] list = new SellKeyList[1]; list[0] = new SellKeyList(); list[0].JourneySellKey = journey.JourneySellKey; foreach (Segment segment in journey.Segments) { DataRow dr = flights.NewRow(); if (segment.Fares.Length > 0) { list[0].FareSellKey = segment.Fares[0].FareSellKey; dr["ShortDate"] = segment.STD.ToString("ddd MMM d yyyy"); dr["Date"] = segment.STD.ToShortDateString(); dr["From"] = segment.DepartureStation; dr["To"] = segment.ArrivalStation; dr["FlightNo"] = segment.FlightDesignator.FlightNumber; dr["STD"] = segment.STD.ToString("dd/MM/yyy hh:mm tt"); dr["STA"] = segment.STA.ToString("dd/MM/yyy hh:mm tt"); dr["BaseFare"] = segment.Fares[0].PaxFares[0].ServiceCharges[0].Amount; dr["TimeDuration"] = TimeDuration(segment.STD.ToString(), segment.STA.ToString()); flights.Rows.Add(dr); } } ipr.SellByKeyRequest.JourneySellKeys = list; int pax = Convert.ToInt16(noofPassenger);//+ Convert.ToInt16(page.child); ipr.SellByKeyRequest.PaxCount = Convert.ToSByte(pax); PaxPriceType[] priceTypes = new PaxPriceType[ipr.SellByKeyRequest.PaxCount]; for (int i = 0; i < ipr.SellByKeyRequest.PaxCount; i++) { priceTypes[i] = new PaxPriceType(); priceTypes[i].PaxType = "ADT"; priceTypes[i].PaxDiscountCode = string.Empty; } ipr.SellByKeyRequest.PaxPriceType = priceTypes; ipr.SellByKeyRequest.CurrencyCode = "INR"; ipr.SellByKeyRequest.LoyaltyFilter = LoyaltyFilter.MonetaryOnly; ipr.SellByKeyRequest.IsAllotmentMarketFare = false; pir.ItineraryPriceRequest = ipr; pir.Signature = signature; PriceItineraryResponse pire = bookingManager.GetItineraryPrice(pir); foreach (Journey j in pire.Booking.Journeys) { foreach (Segment segment in j.Segments) { foreach (BookingServiceCharge bsc in segment.Fares[0].PaxFares[0].ServiceCharges) { DataRow drr = fare.NewRow(); drr["FlightNo"] = segment.FlightDesignator.FlightNumber; drr["Heads"] = bsc.ChargeType.ToString() + bsc.ChargeCode.ToString(); drr["Amount"] = bsc.Amount; fare.Rows.Add(drr); } } } } } } foreach (DataRow dr in flights.Rows) { dr["TotalFare"] = TotalFare(fare, dr["FlightNo"].ToString()) * (Convert.ToDouble(noofPassenger.ToString())); } HttpContext.Current.Session["Rflights"] = flights; HttpContext.Current.Session["Rfare"] = fare; Logout(signature); }
//--------------------------------------------------------------------------------------------------------------------- public BookingManager.PriceItineraryRequest GetPriceIntineraryRequest(int numadt, int numchd, String faretype, String currency, String sourceorg, String agentcode, GetAvailabilityResponse availresponse) { PriceItineraryRequest priceitinrequest = new PriceItineraryRequest(); priceitinrequest.Signature = signature; priceitinrequest.ItineraryPriceRequest = new ItineraryPriceRequest();// this is from service contract class priceitinrequest.ItineraryPriceRequest.TypeOfSale = new TypeOfSale(); priceitinrequest.ItineraryPriceRequest.TypeOfSale.FareTypes = new string[1]; priceitinrequest.ItineraryPriceRequest.TypeOfSale.FareTypes[0] = faretype; priceitinrequest.ItineraryPriceRequest.SSRRequest = new SSRRequest(); priceitinrequest.ItineraryPriceRequest.PriceItineraryBy = PriceItineraryBy.JourneyWithLegs; SellJourneyByKeyRequestData sellkeyrequest = new SellJourneyByKeyRequestData(); priceitinrequest.ItineraryPriceRequest.SellByKeyRequest = sellkeyrequest; PriceJourneyRequestData pricerequest = new PriceJourneyRequestData(); pricerequest.CurrencyCode = currency; pricerequest.PaxCount = (short)(numadt + numchd);// to check if this is required //setting up the paxdetails to get the pricing correctly, must follow my get avaialbility function call pricerequest.Passengers = new Passenger[numadt + numchd]; for (int i = 0; i < (numadt + numchd); i++) { pricerequest.Passengers[i] = new Passenger();// instantiate to avoid Null Pointer Exception error pricerequest.Passengers[i].State = MessageState.New; pricerequest.Passengers[i].PassengerTypeInfos = new PassengerTypeInfo[1];//change back to 1 if it does not work pricerequest.Passengers[i].PassengerTypeInfos[0] = new PassengerTypeInfo();//change back PassengerTypeInfos to 0 if it doesnt work if (i < numadt) { pricerequest.Passengers[i].PassengerTypeInfos[0].PaxType = "ADT"; } else { pricerequest.Passengers[i].PassengerTypeInfos[0].PaxType = "CHD"; } pricerequest.Passengers[i].PassengerTypeInfos[0].DOB = DateTime.Parse("0001-01-01"); } //new set input on 20nd March SellRequest sellrequest = new SellRequest(); sellrequest.Signature = signature; sellrequest.SellRequestData = new SellRequestData(); sellrequest.SellRequestData.SellBy = SellBy.Journey; sellrequest.SellRequestData.SellJourneyRequest = new SellJourneyRequest(); SellResponse sellresponse = clientapi.Sell(sellrequest); //end of input pricerequest.PriceJourneys = new PriceJourney[1];// set this to 1 for a 1 way trip for (int i = 0; i < pricerequest.PriceJourneys.Length; i++) { pricerequest.PriceJourneys[i] = new PriceJourney(); // now i need to get all the available segments for price itinerary Segment[] segment = availresponse.GetTripAvailabilityResponse.Schedules[i][0].Journeys[0].Segments; //i want to use the flight designator object for the segment as it contains the carriercode, flight number used to identify a flight Console.WriteLine("Flight Number is :" + segment[i].FlightDesignator.CarrierCode + " " + segment[i].FlightDesignator.FlightNumber); Console.WriteLine("FlightTiming is : " + segment[i].STD + " " + segment[i].STA); PriceSegment[] pricesegment = new PriceSegment[segment.Length];//find the pricing of that particular segment : for a 1 way journey with 2 points, it will be 1 segment SegmentSSRRequest[] ssrRequest = new SegmentSSRRequest[segment.Length]; for (int j = 0; j < segment.Length; j++) { //to setup the segment details and equate the values of price to segment pricesegment[j] = new PriceSegment(); pricesegment[j].ActionStatusCode = "NN"; pricesegment[j].FlightDesignator = segment[j].FlightDesignator; pricesegment[j].DepartureStation = segment[j].DepartureStation; pricesegment[j].ArrivalStation = segment[j].ArrivalStation; pricesegment[j].STA = pricesegment[j].STA; //SSR setup ssrRequest[j] = new SegmentSSRRequest(); ssrRequest[j].DepartureStation = segment[j].DepartureStation; ssrRequest[j].ArrivalStation = segment[j].ArrivalStation; ssrRequest[j].FlightDesignator = segment[j].FlightDesignator; ssrRequest[j].STD = segment[j].STD; //now assume that 1 SSR is tied to 1 passenger to 1 direct flight ssrRequest[j].PaxSSRs = new PaxSSR[1]; ssrRequest[j].PaxSSRs[0] = new PaxSSR(); ssrRequest[j].PaxSSRs[0].ActionStatusCode = "SS"; ssrRequest[j].PaxSSRs[0].DepartureStation = segment[j].DepartureStation; ssrRequest[j].PaxSSRs[0].ArrivalStation = segment[j].ArrivalStation; ssrRequest[j].PaxSSRs[0].SSRCode = "BG20";// type of SSR ssrRequest[j].PaxSSRs[0].SSRNumber = 0;//this is the index of the passenger array, tag the SSR to the first passenger //now set up the Fare according to the GetAvailability Response, no need to choose the option- same as Booking2 Fare fare = segment[j].Fares[0]; pricesegment[j].Fare = new SellFare(); pricesegment[j].Fare.CarrierCode = fare.CarrierCode; pricesegment[j].Fare.ClassOfService = fare.ClassOfService; pricesegment[j].Fare.FareApplicationType = fare.FareApplicationType; pricesegment[j].Fare.FareBasisCode = fare.FareBasisCode; pricesegment[j].Fare.ProductClass = fare.ProductClass; pricesegment[j].Fare.RuleNumber = fare.RuleNumber; } priceitinrequest.ItineraryPriceRequest.SSRRequest.SegmentSSRRequests = ssrRequest; priceitinrequest.ItineraryPriceRequest.PriceItineraryBy = PriceItineraryBy.JourneyWithLegs; priceitinrequest.ItineraryPriceRequest.PriceJourneyWithLegsRequest = pricerequest; } if (sourceorg.Length > 0) { pricerequest.SourcePOS = new PointOfSale(); pricerequest.SourcePOS.AgentCode = agentcode; pricerequest.SourcePOS.OrganizationCode = sourceorg; pricerequest.SourcePOS.DomainCode = "EXT"; pricerequest.SourcePOS.LocationCode = "API"; } else { pricerequest.SourcePOS = null; } //sell my SSR on 22nd March -new input if (priceitinrequest.ItineraryPriceRequest.SSRRequest.SegmentSSRRequests != null) { sellrequest.SellRequestData = new SellRequestData(); sellrequest.SellRequestData.SellSSR = new SellSSR(); sellrequest.SellRequestData.SellSSR.SSRRequest = priceitinrequest.ItineraryPriceRequest.SSRRequest; sellrequest.SellRequestData.SellBy = SellBy.SSR; sellresponse = clientapi.Sell(sellrequest); System.Console.WriteLine("Total Flight + SSR cost {0:C}", sellresponse.BookingUpdateResponseData.Success.PNRAmount.TotalCost); } //end of SSR code return priceitinrequest; }
public PriceItineraryRequest setPriceItineraryRequest(int numadt, int numchd, String faretype, String currency, GetAvailabilityResponse response, string sourceorg, string agentcode, int overnight) { PriceItineraryRequest priceitinrequest = new PriceItineraryRequest(); priceitinrequest.Signature = signature; ItineraryPriceRequest itinerarypricerequest = new ItineraryPriceRequest(); priceitinrequest.ItineraryPriceRequest = itinerarypricerequest; itinerarypricerequest.PriceItineraryBy = PriceItineraryBy.JourneyBySellKey;//get price itinerary by using JourneyWithSellKey TypeOfSale typeofsale = new TypeOfSale(); itinerarypricerequest.TypeOfSale = typeofsale; typeofsale.FareTypes = new string[1];// refers to RE or ST or JP wholesaler fares;-faretypes are governed by type of sale typeofsale.FareTypes[0] = faretype;// pass this back to the faretype parameter PriceJourneyRequestData pricerequest = new PriceJourneyRequestData(); SellJourneyByKeyRequestData sellkeyrequest = new SellJourneyByKeyRequestData(); itinerarypricerequest.SellByKeyRequest = sellkeyrequest; pricerequest.CurrencyCode = currency; pricerequest.PriceJourneys = new PriceJourney[1]; pricerequest.PriceJourneys[0] = new PriceJourney(); pricerequest.PaxCount = (short)(numadt + numchd); return null; }