From 1ca48c011f8491e4b161e478f6db0d115469956c Mon Sep 17 00:00:00 2001 From: minjikarin Date: Mon, 17 Jun 2024 13:07:31 +0200 Subject: [PATCH] passed the test and readme updated --- README.md | 11 ++++++++++- spec/amadeus/namespaces.test.js | 12 +++++++++++- src/amadeus/namespaces/booking/hotel_orders.js | 3 ++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 58e98b4..ca0112c 100644 --- a/README.md +++ b/README.md @@ -405,7 +405,16 @@ amadeus.shopping.hotelOffersSearch.get({ // Check offer conditions of a specific offer id amadeus.shopping.hotelOfferSearch('XXX').get() -// Hotel Booking API +// Hotel Booking API V2 +amadeus.booking.hotelOrders.post({ + guests: [], + travelAgent: {}, + roomAssociations: [], + payment: {} +}) + + +// Hotel Booking API V1 amadeus.booking.hotelBookings.post( JSON.stringify({ 'offerId': 'XXX', diff --git a/spec/amadeus/namespaces.test.js b/spec/amadeus/namespaces.test.js index c328551..9860229 100644 --- a/spec/amadeus/namespaces.test.js +++ b/spec/amadeus/namespaces.test.js @@ -156,6 +156,7 @@ describe('Namespaces', () => { expect(amadeus.shopping.flightOffers.pricing.post).toBeDefined(); expect(amadeus.shopping.seatmaps.post).toBeDefined(); expect(amadeus.booking.hotelBookings.post).toBeDefined(); + expect(amadeus.booking.hotelOrders.post).toBeDefined(); expect(amadeus.shopping.transferOffers.post).toBeDefined(); expect(amadeus.ordering.transferOrders.post).toBeDefined(); expect(amadeus.ordering.transferOrder('XXX').transfers.cancellation.post).toBeDefined(); @@ -451,7 +452,16 @@ describe('Namespaces', () => { amadeus.client.post = jest.fn(); amadeus.booking.hotelOrders.post(); expect(amadeus.client.post) - .toHaveBeenCalledWith('/v2/booking/hotel-orders', {}); + .toHaveBeenCalledWith('/v2/booking/hotel-orders', JSON.stringify({ + data: { + type: 'hotel-order', + guests: [], + travelAgent: {}, + roomAssociations: [], + payment: {}, + arrivalInformation: {} + } + })); }); it('.amadeus.eReputation.hotelSentiments.get', () => { diff --git a/src/amadeus/namespaces/booking/hotel_orders.js b/src/amadeus/namespaces/booking/hotel_orders.js index 8807c04..aa5f5a9 100644 --- a/src/amadeus/namespaces/booking/hotel_orders.js +++ b/src/amadeus/namespaces/booking/hotel_orders.js @@ -29,7 +29,8 @@ class HotelOrders { * 'guests': [], * 'travel_agent: {}, * 'room_associations: [], - * 'payment': {} + * 'payment': {}, + * 'arrivalInformation': {} * }); * ``` */