Booking Form

<<Back to Main Menu

Description:
Processes the Select Flight Form and displays a Booking Form for the user to enter the booking information.

Accessible by:
All users

Accessed from:
Select Flight Form
Login or Registration (if user was forced to login while trying to book a flight)

Input parameters:
Return/Single
Outgoing Flight Number
Return Flight Number
Adult Passengers
Class
Child Passengers

Output
Booking Form if search is processed successfully.
Login Form if user isn't logged in.
Select Flight Form if there are errors in the form.

Pseudo Code:
get/create session
if ('username' param exists in the session) {
   validate form
   if (form params are in the correct format) {
      if ('Outgoing Flight Number' is in a format reflecting a combination of flights) {
         divide it into its constituent parts
         for each constituent part {
            check if sufficient seats are available on each flight
            get the price of the tickets
         }
      }
      else {
         check if sufficient seats are available on the flight
         get the price of the tickets
      }

      if ('Return/Single' == 'Return') {
         if ('Outgoing Flight Number' is in a format reflecting a combination of flights) {
            divide it into its constituent parts
            for each constituent part {
               check if sufficient seats are available on each flight
               get the price of the tickets
            }
         }
         else {
            check if sufficient seats are available on the flight
            get the price of the tickets
         }
      }
      for each adult passenger {
         display a text input for the passenger's name
      }
      for each child passenger {
         display a text input for the passenger's name
      }
      get user's loyalty points from the database
      calculate total cost of the flights taking loyalty points into account

      get user's credit/debit card details
      if (user has cards saved in the database) {
         display details of each card with a radio button beside each
      }
      display input fields to add new card
      display the total cost of the booking
      add the booking details to the session, as a 'Booking' parameter, including total booking price and number of loyalty points used.

   }
   else {
      display Select Flight Form with error message
   }

}
else {
   add the booking details to the session, as a 'Booking' parameter
   display Login Form
}