/**
         * Search modifiers to create, usually a GDS code plus optionally
         * RCH (Helper.RAIL_PROVIDER) or ACH (Helper.LOW_COST_PROVIDER).
         *
         * @param providerCode  one or more provider codes (zero will not work!)
         * @return the modifiers object
         */
        public static AirSearchModifiers CreateModifiersWithProviders(String[] providerCode)
        {
            AirSearchModifiers modifiers = new AirSearchModifiers();
            List <Provider>    providers = new List <Provider>();

            for (int i = 0; i < providerCode.Length; ++i)
            {
                Provider p = new Provider();
                // set the code for the provider
                p.Code = providerCode[i];
                // can be many providers, but we just use one
                providers.Add(p);
            }
            modifiers.PreferredProviders = providers.ToArray();
            return(modifiers);
        }
        private LowFareSearchReq SetUpLFSSearch(LowFareSearchReq lowFareSearchReq, bool solutionResult)
        {
            lowFareSearchReq.TargetBranch   = CommonUtility.GetConfigValue(ProjectConstants.G_TARGET_BRANCH);
            lowFareSearchReq.SolutionResult = solutionResult;  //Change it to true if you want AirPricingSolution, by default it is false
            //and will send AirPricePoint in the result

            //set the GDS via a search modifier
            String[]           gds       = new String[] { "1G" };
            AirSearchModifiers modifiers = AirReq.CreateModifiersWithProviders(gds);

            AirReq.AddPointOfSale(lowFareSearchReq, MY_APP_NAME);

            //try to limit the size of the return... not supported by 1G!
            modifiers.MaxSolutions = string.Format("25");
            lowFareSearchReq.AirSearchModifiers = modifiers;


            //travel is for denver to san fransisco 2 months from now, one week trip
            SearchAirLeg outbound = AirReq.CreateSearchLeg(origin, destination);

            AirReq.AddSearchDepartureDate(outbound, Helper.daysInFuture(60));
            AirReq.AddSearchEconomyPreferred(outbound);

            //coming back

            /*SearchAirLeg ret = AirReq.CreateSearchLeg(destination, origin);
             * AirReq.AddSearchDepartureDate(ret, Helper.daysInFuture(65));
             * //put traveller in econ
             * AirReq.AddSearchEconomyPreferred(ret);*/

            lowFareSearchReq.Items = new SearchAirLeg[1];
            lowFareSearchReq.Items.SetValue(outbound, 0);
            //lowFareSearchReq.Items.SetValue(ret, 1);

            //AirPricingModifiers priceModifiers = AirReq.AddAirPriceModifiers(typeAdjustmentType.Amount, +40);

            //lowFareSearchReq.AirPricingModifiers = priceModifiers;

            lowFareSearchReq.SearchPassenger = AirReq.AddSearchPassenger();

            return(lowFareSearchReq);
        }
Example #3
0
        /**
         * Search modifiers to create, usually a GDS code plus optionally
         * RCH (Helper.RAIL_PROVIDER) or ACH (Helper.LOW_COST_PROVIDER).
         *
         * @param providerCode  one or more provider codes (zero will not work!)
         * @return the modifiers object
         */
        public static AirSearchModifiers CreateModifiersWithProviders(String[] providerCode)
        {
            AirSearchModifiers modifiers = new AirSearchModifiers();
            List <Provider>    providers = new List <Provider>();

            for (int i = 0; i < providerCode.Length; ++i)
            {
                Provider p = new Provider();
                // set the code for the provider
                p.Code = providerCode[i];
                // can be many providers, but we just use one
                providers.Add(p);
            }
            modifiers.PreferredProviders = providers.ToArray();

            //List<Carrier> carriers = new List<Carrier>();
            //carriers.Add(new Carrier()
            //{
            //    Code = "GW" // MILAN::remove QF to empty, since it's a PermittedCarrier code-----reasearch for reason.
            //});
            //modifiers.PermittedCarriers = carriers.ToArray();
            return(modifiers);
        }
        private AvailabilitySearchReq SetupRequestForSearch(AvailabilitySearchReq request)
        {
            // TODO Auto-generated method stub

            //add in the tport branch code
            request.TargetBranch = CommonUtility.GetConfigValue(ProjectConstants.G_TARGET_BRANCH);

            //set the GDS via a search modifier
            String[]           gds       = new String[] { "1G" };
            AirSearchModifiers modifiers = AirReq.CreateModifiersWithProviders(gds);

            AirReq.AddPointOfSale(request, MY_APP_NAME);

            //try to limit the size of the return... not supported by 1G!
            modifiers.MaxSolutions     = string.Format("25");
            request.AirSearchModifiers = modifiers;

            //travel is for denver to san fransisco 2 months from now, one week trip
            SearchAirLeg outbound = AirReq.CreateSearchLeg(origin, destination);

            AirReq.AddSearchDepartureDate(outbound, Helper.daysInFuture(60));
            AirReq.AddSearchEconomyPreferred(outbound);

            //coming back
            SearchAirLeg ret = AirReq.CreateSearchLeg(destination, origin);

            AirReq.AddSearchDepartureDate(ret, Helper.daysInFuture(70));
            //put traveller in econ
            AirReq.AddSearchEconomyPreferred(ret);


            request.Items = new SearchAirLeg[2];
            request.Items.SetValue(outbound, 0);
            request.Items.SetValue(ret, 1);

            return(request);
        }
Example #5
0
        private LowFareSearchReq ConvertToLowFareSearchReq(FlightSearchRQ request, JourneyType journeyType)
        {
            if (request.Segments.Count == 0)
            {
                throw new  ApplicationException("Segment is required");
            }
            //Segments
            IEnumerable <SearchAirLeg> SearchAirLegs = new List <SearchAirLeg>();

            switch (journeyType)
            {
            case JourneyType.DepartAndReturn:
                if (request.Segments.Count == 1)
                {
                    throw new ApplicationException("2 segment is request to generate Depart and Return journey");
                }
                SearchAirLegs = request.Segments.OrderBy(s => s.Departure).Select(s =>
                                                                                  GenerateSearchAirLeg(s.Origin, true, s.Destination, true, s.Departure));
                break;

            case JourneyType.DepartOnly:
                SearchAirLegs = request.Segments.OrderBy(s => s.Departure).Take(1).Select(s =>
                                                                                          GenerateSearchAirLeg(s.Origin, true, s.Destination, true, s.Departure));
                break;

            case JourneyType.ReturnOnly:
                if (request.Segments.Count == 1)
                {
                    throw new ApplicationException("2 segment is request to generate Return Only journey");
                }

                SearchAirLegs = request.Segments.OrderBy(s => s.Departure).Skip(1).Take(1).Select(s =>
                                                                                                  GenerateSearchAirLeg(s.Origin, true, s.Destination, true, s.Departure));
                break;
            }


            AirSearchModifiers airSearchModifiers = new AirSearchModifiers
            {
                PreferredProviders = new Provider[] { new Provider {
                                                          Code = "1G"
                                                      } }
            };

            AirPricingModifiers airPricingModifiers = new AirPricingModifiers
            {
                ETicketabilitySpecified = true,
                ETicketability          = typeEticketability.Required,
                FaresIndicatorSpecified = true,
                FaresIndicator          = typeFaresIndicator.AllFares,
            };

            //Passengers
            var SearchPassengers = new List <SearchPassenger>();

            request.Ptcs.ForEach(p =>
            {
                for (int i = 1; i <= p.Quantity; i++)
                {
                    SearchPassengers.Add(new SearchPassenger
                    {
                        Code = p.Code == "CNN" ? "CHD" : p.Code,
                        Age  = p.Code == "CNN" ? "8" : null,
                    });
                }
            });

            LowFareSearchReq req = new LowFareSearchReq
            {
                BillingPointOfSaleInfo = new kestrel.AirService.BillingPointOfSaleInfo
                {
                    OriginApplication = "uAPI"
                },
                TargetBranch = "P7073862",
                MaxNumberOfExpertSolutions = "50",
                SolutionResult             = false,
                Items = SearchAirLegs.ToArray(),
                AirSearchModifiers  = airSearchModifiers,
                AirPricingModifiers = airPricingModifiers,
                SearchPassenger     = SearchPassengers.ToArray(),
                ReturnUpsellFare    = true
            };

            return(req);
        }
         /**
	     * Search modifiers to create, usually a GDS code plus optionally 
	     * RCH (Helper.RAIL_PROVIDER) or ACH (Helper.LOW_COST_PROVIDER).
	     * 
	     * @param providerCode  one or more provider codes (zero will not work!)
	     * @return the modifiers object
	     */
	    public static AirSearchModifiers CreateModifiersWithProviders(String[] providerCode) {
		    AirSearchModifiers modifiers = new AirSearchModifiers();
            List<Provider> providers = new List<Provider>();

		    for (int i=0; i<providerCode.Length;++i) {
			    Provider p = new Provider();
			    // set the code for the provider
			    p.Code  = providerCode[i];
			    // can be many providers, but we just use one
			    providers.Add(p);
		    }
		    modifiers.PreferredProviders  = providers.ToArray();
		    return modifiers;
	    }
Example #7
0
        /// <summary>
        /// Get Universal Record
        /// </summary>
        /// <returns></returns>
        ///
        private AvailabilitySearchRsp GetAirAvailability()
        {
            AvailabilitySearchRsp response = null;



            string someTraceId = "doesntmatter-8176";
            string originApp   = "UAPI";

            AvailabilitySearchReq req = new AvailabilitySearchReq();

            req.TraceId      = someTraceId;
            req.AuthorizedBy = "user";
            req.TargetBranch = "P7001182";
            req.RetrieveProviderReservationDetails = true;

            ATPI.TWME.SP.Lib.AirService.BillingPointOfSaleInfo billSetInfo = new ATPI.TWME.SP.Lib.AirService.BillingPointOfSaleInfo();
            billSetInfo.OriginApplication = originApp;

            Airport org = new Airport()
            {
                Code = "SYD"
            };
            Airport dest = new Airport()
            {
                Code = "MEL"
            };

            SearchAirLeg leg = new SearchAirLeg();


            AddDepartureDate(leg, daysInFuture(1));

            List <typeSearchLocation> locs = new List <typeSearchLocation>();

            locs.Add(new typeSearchLocation()
            {
                Item = org
            });

            leg.SearchOrigin = locs.ToArray();

            List <typeSearchLocation> locs1 = new List <typeSearchLocation>();

            locs1.Add(new typeSearchLocation()
            {
                Item = dest
            });

            leg.SearchDestination = locs1.ToArray();


            req.BillingPointOfSaleInfo = billSetInfo;

            req.Items = new object[1] {
                leg
            };

            var mod = new AirSearchModifiers();

            mod.PreferredProviders = new List <ATPI.TWME.SP.Lib.AirService.Provider>()
            {
                new ATPI.TWME.SP.Lib.AirService.Provider()
                {
                    Code = "1G"
                }
            }.ToArray();

            req.AirSearchModifiers = mod;


            try
            {
                BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);

                binding.Security.Transport.ProxyCredentialType  = HttpProxyCredentialType.Basic;
                binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
                string          uri             = "https://americas.universal-api.pp.travelport.com/B2BGateway/connect/uAPI/AirService";
                EndpointAddress endpointAddress = new EndpointAddress(uri);

                AirAvailabilitySearchPortTypeClient client = new AirAvailabilitySearchPortTypeClient(binding, endpointAddress);
                if (client.ClientCredentials != null)
                {
                    client.ClientCredentials.UserName.UserName = "******";
                    client.ClientCredentials.UserName.Password = "******";
                }

                response = client.service(null, req);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(response);
        }