Coder Social home page Coder Social logo

amadeus4dev-examples / amadeus-flight-booking-node Goto Github PK

View Code? Open in Web Editor NEW
15.0 15.0 25.0 2.07 MB

Node.js and Vue application demonstrating the Amadeus Self-Service flight booking APIs

Home Page: https://developers.amadeus.com

License: MIT License

Dockerfile 0.26% JavaScript 8.82% HTML 18.28% Vue 39.01% SCSS 33.63%
amadeus apis booking demo example hacktoberfest nodejs prototype travel vuejs

amadeus-flight-booking-node's People

Contributors

anthonyroux avatar dependabot[bot] avatar ipgpt avatar tsolakoua avatar tvast avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

amadeus-flight-booking-node's Issues

Autocomplete doesn't work

The API uses the Airport & City Search API in order to autocomplete the departure and destination fields. The normal behavior would be while the user types a keyword, to matching cities and airports.

Instead, there are no suggestions return and below is the error in the console every time a letter is typed in both departure and arrival fields:

Screenshot 2021-09-15 at 17 55 06

Flight search not working

When we do a flight search, the app breaks. It looks like the input from the frontend doesn't pass correctly in the backend.

For example this is the input in the frontend we can see in the console:
Screenshot 2021-09-15 at 18 16 53

However, when we call the Flight Offers Search API it looks like the dates taken are the default ones from the calendar (check #31).

Apart from that, even though in the frontend we define a return date, returnDate is not existing at all in the API call.

ClientError {
  response: Response {
    contentType: 'application/vnd.amadeus+json',
    statusCode: 400,
    request: Request {
      host: 'test.api.amadeus.com',
      port: 443,
      ssl: true,
      scheme: 'https',
      verb: 'GET',
      path: '/v2/shopping/flight-offers',
      params: [Object],
      queryPath: '/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=ATH&departureDate=2020-05-01&adults=1',
      bearerToken: '',
      clientVersion: '4.0.0',
      languageVersion: '13.8.0',
      appId: null,
      appVersion: null,
      headers: [Object]
    },
    body: '{"errors":[{"status":400,"code":425,"title":"INVALID DATE","detail":"Date/Time is in the past","source":{}}]}',
    result: { errors: [Array] },
    data: undefined,
    parsed: true
  },
  description: [
    {
      status: 400,
      code: 425,
      title: 'INVALID DATE',
      detail: 'Date/Time is in the past',
      source: {}
    }
  ],
  code: 'ClientError'
}

Calendar shows dates in the past instead of current date

Once you run the app and you go to search for flight, the calendar instead of opening in the current date, it shows May of 2020 for departure and February 2020 for return date.

Departure date calendar
Screenshot 2021-09-15 at 17 31 58

Return date calendar
Screenshot 2021-09-15 at 17 32 52

The normal behavior would be the calendar to show the current date.

Remove 2nd traveler from booking

After searching a flight in each flight we click we receive the following:
Screenshot 2021-10-14 at 09 37 09

I think the issue is because we pass 2 travelers when we do the booking, but when we search for flights offers we search for 1 traveler. So we receive one flight offers from flight search, where we try to book it for two travelers.

The solution would be to remove the 2nd traveler from the static

Below are the logs:

ClientError {
  response: Response {
    contentType: 'application/vnd.amadeus+json',
    statusCode: 400,
    request: Request {
      host: 'test.api.amadeus.com',
      port: 443,
      ssl: true,
      scheme: 'https',
      verb: 'POST',
      path: '/v1/booking/flight-orders',
      params: '{"data":{"type":"flight-order","flightOffers":[{"type":"flight-offer","id":"17","source":"GDS","instantTicketingRequired":false,"nonHomogeneous":false,"oneWay":false,"lastTicketingDate":"2021-10-14","numberOfBookableSeats":4,"itineraries":[{"duration":"PT18H55M","segments":[{"departure":{"iataCode":"MAD","terminal":"4","at":"2021-10-14T15:30:00"},"arrival":{"iataCode":"BCN","terminal":"1","at":"2021-10-14T16:50:00"},"carrierCode":"IB","number":"5255","aircraft":{"code":"320"},"operating":{"carrierCode":"VY"},"duration":"PT1H20M","id":"116","numberOfStops":0,"blacklistedInEU":false},{"departure":{"iataCode":"BCN","terminal":"1","at":"2021-10-15T07:30:00"},"arrival":{"iataCode":"ATH","terminal":"M","at":"2021-10-15T11:25:00"},"carrierCode":"IB","number":"5675","aircraft":{"code":"321"},"operating":{"carrierCode":"VY"},"duration":"PT2H55M","id":"117","numberOfStops":0,"blacklistedInEU":false}]}],"price":{"currency":"EUR","total":"149.81","base":"111.00","fees":[{"amount":"0.00","type":"SUPPLIER"},{"amount":"0.00","type":"TICKETING"}],"grandTotal":"149.81"},"pricingOptions":{"fareType":["PUBLISHED"],"includedCheckedBagsOnly":true},"validatingAirlineCodes":["IB"],"travelerPricings":[{"travelerId":"1","fareOption":"STANDARD","travelerType":"ADULT","price":{"currency":"EUR","total":"149.81","base":"111.00"},"fareDetailsBySegment":[{"segmentId":"116","cabin":"ECONOMY","fareBasis":"NWYNVY","class":"N","includedCheckedBags":{"quantity":1}},{"segmentId":"117","cabin":"ECONOMY","fareBasis":"NWYNVY","class":"N","includedCheckedBags":{"quantity":1}}]}]}],"travelers":[{"id":"1","dateOfBirth":"1982-01-16","name":{"firstName":"JORGE","lastName":"GONZALES"},"gender":"MALE","contact":{"emailAddress":"[email protected]","phones":[{"deviceType":"MOBILE","countryCallingCode":"34","number":"480080076"}]},"documents":[{"documentType":"PASSPORT","birthPlace":"Madrid","issuanceLocation":"Madrid","issuanceDate":"2015-04-14","number":"00000000","expiryDate":"2025-04-14","issuanceCountry":"ES","validityCountry":"ES","nationality":"ES","holder":true}]},{"id":"2","dateOfBirth":"2012-10-11","gender":"FEMALE","contact":{"emailAddress":"[email protected]","phones":[{"deviceType":"MOBILE","countryCallingCode":"34","number":"480080076"}]},"name":{"firstName":"ADRIANA","lastName":"GONZALES"}}]}}',
      queryPath: '/v1/booking/flight-orders',
      clientVersion: '4.0.0',
      languageVersion: '13.8.0',
      appId: null,
      appVersion: null,
      headers: [Object]
    },
    body: '{"errors":[{"status":400,"code":4926,"title":"INVALID DATA RECEIVED","detail":"This traveler is not priced in some flightOffers","source":{"pointer":"/data/travelers[1]"}}]}',
    result: { errors: [Array] },
    data: undefined,
    parsed: true
  },
  description: [
    {
      status: 400,
      code: 4926,
      title: 'INVALID DATA RECEIVED',
      detail: 'This traveler is not priced in some flightOffers',
      source: [Object]
    }
  ],
  code: 'ClientError'
}

Code cleanup

  • The codebase contains some code commented and not used
  • Some files are not properly formated

Where's part 2?

Both articles link to Part 1.. and it's a rather short, rather incomplete tutorial.. would love to see part 2.

Also is this sample app fully functional at this point? I'd like to check it out and possibly develop something using your APIs

Cheers

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.