Flight reservation systems are some of the most complicated on the planet. They are specifically designed to maximize profit while meeting constraints imposed by airports (such as monthly minimums for seats sold per month to keep their gates). Prices change every few minutes and depend on the utilized capacity of all segments that a route touches. There's a reason most discount sites use the backend operated by Google instead of writing their own.
More than one entire company has grown up around flight search:
https://en.wikipedia.org/wiki/ITA_Software
ITA, in particular, is memorable as a HN favorite because their software was pretty much 100% lisp, at least before the google acquisition.