示例#1
0
        internal static AirPricingModifiers AddAirPriceModifiers(typeAdjustmentType adjustmentType, int amount)
        {
            AirPricingModifiers         priceModifiers = new AirPricingModifiers();
            List <ManualFareAdjustment> fareList       = new List <ManualFareAdjustment>();

            ManualFareAdjustment fareAdjustment = new ManualFareAdjustment();

            if (typeAdjustmentType.Amount.CompareTo(adjustmentType) == 0)
            {
                fareAdjustment.AdjustmentType = typeAdjustmentType.Amount;
            }
            else if (typeAdjustmentType.Percentage.CompareTo(adjustmentType) == 0)
            {
                fareAdjustment.AdjustmentType = typeAdjustmentType.Percentage;
            }

            fareAdjustment.PassengerRef = "1";
            fareAdjustment.AppliedOn    = typeAdjustmentTarget.Base;
            fareAdjustment.Value        = amount;

            fareList.Add(fareAdjustment);

            priceModifiers.ManualFareAdjustment = fareList.ToArray();

            return(priceModifiers);
        }
        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(4));
            AirReq.AddSearchEconomyPreferred(outbound);

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

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

            lowFareSearchReq.Items = new SearchAirLeg[2];
            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);
        }
示例#3
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);
        }
        internal static AirPricingModifiers AddAirPriceModifiers(typeAdjustmentType adjustmentType, int amount)
        {
            AirPricingModifiers priceModifiers = new AirPricingModifiers();
            List<ManualFareAdjustment> fareList = new List<ManualFareAdjustment>();

            ManualFareAdjustment fareAdjustment = new ManualFareAdjustment();

            if (typeAdjustmentType.Amount.CompareTo(adjustmentType) == 0)
            {
                fareAdjustment.AdjustmentType = typeAdjustmentType.Amount;
            }
            else if (typeAdjustmentType.Percentage.CompareTo(adjustmentType) == 0)
            {
                fareAdjustment.AdjustmentType = typeAdjustmentType.Percentage;
            }

            fareAdjustment.PassengerRef = "1";
            fareAdjustment.AppliedOn = typeAdjustmentTarget.Base;
            fareAdjustment.Value = amount;

            fareList.Add(fareAdjustment);

            priceModifiers.ManualFareAdjustment = fareList.ToArray();

            return priceModifiers;
        }
        public static AirPricingModifiers FareAdjustment(string AdjustmentType, decimal Amount)
        {
            AirPricingModifiers pricingModifiers = new AirPricingModifiers();
            List<ManualFareAdjustment> farelist = new List<ManualFareAdjustment>();
            ManualFareAdjustment manualFareAdjustment = new ManualFareAdjustment();

            if (AdjustmentType == "Amount")
            {
                manualFareAdjustment.AdjustmentType = typeAdjustmentType.Amount;
            }
            else
            {
                manualFareAdjustment.AdjustmentType = typeAdjustmentType.Percentage;
            }

            manualFareAdjustment.PassengerRef = "1";
            manualFareAdjustment.AppliedOn = typeAdjustmentTarget.Base;
            manualFareAdjustment.Value = Amount;

            farelist.Add(manualFareAdjustment);

            pricingModifiers.ManualFareAdjustment = farelist.ToArray();
            return pricingModifiers;
        }