示例#1
0
        public BookingPricing Retrieve()
        {
            var currentBooking = _sessionStorage.Get <BookingPricing>("DomainBooking");

            BookingPricing bookingPricing;

            if (currentBooking != null)
            {
                bookingPricing = currentBooking;
            }
            else
            {
                bookingPricing = new BookingPricing
                {
                    Currency = "EUR",
                    Journeys = new List <Journey>
                    {
                        new Journey
                        {
                            ReferenceId = "AAA000",
                            Segments    = new List <Segment>
                            {
                                new Segment
                                {
                                    ReferenceId = "ABC01",
                                    Transport   = new Transport {
                                        Carrier = new Carrier {
                                            Code = "E9"
                                        }, Number = "VU101"
                                    },
                                    Legs = new List <Leg>
                                    {
                                        new Leg
                                        {
                                            Origin      = "MAD",
                                            Destination = "CUN",
                                            STD         = DateTime.Today
                                        }
                                    }
                                },
                                new Segment
                                {
                                    ReferenceId = "ABC02",
                                    Transport   = new Transport {
                                        Carrier = new Carrier {
                                            Code = "E9"
                                        }, Number = "VU102"
                                    },
                                    Legs = new List <Leg>
                                    {
                                        new Leg
                                        {
                                            Origin      = "CUN",
                                            Destination = "MAD",
                                            STD         = DateTime.Today.AddDays(1)
                                        }
                                    }
                                }
                            }
                        }
                    }
                };
            }

            return(bookingPricing);
        }
 public void SetUp()
 {
     this.booking        = new Booking();
     this.bookingPricing = new BookingPricing(booking);
 }
示例#3
0
        private List <Service> GenerateServices(BookingPricing booking)
        {
            var services = new List <Service>();
            List <ServiceAvailability> serviceAvailabilities;
            var journeys = booking.Journeys;

            serviceAvailabilities = GenerateServiceAvailabilities(journeys);
            if (serviceAvailabilities.Any())
            {
                services.Add(new Service
                {
                    SellType     = ProductScopeType.PerPaxSegment,
                    Availability = serviceAvailabilities,
                    Charges      = GenerateServiceCharges(booking.Currency),
                    Info         = new ServiceInfo
                    {
                        Code     = "SEAT",
                        Name     = "Regular seat",
                        Category = "Seat",
                        Type     = ServiceType.Seat
                    }
                });
            }

            serviceAvailabilities = GenerateServiceAvailabilities(journeys);
            if (serviceAvailabilities.Any())
            {
                services.Add(new Service
                {
                    SellType     = ProductScopeType.PerPaxSegment,
                    Availability = serviceAvailabilities,
                    Charges      = GenerateServiceCharges(booking.Currency),
                    Info         = new ServiceInfo
                    {
                        Code     = "SEATXL",
                        Name     = "Extra large seat",
                        Category = "PremiumSeat",
                        Type     = ServiceType.Seat
                    }
                });
            }

            serviceAvailabilities = GenerateServiceAvailabilities(journeys);
            if (serviceAvailabilities.Any())
            {
                services.Add(new Service
                {
                    SellType     = ProductScopeType.PerPaxSegment,
                    Availability = serviceAvailabilities,
                    Charges      = GenerateServiceCharges(booking.Currency),
                    Info         = new ServiceInfo
                    {
                        Code     = "SEATPLUS",
                        Name     = "Premium plus seat",
                        Category = "PremiumSeat",
                        Type     = ServiceType.Seat
                    }
                });
            }

            return(services);
        }
        /// <summary>
        /// Generate random services for the type and segments indicated.
        /// </summary>
        /// <param name="type">Service type of services to be created.</param>
        /// <param name="journeys">Journey info with segments for service creation.</param>
        /// <returns></returns>
        private List <Service> GenerateServices(ServiceType type, BookingPricing booking)
        {
            var services = new List <Service>();
            List <ServiceAvailability> serviceAvailabilities;
            var journeys = booking.Journeys;

            switch (type)
            {
            case ServiceType.Baggage:
                serviceAvailabilities = GenerateServiceAvailabilities(journeys, ProductScopeType.PerPaxSegment);
                if (serviceAvailabilities.Any())
                {
                    services.Add(new Service
                    {
                        SellType     = ProductScopeType.PerPaxSegment,
                        Availability = serviceAvailabilities,
                        Charges      = GenerateServiceCharges(booking.Currency),
                        Info         = new ServiceInfo
                        {
                            Code     = "BAG1",
                            Name     = "Extra luggage 25kg",
                            Category = "ExtraBag",
                            Type     = ServiceType.Baggage
                        }
                    });
                }

                serviceAvailabilities = GenerateServiceAvailabilities(journeys, ProductScopeType.PerPaxSegment);
                if (serviceAvailabilities.Any())
                {
                    services.Add(new Service
                    {
                        SellType     = ProductScopeType.PerPaxSegment,
                        Availability = serviceAvailabilities,
                        Charges      = GenerateServiceCharges(booking.Currency),
                        Info         = new ServiceInfo
                        {
                            Code     = "BAG2",
                            Name     = "Extra luggage 32kg",
                            Category = "ExtraBag",
                            Type     = ServiceType.Baggage
                        }
                    });
                }

                serviceAvailabilities = GenerateServiceAvailabilities(journeys, ProductScopeType.PerPaxSegment);
                if (serviceAvailabilities.Any())
                {
                    services.Add(new Service
                    {
                        SellType     = ProductScopeType.PerPaxSegment,
                        Availability = serviceAvailabilities,
                        Charges      = GenerateServiceCharges(booking.Currency),
                        Info         = new ServiceInfo
                        {
                            Code     = "BAG3",
                            Name     = "Extra luggage 38kg",
                            Category = "ExtraBag",
                            Type     = ServiceType.Baggage
                        }
                    });
                }

                serviceAvailabilities = GenerateServiceAvailabilities(journeys, ProductScopeType.PerPaxSegment);
                if (serviceAvailabilities.Any())
                {
                    services.Add(new Service
                    {
                        SellType     = ProductScopeType.PerPaxSegment,
                        Availability = serviceAvailabilities,
                        Charges      = GenerateServiceCharges(booking.Currency),
                        Info         = new ServiceInfo
                        {
                            Code     = "SPEQ",
                            Name     = "Special equipment",
                            Category = "SpecialEquipment",
                            Type     = ServiceType.Baggage
                        }
                    });
                }
                break;

            case ServiceType.Meal:
                serviceAvailabilities = GenerateServiceAvailabilities(journeys, ProductScopeType.PerPaxSegment);
                if (serviceAvailabilities.Any())
                {
                    services.Add(new Service
                    {
                        SellType     = ProductScopeType.PerPaxSegment,
                        Availability = serviceAvailabilities,
                        Charges      = GenerateServiceCharges(booking.Currency),
                        Info         = new ServiceInfo
                        {
                            Code     = "VEGMEAL",
                            Name     = "Vegetarian meal",
                            Category = "Meal",
                            Type     = ServiceType.Meal
                        }
                    });
                }

                serviceAvailabilities = GenerateServiceAvailabilities(journeys, ProductScopeType.PerPaxSegment);
                if (serviceAvailabilities.Any())
                {
                    services.Add(new Service
                    {
                        SellType     = ProductScopeType.PerPaxSegment,
                        Availability = serviceAvailabilities,
                        Charges      = GenerateServiceCharges(booking.Currency),
                        Info         = new ServiceInfo
                        {
                            Code     = "MEUM",
                            Name     = "Meat meal",
                            Category = "Meal",
                            Type     = ServiceType.Meal
                        }
                    });
                }

                serviceAvailabilities = GenerateServiceAvailabilities(journeys, ProductScopeType.PerPaxSegment);
                if (serviceAvailabilities.Any())
                {
                    services.Add(new Service
                    {
                        SellType     = ProductScopeType.PerPaxSegment,
                        Availability = serviceAvailabilities,
                        Charges      = GenerateServiceCharges(booking.Currency),
                        Info         = new ServiceInfo
                        {
                            Code     = "LIUM",
                            Name     = "Gluten free meal",
                            Category = "Meal",
                            Type     = ServiceType.Meal
                        }
                    });
                }

                serviceAvailabilities = GenerateServiceAvailabilities(journeys, ProductScopeType.PerPaxSegment);
                if (serviceAvailabilities.Any())
                {
                    services.Add(new Service
                    {
                        SellType     = ProductScopeType.PerPaxSegment,
                        Availability = serviceAvailabilities,
                        Charges      = GenerateServiceCharges(booking.Currency),
                        Info         = new ServiceInfo
                        {
                            Code     = "FIUM",
                            Name     = "Meat gourmet meal",
                            Category = "PremiumMeal",
                            Type     = ServiceType.Meal
                        }
                    });
                }

                serviceAvailabilities = GenerateServiceAvailabilities(journeys, ProductScopeType.PerPaxSegment);
                if (serviceAvailabilities.Any())
                {
                    services.Add(new Service
                    {
                        SellType     = ProductScopeType.PerPaxSegment,
                        Availability = serviceAvailabilities,
                        Charges      = GenerateServiceCharges(booking.Currency),
                        Info         = new ServiceInfo
                        {
                            Code     = "PAUM",
                            Name     = "Vegetarian gourmet meal",
                            Category = "PremiumMeal",
                            Type     = ServiceType.Meal
                        }
                    });
                }
                break;

            case ServiceType.Seat:
                serviceAvailabilities = GenerateServiceAvailabilities(journeys, ProductScopeType.PerPaxSegment);
                if (serviceAvailabilities.Any())
                {
                    services.Add(new Service
                    {
                        SellType     = ProductScopeType.PerPaxSegment,
                        Availability = serviceAvailabilities,
                        Charges      = GenerateServiceCharges(booking.Currency),
                        Info         = new ServiceInfo
                        {
                            Code     = "SWA1",
                            Name     = "Regular seat",
                            Category = "Seat",
                            Type     = ServiceType.Seat
                        }
                    });
                }

                serviceAvailabilities = GenerateServiceAvailabilities(journeys, ProductScopeType.PerPaxSegment);
                if (serviceAvailabilities.Any())
                {
                    services.Add(new Service
                    {
                        SellType     = ProductScopeType.PerPaxSegment,
                        Availability = serviceAvailabilities,
                        Charges      = GenerateServiceCharges(booking.Currency),
                        Info         = new ServiceInfo
                        {
                            Code     = "SXL",
                            Name     = "Extra large seat",
                            Category = "PremiumSeat",
                            Type     = ServiceType.Seat
                        }
                    });
                }

                serviceAvailabilities = GenerateServiceAvailabilities(journeys, ProductScopeType.PerPaxSegment);
                if (serviceAvailabilities.Any())
                {
                    services.Add(new Service
                    {
                        SellType     = ProductScopeType.PerPaxSegment,
                        Availability = serviceAvailabilities,
                        Charges      = GenerateServiceCharges(booking.Currency),
                        Info         = new ServiceInfo
                        {
                            Code     = "ST+",
                            Name     = "Premium plus seat",
                            Category = "Seat",
                            Type     = ServiceType.Seat
                        }
                    });
                }
                break;

            case ServiceType.Insurance:
                serviceAvailabilities = GenerateServiceAvailabilities(journeys, ProductScopeType.PerBooking);
                if (serviceAvailabilities.Any())
                {
                    services.Add(new Service
                    {
                        SellType     = ProductScopeType.PerBooking,
                        Availability = serviceAvailabilities,
                        Charges      = GenerateServiceCharges(booking.Currency),
                        Info         = new ServiceInfo
                        {
                            Code     = "INS",
                            Name     = "Flight Insurance",
                            Category = "Insurance",
                            Type     = ServiceType.Insurance
                        }
                    });
                }
                break;

            case ServiceType.Priority:
                serviceAvailabilities = GenerateServiceAvailabilities(journeys, ProductScopeType.PerPaxSegment);
                if (serviceAvailabilities.Any())
                {
                    services.Add(new Service
                    {
                        SellType     = ProductScopeType.PerPaxSegment,
                        Availability = serviceAvailabilities,
                        Charges      = GenerateServiceCharges(booking.Currency),
                        Info         = new ServiceInfo
                        {
                            Code     = "XCKI",
                            Name     = "Express check-in",
                            Category = "Check-in",
                            Type     = ServiceType.Priority
                        }
                    });
                }
                break;

            case ServiceType.SpecialAssistance:
                serviceAvailabilities = GenerateServiceAvailabilities(journeys, ProductScopeType.PerPaxSegment);
                if (serviceAvailabilities.Any())
                {
                    services.Add(new Service
                    {
                        SellType     = ProductScopeType.PerPaxSegment,
                        Availability = serviceAvailabilities,
                        Charges      = GenerateServiceCharges(booking.Currency),
                        Info         = new ServiceInfo
                        {
                            Code     = "WCHC",
                            Name     = "Wheel chair",
                            Category = "Meet and assist",
                            Type     = ServiceType.SpecialAssistance
                        }
                    });
                }
                break;

            case ServiceType.DutyFree:
                serviceAvailabilities = GenerateServiceAvailabilities(journeys, ProductScopeType.PerPaxSegment);
                if (serviceAvailabilities.Any())
                {
                    services.Add(new Service
                    {
                        SellType     = ProductScopeType.PerPaxSegment,
                        Availability = serviceAvailabilities,
                        Charges      = GenerateServiceCharges(booking.Currency),
                        Info         = new ServiceInfo
                        {
                            Code     = "DE01",
                            Name     = "Perfume",
                            Category = "DutyFree",
                            Type     = ServiceType.DutyFree
                        }
                    });
                }

                serviceAvailabilities = GenerateServiceAvailabilities(journeys, ProductScopeType.PerPaxSegment);
                if (serviceAvailabilities.Any())
                {
                    services.Add(new Service
                    {
                        SellType     = ProductScopeType.PerPaxSegment,
                        Availability = serviceAvailabilities,
                        Charges      = GenerateServiceCharges(booking.Currency),
                        Info         = new ServiceInfo
                        {
                            Code     = "DE02",
                            Name     = "Chocolate",
                            Category = "DutyFree",
                            Type     = ServiceType.DutyFree
                        }
                    });
                }
                break;

            case ServiceType.Bundle:
                serviceAvailabilities = GenerateServiceAvailabilities(journeys, ProductScopeType.PerPaxSegment);
                if (serviceAvailabilities.Any())
                {
                    services.Add(new Service
                    {
                        SellType     = ProductScopeType.PerPaxSegment,
                        Availability = serviceAvailabilities,
                        Charges      = GenerateServiceCharges(booking.Currency),
                        Info         = new ServiceInfo
                        {
                            Code     = "SUT+",
                            Name     = "Turista Plus",
                            Category = "Bundle",
                            Type     = ServiceType.Bundle
                        }
                    });
                }
                break;

            default:
                break;
            }

            return(services);
        }