private static SupplierInfo GetSupplierInfo(DataRow row)
        {
            var supplierInfo = new SupplierInfo
                                   {
                                       Provider = row["Provider"].GetString(),
                                       Mode = row["Mode"].GetString(),
                                       SupplierName =
                                           row["SupplierName"].GetString(),
                                       Password = row["Password"].GetString(),
                                       ServiceUrl = row["ServiceUrl"].GetString(),
                                       UserName = row["UserName"].GetString(),
                                       CustomAttributes = new List<CustomAttribute>(),
                                       IsMockEnabled = row["IsMockEnabled"].GetInt() != 0,
                                       IsOnlyMockBooking = row["IsOnlyMockBooking"].GetInt() != 0,
                                   };
            var additionalInfo = row["AdditionalInfo"].GetString();

            if (!string.IsNullOrEmpty(additionalInfo))
            {
                string[] keyValues = additionalInfo.Split('^');
                keyValues.ToList().ForEach((x) =>
                                               {
                                                   var y = x.Split('|');
                                                   supplierInfo.CustomAttributes.Add(new CustomAttribute
                                                                                         {Name = y[0], Value = y[1]});
                                               });
            }
            supplierInfo["SessionId"] = ApplicationContext.GetSessionId();
            return supplierInfo;
        }
Esempio n. 2
0
        internal static OTA_AirBookRQRequest CreateAirBookRequest(SupplierInfo supplierInfo, AirItinerary airItinerary, List<Passenger> passengers, List<Charge> charges, Account account)
        {
            OTA_AirBookRQRequest request = new OTA_AirBookRQRequest();
            request.IsOnlyMockBooking = supplierInfo.IsOnlyMockBooking;
            request.IsMockEnabled = supplierInfo.IsMockEnabled;
            request.MessageHeader = CreateMessageHeader(supplierInfo, "OTA_AirBookRQ", "Create PNR");
            request.Security = CreateSecurityHeader(supplierInfo, airItinerary[Constants.SecurityToken]);
            request.OTA_AirBookRQ = new OTA_AirBookRQ();
            request.OTA_AirBookRQ.Version = 1.0m;
            request.OTA_AirBookRQ.TransactionStatusCode = TransactionStatusCode.End;
            request.OTA_AirBookRQ.TransactionStatusCodeSpecified = true;

            List<AirTravelerType> travellers = new List<AirTravelerType>();
            int infantsCnt = passengers.GetInfantCount();
            foreach (Passenger passenger in passengers)
            {
                AirTravelerType traveller = GetTravellerDetails(passenger, account, (travellers.Count).ToString());
                travellers.Add(traveller);
            }
            List<AirTravelerType> adultTravellers = travellers.FindAll(tv => string.Equals(tv.PassengerTypeCode, "ADT"));
            for (int i = 0; i < adultTravellers.Count;i++)
            {
                if (i == 0)
                {
                    adultTravellers[i].Telephone = new AirTravelerTypeTelephone[]
                                                       {
                                                           new AirTravelerTypeTelephone()
                                                               {
                                                                   RPH = "1",
                                                                   PhoneLocationType = "M",
                                                                   PhoneNumber = account.Mobile,
                                                                   Operation = ActionType.Add,
                                                                   OperationSpecified = true
                                                               }
                                                       };
                    adultTravellers[i].Email = new Email[]
                                                   {
                                                       new Email()
                                                           {
                                                               RPH = "1",
                                                               Value = account.Email,
                                                               Operation = ActionType.Add,
                                                               OperationSpecified = true
                                                           }
                                                   };
                }
                if ((i + 1) <= infantsCnt)
                    adultTravellers[i].AccompaniedByInfant = true;
            }
            if(string.Equals(supplierInfo.Mode,"Test"))
            {
                adultTravellers[0].PersonName.GivenName[0] = "ECOMM";
                adultTravellers[0].PersonName.Surname = "ECOMMERCE";
            }
            request.OTA_AirBookRQ.TravelerInfo = new TravelerInfoType();
            request.OTA_AirBookRQ.TravelerInfo.AirTraveler = travellers.ToArray();
            request.OTA_AirBookRQ.TravelerInfo.SpecialReqDetails = new SpecialReqDetailsType[1];
            request.OTA_AirBookRQ.TravelerInfo.SpecialReqDetails[0] = new SpecialReqDetailsType();
            return request;
        }
Esempio n. 3
0
        public static FlightMatrixRequestRequest CreateFlightMatrixRequest(SupplierInfo supplierInfo, FlightSearchParams searchParams, string binaryToken)
        {
            FlightMatrixRequestRequest request = new FlightMatrixRequestRequest();
            request.IsOnlyMockBooking = supplierInfo.IsOnlyMockBooking;
            request.IsMockEnabled = supplierInfo.IsMockEnabled;
            request.MessageHeader = CreateMessageHeader(supplierInfo, "FlightMatrixRQ", "GetFlightMatrix");
            request.Security = CreateSecurityHeader(supplierInfo, binaryToken);

            FlightMatrixRQ flightMatrixRq = new FlightMatrixRQ();
            //request.EchoToken = Guid.NewGuid().ToString();
            flightMatrixRq.TimeStamp = DateTime.UtcNow;
            flightMatrixRq.Target = Target.Test;
            flightMatrixRq.Version = 1.1m;
            //request.SequenceNmbr = "1";
            flightMatrixRq.POS = new[]
                              {
                                  new SourceType
                                      {
                                          ISOCountry = "IN"
                                      }
                              };

            List<TravelerInformationType> travellers = GetTravellersInfo(searchParams.Adults,searchParams.Children, searchParams.Infants);
            flightMatrixRq.TravelerInfoSummary = new TravelerInfoSummaryType();
            flightMatrixRq.TravelerInfoSummary.AirTravelerAvail = travellers.ToArray();
            if (searchParams.CabinClassSpecified)
            {
                CabinType cabinClass = CabinType.Economy;
                if (string.Equals(searchParams.CabinClass, "First")) cabinClass = CabinType.First;
                else if (string.Equals(searchParams.CabinClass, "Business")) cabinClass = CabinType.Business;
                flightMatrixRq.TravelerInfoSummary.PriceRequestInformation = new PriceRequestInformationType
                {
                    CabinType = cabinClass,
                    CabinTypeSpecified = true
                };
            }
            flightMatrixRq.AirItinerary = new AirItineraryType();
            flightMatrixRq.AirItinerary.DirectionInd = AirTripType.OneWay;
            flightMatrixRq.AirItinerary.DirectionIndSpecified = true;
            flightMatrixRq.AirItinerary.OriginDestinationOptions = new []
                                                                {
                                                                    new[]
                                                                        {
                                                                            new BookFlightSegmentType()
                                                                                {
                                                                                    DepartureAirport = new DepartureAirport() { LocationCode = searchParams.FromAirport },
                                                                                    ArrivalAirport = new ArrivalAirport {LocationCode = searchParams.ToAirport },
                                                                                    DepartureDateTime = searchParams.Date,
                                                                                    RPH = "1",
                                                                                    MarketingAirline = new MarketingAirline {Code = "9W"}
                                                                                }
                                                                        }
                                                                };

            request.FlightMatrixRQ = flightMatrixRq;
            return request;
        }
Esempio n. 4
0
 public static LogonRequest CreateLogonRequest(SupplierInfo supplierInfo)
 {
     LogonRequest request = new LogonRequest();
     request.IsOnlyMockBooking = supplierInfo.IsOnlyMockBooking;
     request.IsMockEnabled = supplierInfo.IsMockEnabled;
     request.MessageHeader = CreateMessageHeader(supplierInfo, "CreateSession", "Create");
     request.Security = CreateSecurityHeader(supplierInfo);
     return request;
 }
Esempio n. 5
0
 public static SupplierInfo GetSupplierInfo()
 {
     SupplierInfo supplierInfo = new SupplierInfo();
     supplierInfo.UserName = "******";
     supplierInfo.Password = "******";
     //supplierInfo.ServiceUrl = "http://220.226.185.57/JetTAOBEAPI/";
     supplierInfo.ServiceUrl = "http://webservices.jetairways.com/jettaobeapi/";
     supplierInfo.IsMockEnabled = true;
     supplierInfo.IsOnlyMockBooking = false;
     supplierInfo.CustomAttributes = new List<CustomAttribute>();
     supplierInfo.CustomAttributes.Add(new CustomAttribute("Domain", "9W"));
     supplierInfo.CustomAttributes.Add(new CustomAttribute("Organization", "9W"));
     supplierInfo.CustomAttributes.Add(new CustomAttribute("CPAId", "9W"));
     supplierInfo.CustomAttributes.Add(new CustomAttribute("SessionCreateService", "SessionCreate.asmx"));
     supplierInfo.CustomAttributes.Add(new CustomAttribute("SessionCloseService", "SessionClose.asmx"));
     supplierInfo.CustomAttributes.Add(new CustomAttribute("FlightMatrixService", "flightmatrixservice.asmx"));
     supplierInfo.CustomAttributes.Add(new CustomAttribute("AirSellService", "AirSellService.asmx"));
     supplierInfo.CustomAttributes.Add(new CustomAttribute("IgnoreService", "IgnoreService.asmx"));
     supplierInfo.CustomAttributes.Add(new CustomAttribute("AirBookService", "AirBookService.asmx"));
     supplierInfo.CustomAttributes.Add(new CustomAttribute("TicketService", "TicketService.asmx"));
     supplierInfo["SessionId"] = Guid.NewGuid().ToString();
     return supplierInfo;
 }
Esempio n. 6
0
 internal static List<AirItinerary> ParseSearchResponse(SupplierInfo  supplierInfo, JetModel.FlightMatrixRequestResponse searchResponse, FlightSearchParams searchParams, ref string securityToken)
 {
     try
     {
         securityToken = SetSecurityToken(searchResponse.Security, null);
         if(searchResponse.FlightMatrixRS == null ||
             searchResponse.FlightMatrixRS.FlightMatrices == null || searchResponse.FlightMatrixRS.FlightMatrices.Length == 0 ||
             searchResponse.FlightMatrixRS.FlightMatrixOptions == null || searchResponse.FlightMatrixRS.FlightMatrixOptions.Length == 0)
         {
             throw new Exception("Invalid FlightMatrixRequestResponse from Jet!!!");
         }
         List<AirItinerary> airItineraries = new List<AirItinerary>();
         Dictionary<int, FlightFares> jetFlightFares = GetFlightFares(searchResponse);
         airItineraries = ParseFlightFares(jetFlightFares, searchParams, supplierInfo);
         airItineraries.ForEach(itin => itin[Constants.SecurityToken] = searchResponse.Security.BinarySecurityToken);
         return airItineraries;
     }
     catch (Exception ex)
     {
         Logger.LogException(ex, Source, "ParseSearchResponse", Severity.Major);
         return new List<AirItinerary>();
     }
 }
Esempio n. 7
0
 private static ISupplier GetSupplier(SupplierInfo supplierInfo)
 {
     if (string.Equals(supplierInfo.Provider, "Jet", StringComparison.OrdinalIgnoreCase))
         return new Suppliers.Jet.AirSupplier(supplierInfo);
     return null;
 }
Esempio n. 8
0
 private static Security CreateSecurityHeader(SupplierInfo supplierInfo, string binaryToken = null)
 {
     return string.IsNullOrEmpty(binaryToken)
                ? new Security
                {
                    UsernameToken = new SecurityUsernameToken
                    {
                        Username = supplierInfo.UserName,
                        Password = supplierInfo.Password,
                        Domain = supplierInfo.GetDomain(),
                        Organization = supplierInfo.GetOrganization(),
                    }
                }
                : new Security
                {
                    BinarySecurityToken = binaryToken
                };
 }
Esempio n. 9
0
 private static MessageHeader CreateMessageHeader(SupplierInfo supplierInfo, string action, string serviceValue)
 {
     return new MessageHeader
     {
         Action = action,
         Service = new Service { Value = serviceValue },
         ConversationId = Guid.NewGuid().ToString(),
         CPAId = supplierInfo.GetCPAId(),
         MessageData =
             new MessageData
             {
                 Timestamp = DateTime.UtcNow.ToString(Constants.DateTimeFormat),
                 MessageId = Guid.NewGuid().ToString()
             }
     };
 }
Esempio n. 10
0
 internal static LogoffRequest CreateLogoffRequest(SupplierInfo supplierInfo, string securityToken)
 {
     LogoffRequest request = new LogoffRequest();
     request.IsOnlyMockBooking = supplierInfo.IsOnlyMockBooking;
     request.IsMockEnabled = supplierInfo.IsMockEnabled;
     request.MessageHeader = CreateMessageHeader(supplierInfo, "SessionClose", "Logoff");
     request.Security = CreateSecurityHeader(supplierInfo, securityToken);
     return request;
 }
Esempio n. 11
0
 internal static IgnoreRQRequest CreateIgnoreTransationRequest(SupplierInfo supplierInfo, string securityToken)
 {
     IgnoreRQRequest request = new IgnoreRQRequest();
     request.IsOnlyMockBooking = supplierInfo.IsOnlyMockBooking;
     request.IsMockEnabled = supplierInfo.IsMockEnabled;
     request.MessageHeader = CreateMessageHeader(supplierInfo, "IgnoreTransaction", "IgnoreRQ");
     request.Security = CreateSecurityHeader(supplierInfo, securityToken);
     request.IgnoreRQ = new IgnoreRQ();
     return request;
 }
Esempio n. 12
0
 internal static AirTicketRQRequest CreateAitTicketRequest(SupplierInfo supplierInfo, AirItinerary airItinerary, string pnr)
 {
     AirTicketRQRequest request = new AirTicketRQRequest();
     request.IsOnlyMockBooking = supplierInfo.IsOnlyMockBooking;
     request.IsMockEnabled = supplierInfo.IsMockEnabled;
     request.MessageHeader = CreateMessageHeader(supplierInfo, "AirTicketRQ", "Ticket PNR");
     request.Security = CreateSecurityHeader(supplierInfo, airItinerary[Constants.SecurityToken]);
     request.OTA_AirBookRQ = new OTA_AirBookRQ()
                                 {
                                     Ticketing = new TicketingInfoType() {TicketType = TicketType.eTicket},
                                     BookingReferenceID = new UniqueID_Type() {ID = pnr},
                                 };
     request.OTA_AirBookRQ.TransactionStatusCodeSpecified = true;
     request.OTA_AirBookRQ.TransactionStatusCode = TransactionStatusCode.End;
     return request;
 }
Esempio n. 13
0
        internal static AirSellRQRequest CreateAirSellRequest(SupplierInfo supplierInfo, AirItinerary airItinerary, string status = "NN")
        {
            AirSellRQRequest request = new AirSellRQRequest();
            request.IsOnlyMockBooking = supplierInfo.IsOnlyMockBooking;
            request.IsMockEnabled = supplierInfo.IsMockEnabled;
            int adultCount =0, infantCount=0, childCount=0;
            foreach (PassengerFare paxFare in airItinerary.AirFare.PassengerFares)
            {
                if (paxFare.PassengerType == PassengerType.Adult)
                    adultCount = adultCount + paxFare.Quantity;
                if (paxFare.PassengerType == PassengerType.Child)
                    childCount = childCount + paxFare.Quantity;
                if (paxFare.PassengerType == PassengerType.Infant)
                    infantCount = infantCount + paxFare.Quantity;
            }
            request.MessageHeader = CreateMessageHeader(supplierInfo, "OTA_AirSellService", "AirSellRQ");
            request.Security = CreateSecurityHeader(supplierInfo, airItinerary[Constants.SecurityToken]);
            request.OTA_AirPriceRQ = new OTA_AirPriceRQ();
            request.OTA_AirPriceRQ.AirItinerary = new AirItineraryType();
            request.OTA_AirPriceRQ.AirItinerary.DirectionInd = AirTripType.OneWay;
            request.OTA_AirPriceRQ.AirItinerary.DirectionIndSpecified = true;
            List<BookFlightSegmentType> segments = new List<BookFlightSegmentType>();
            foreach (Flight flight in airItinerary.Flights)
            {
                BookFlightSegmentType segment = new BookFlightSegmentType()
                                                    {
                                                        RPH = flight.Index.ToString(),
                                                        ArrivalAirport =
                                                            new ArrivalAirport() { LocationCode = flight.ToAirportCode },
                                                        ArrivalDateTime = flight.ArrivalDateTime,
                                                        DepartureAirport =
                                                            new DepartureAirport()
                                                                {LocationCode = flight.FromAirportCode},
                                                        DepartureDateTime = flight.DepartureDateTime,
                                                        FlightNumber = flight.FlightNumber,
                                                        ResBookDesigCode = flight.ClassOfService,
                                                        NumberInParty =  (adultCount + childCount + infantCount).ToString(),
                                                        Status = status,
                                                        OperatingAirline =
                                                            new OperatingAirlineType() { Code = flight.AirlineCode },
                                                        MarketingAirline =
                                                            new MarketingAirline() { Code = flight.MarketingAirlineCode },
                                                    };
                segments.Add(segment);
            }
            request.OTA_AirPriceRQ.AirItinerary.OriginDestinationOptions = new BookFlightSegmentType[1][];
            request.OTA_AirPriceRQ.AirItinerary.OriginDestinationOptions[0] = segments.ToArray();

            List<TravelerInformationType> travellers = GetTravellersInfo(adultCount , childCount, infantCount);
            request.OTA_AirPriceRQ.TravelerInfoSummary = new TravelerInfoSummaryType();
            request.OTA_AirPriceRQ.TravelerInfoSummary.AirTravelerAvail = travellers.ToArray();
            return request;
        }
Esempio n. 14
0
 private static List<AirItinerary> ParseFlightFares(Dictionary<int, FlightFares> jetFlightFares, FlightSearchParams searchParams,
     SupplierInfo supplierInfo)
 {
     List<AirItinerary> airItineraries = new List<AirItinerary>();
     foreach (int flightKey in jetFlightFares.Keys)
     {
         foreach (int fareKey in jetFlightFares[flightKey].MatrixRowOptions.Keys)
         {
             try
             {
                 JetModel.FlightMatrixOption fareOption = jetFlightFares[flightKey].MatrixRowOptions[fareKey];
                 if (fareOption != null)
                 {
                     AirFare airFare = ParsePassengerFareBreadowns(fareOption.PTC_FareBreakdown, searchParams.Adults, searchParams.Children, searchParams.Infants, false);
                     if (airFare != null)
                     {
                         List<Flight> flights = ParseFlightMatrixRow(jetFlightFares[flightKey].MatrixRow);
                         if (flights == null || flights.Count == 0) continue;
                         //Assign CabinClass, FareBasisCodesm and ClassOfService to each flight segment.
                         string[] cabinClasses = airFare.PassengerFares[0].CabinClass.Split(',');
                         string[] fareBasisCodes = airFare.PassengerFares[0].FareBasisCode.Split(',');
                         string[] classOfServices = airFare.PassengerFares[0].ClassOfService.Split(',');
                         for (int i = 0; i < flights.Count; i++)
                         {
                             int index = i >= cabinClasses.Length ? cabinClasses.Length - 1 : i;
                             flights[i].CabinClass = cabinClasses[index];
                             index = i >= classOfServices.Length ? classOfServices.Length - 1 : i;
                             flights[i].ClassOfService = classOfServices[index];
                             index = i >= fareBasisCodes.Length ? fareBasisCodes.Length - 1 : i;
                             flights[i].FareBasisCode = fareBasisCodes[index];
                         }
                         AirItinerary itinerary = new AirItinerary();
                         itinerary.JourneyType = "OneWay";
                         itinerary.AirFare = airFare;
                         itinerary.Flights = flights;
                         itinerary.Index = airItineraries.Count;
                         itinerary.Provider = supplierInfo.Provider;
                         itinerary.Mode = supplierInfo.Mode;
                         airItineraries.Add(itinerary);
                     }
                 }
             }
             catch (Exception ex)
             {
                 Logger.LogException(ex, Source, "ParseFlightFares", Severity.Major);
             }
         }
     }
     return airItineraries;
 }
Esempio n. 15
0
 public AirSupplier(SupplierInfo supplierInfo)
 {
     _supplierInfo = supplierInfo;
 }