コード例 #1
0
        private static BFM.OTA_AirLowFareSearchRQ GetBargainRequest()
        {
            var odi1 = new BFM.OTA_AirLowFareSearchRQOriginDestinationInformation
            {
                Item            = "2019-04-16T13:45:00",
                DepartureWindow = "11001500",
                RPH             = "1",
                //OriginLocation = new BFM.OriginDestinationInformationTypeOriginLocation { LocationCode = "TPE" },
                OriginLocation = new BFM.OriginDestinationInformationTypeOriginLocation {
                    LocationCode = "LAS"
                },
                DestinationLocation = new BFM.OriginDestinationInformationTypeDestinationLocation {
                    LocationCode = "LAX"
                },
                //TPA_Extensions = new BFM.OTA_AirLowFareSearchRQOriginDestinationInformationTPA_Extensions
                //{
                //    SegmentType = new BFM.ExchangeOriginDestinationInformationTypeSegmentType
                //    {
                //        Code = BFM.ExchangeOriginDestinationInformationTypeSegmentTypeCode.X,
                //        CodeSpecified = true
                //    },
                //    IncludeVendorPref = new BFM.IncludeVendorPrefType[]
                //    {
                //        new BFM.IncludeVendorPrefType
                //        {
                //            Code = "B6"
                //        }
                //    }
                //}
            };
            var odis = new BFM.OTA_AirLowFareSearchRQOriginDestinationInformation[] { odi1 };

            //var odis = new BFM.OTA_AirLowFareSearchRQOriginDestinationInformation[] { odi1, odi2 };
            var odis = new BFM.OTA_AirLowFareSearchRQOriginDestinationInformation[] { odi1 };

            var travelPreferences = new BFM.AirSearchPrefsType
            {
                TPA_Extensions = new BFM.AirSearchPrefsTypeTPA_Extensions
                {
                    TripType = new BFM.AirSearchPrefsTypeTPA_ExtensionsTripType {
                        Value = BFM.AirTripType.OneWay
                    }
                }
            };

            var travelerInfoSummary = new BFM.TravelerInfoSummaryType
            {
                SeatsRequested   = new string[] { "1" },
                AirTravelerAvail = new BFM.TravelerInformationType[]
                {
                    new BFM.TravelerInformationType
                    {
                        PassengerTypeQuantity = new BFM.PassengerTypeQuantityType[]
                        {
                            new BFM.PassengerTypeQuantityType
                            {
                                Code       = "ADT",
                                Quantity   = "1",
                                Changeable = false
                            }
                        }
                    }
                }
            };

            var req = new BFM.OTA_AirLowFareSearchRQ
            {
                Version        = "4.3.0",
                TPA_Extensions = new BFM.OTA_AirLowFareSearchRQTPA_Extensions
                {
                    IntelliSellTransaction = new BFM.TransactionType
                    {
                        RequestType = new BFM.TransactionTypeRequestType {
                            Name = "50ITINS"
                        }
                    }
                },
                POS = new BFM.SourceType[1]
                {
                    new BFM.SourceType
                    {
                        RequestorID = new BFM.UniqueID_Type
                        {
                            ID          = "1",
                            Type        = "1",
                            CompanyName = new BFM.CompanyNameType {
                                Code = "TN", Value = "TN"
                            }
                        },
                        PseudoCityCode = "PCC"
                    }
                },
                OriginDestinationInformation = odis,
                TravelPreferences            = travelPreferences,
                TravelerInfoSummary          = travelerInfoSummary,
            };


            return(req);
        }
        private static BFM.OTA_AirLowFareSearchRQ GetBargainRequest
        (
            IList <FlightDescription> flightDescriptions,
            string itemsCount,
            BFM.AirTripType tripType
        )
        {
            var odis = flightDescriptions.Select(i => new BFM.OTA_AirLowFareSearchRQOriginDestinationInformation
            {
                RPH            = i.RPH,
                Item           = i.DepartureDateTime,
                OriginLocation = new BFM.OriginDestinationInformationTypeOriginLocation {
                    LocationCode = i.OriginLocation
                },
                DestinationLocation = new BFM.OriginDestinationInformationTypeDestinationLocation {
                    LocationCode = i.DestinationLocation
                },
            }).ToList();

            if (tripType == BFM.AirTripType.Return)
            {
                odis.AddRange(flightDescriptions.Select(i => new BFM.OTA_AirLowFareSearchRQOriginDestinationInformation
                {
                    RPH            = i.RPH,
                    Item           = i.ArrivalDateTime,
                    OriginLocation = new BFM.OriginDestinationInformationTypeOriginLocation {
                        LocationCode = i.DestinationLocation
                    },
                    DestinationLocation = new BFM.OriginDestinationInformationTypeDestinationLocation {
                        LocationCode = i.OriginLocation
                    },
                }));
            }
            var travelPreferences = new BFM.AirSearchPrefsType
            {
                CabinPref = new BFM.CabinPrefType[1] //
                {
                    new BFM.CabinPrefType
                    {
                        Cabin       = BFM.CabinType.Y,
                        PreferLevel = BFM.PreferLevelType.Preferred
                    }
                },
                TPA_Extensions = new BFM.AirSearchPrefsTypeTPA_Extensions
                {
                    OnlineIndicator = new BFM.AirSearchPrefsTypeTPA_ExtensionsOnlineIndicator
                    {
                        Ind = true
                    },
                    TripType = new BFM.AirSearchPrefsTypeTPA_ExtensionsTripType
                    {
                        Value          = tripType,
                        ValueSpecified = true
                    }
                }
            };

            var travelerInfoSummary = new BFM.TravelerInfoSummaryType
            {
                SeatsRequested   = new string[] { "2" },
                AirTravelerAvail = new BFM.TravelerInformationType[]
                {
                    new BFM.TravelerInformationType
                    {
                        PassengerTypeQuantity = new BFM.PassengerTypeQuantityType[]
                        {
                            new BFM.PassengerTypeQuantityType
                            {
                                Code       = "ADT",
                                Quantity   = "2",
                                Changeable = true
                            }
                        }
                    }
                }
            };

            var req = new BFM.OTA_AirLowFareSearchRQ
            {
                Version = "4.3.0",
                AvailableFlightsOnly = true,
                DirectFlightsOnly    = true, //
                TPA_Extensions       = new BFM.OTA_AirLowFareSearchRQTPA_Extensions
                {
                    IntelliSellTransaction = new BFM.TransactionType
                    {
                        RequestType = new BFM.TransactionTypeRequestType {
                            Name = itemsCount
                        }
                    }
                },
                POS = new BFM.SourceType[1]
                {
                    new BFM.SourceType
                    {
                        RequestorID = new BFM.UniqueID_Type
                        {
                            ID          = "1",
                            Type        = "1",
                            CompanyName = new BFM.CompanyNameType {
                                Code = "TN", Value = "TN"
                            }
                        },
                        PseudoCityCode = "PCC"
                    }
                },
                OriginDestinationInformation = odis.ToArray(),
                TravelPreferences            = travelPreferences,
                TravelerInfoSummary          = travelerInfoSummary,
            };

            return(req);
        }