public ActionResult <TicketDetailsDTO> PurchaseTicket([FromBody] long flight_id)
        {
            LoginToken <Customer> customer_token = DesirializeToken();
            Ticket ticket = null;
            string uri    = null;

            Flight flight = _loggedInCustomerFacade.GetFlightById(flight_id);

            if (flight == null)
            {
                return(NotFound());
            }

            if (flight.RemainingTickets < 1 || flight.DepartureTime <= DateTime.Now.AddMinutes(15))
            {
                return(StatusCode(StatusCodes.Status410Gone));
            }

            try
            {
                ticket = _loggedInCustomerFacade.PurchaseTicket(customer_token, flight);

                uri = _linkGenerator.GetPathByAction(nameof(GetTicketById), "customerfacade", new { id = ticket.Id });
            }
            catch (RecordAlreadyExistsException)
            {
                return(Conflict());
            }
            catch (TicketPurchaseFailedException)
            {
                return(StatusCode(StatusCodes.Status410Gone));
            }

            TicketDetailsDTO ticketDetailsDTO = _mapper.Map <TicketDetailsDTO>(ticket);

            return(Created(uri, ticket));
        }