Skip to content

Commit

Permalink
Merge pull request #201 from amadeus4dev/pricing-update
Browse files Browse the repository at this point in the history
support additional parameter for flight offers price api
  • Loading branch information
tsolakoua authored Dec 8, 2023
2 parents 3ec7a96 + 0e6b43b commit 05794ac
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* ```js
* let amadeus = new Amadeus();
* amadeus.ordering.transferOrder('XXX').transfers.cancellation.post(JSON.stringify({}), 12345);;
* amadeus.ordering.transferOrder('XXX').transfers.cancellation.post(JSON.stringify({}), '12345');;
* ```
*
* @param {Client} client
Expand All @@ -24,7 +24,7 @@ class Cancellation {
* To cancel a transfer order with ID 'XXX' and confirmation number '12345'
*
* ```js
* amadeus.ordering.transferOrder('XXX').transfers.cancellation.post(JSON.stringify({}), 12345);;
* amadeus.ordering.transferOrder('XXX').transfers.cancellation.post(JSON.stringify({}), '12345');;
* ```
*/
post(body, confirmNbr) {
Expand Down
13 changes: 11 additions & 2 deletions src/amadeus/namespaces/shopping/flight_offers/pricing.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,17 @@ class Pricing {
* });
* ```
*/
post(params = {}) {
return this.client.post('/v1/shopping/flight-offers/pricing', params);
post(params = {}, additionalParams = {}) {
// Convert additionalParams object to query string
const queryString = Object.keys(additionalParams).map(key => key + '=' + additionalParams[key]).join('&');

// Check if queryString is empty before appending it to the URL
let url = '/v1/shopping/flight-offers/pricing';
if (queryString !== '') {
url += '?' + queryString;
}

return this.client.post(url, params);
}
}

Expand Down

0 comments on commit 05794ac

Please sign in to comment.