Skip to content

Commit 05794ac

Browse files
authored
Merge pull request #201 from amadeus4dev/pricing-update
support additional parameter for flight offers price api
2 parents 3ec7a96 + 0e6b43b commit 05794ac

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/amadeus/namespaces/ordering/transfer_orders/transfers/cancellation.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* ```js
88
* let amadeus = new Amadeus();
9-
* amadeus.ordering.transferOrder('XXX').transfers.cancellation.post(JSON.stringify({}), 12345);;
9+
* amadeus.ordering.transferOrder('XXX').transfers.cancellation.post(JSON.stringify({}), '12345');;
1010
* ```
1111
*
1212
* @param {Client} client
@@ -24,7 +24,7 @@ class Cancellation {
2424
* To cancel a transfer order with ID 'XXX' and confirmation number '12345'
2525
*
2626
* ```js
27-
* amadeus.ordering.transferOrder('XXX').transfers.cancellation.post(JSON.stringify({}), 12345);;
27+
* amadeus.ordering.transferOrder('XXX').transfers.cancellation.post(JSON.stringify({}), '12345');;
2828
* ```
2929
*/
3030
post(body, confirmNbr) {

src/amadeus/namespaces/shopping/flight_offers/pricing.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,17 @@ class Pricing {
3838
* });
3939
* ```
4040
*/
41-
post(params = {}) {
42-
return this.client.post('/v1/shopping/flight-offers/pricing', params);
41+
post(params = {}, additionalParams = {}) {
42+
// Convert additionalParams object to query string
43+
const queryString = Object.keys(additionalParams).map(key => key + '=' + additionalParams[key]).join('&');
44+
45+
// Check if queryString is empty before appending it to the URL
46+
let url = '/v1/shopping/flight-offers/pricing';
47+
if (queryString !== '') {
48+
url += '?' + queryString;
49+
}
50+
51+
return this.client.post(url, params);
4352
}
4453
}
4554

0 commit comments

Comments
 (0)