liteapi-node-sdk
Advanced tools
Comparing version 3.0.1 to 3.0.2
18
index.js
@@ -46,9 +46,8 @@ class LiteApi { | ||
* | ||
* @param {array} rateId - Rate ids retrieved from rates response. | ||
* @param {boolean} usePaymentSdk - Whether the payment wrapper SDK is going to be used for this transaction. | ||
* @param {array} data - The input parameters for the API | ||
* @returns {object} - The result of the operation. | ||
*/ | ||
async preBook(rateIds, usePaymentSdk) { | ||
async preBook(data) { | ||
let errors = []; | ||
if (!Array.isArray(rateIds) || rateIds.length == 0) { | ||
if (typeof data !== 'object' || !Array.isArray(data.rateIds) || data.rateIds.length == 0) { | ||
errors.push("The rate IDs are required"); | ||
@@ -69,13 +68,10 @@ } | ||
}, | ||
body: JSON.stringify({ | ||
rateIds: rateIds, | ||
usePaymentSdk: usePaymentSdk | ||
}) | ||
body: JSON.stringify(data) | ||
}; | ||
const response = await fetch(this.bookServiceURL + '/rates/prebook', options); | ||
const data = await response.json(); | ||
const result = await response.json(); | ||
if (!response.ok) { | ||
return { | ||
"status": "failed", | ||
"error": data.error | ||
"error": result.error | ||
} | ||
@@ -86,3 +82,3 @@ } | ||
"status": "success", | ||
"data": data.data | ||
"data": result.data | ||
} | ||
@@ -89,0 +85,0 @@ } |
{ | ||
"name": "liteapi-node-sdk", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"description": "Start building travel apps with liteAPI. Instantly access millions of hotels to build new or existing apps and platforms.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -381,4 +381,4 @@ <h1 style="font-weight: 500;">liteAPI SDK</h1> | ||
```js | ||
const rateIds = ["NRYDCZRZHAZHYMRQGIZS2MBXFUYTK7BSGAZDGLJQG4WTCNT4GJ6HYVKTPRDVSWSEJVMVUV2HIUZUOS2OKJKEOWKZKRCU2QSXJVETGRCTJZKEMR2ZGNMFSTKKIRDUSWKEIVGVUUKHGRMVISZXIJJUOQK2IRDU2QSYI5CTGSCZLJGE6TBVJNLEON2DKZFU4NSGJNKTERKQKFNEKQ2NINCFAUK2IRCU6QSUKBJEWVCFKZJVST2KGZCEGTSSLFEEKWKEINHFUV2HKUZVIUKOJJNE6QSELBHVKQSEI5CVURCTJZBFER2BKJKEOTKKJZDUKWSEKNHEEUSHII3EMRKSKNHVAUK2IRAU2USUI5ATGVCDJVJFCR2FLFCECN2CKRIFCWKUJFHEEVCHLFJFMRKULJCEWSSEIU2ESWSTI5AVURCHJRFFCRZUK5KEGTKRPRKVGRD4PR6DCNRWFYYDC7BSGAZDGLJQG4WTCMT4IJHXYMJSHE2DCMD4GI"]; | ||
const result = await liteApi.preBook(rateIds, true) | ||
const offerId = ["abcde123"]; | ||
const result = await liteApi.preBook({ offerId, usePaymentSdk: true, voucherCode: "1234" }); | ||
``` | ||
@@ -389,4 +389,3 @@ * <h4 style="color:#9155fd; font-weight: 800;"> Parameters :</h4> | ||
------------- | ------------- | ------------- | ------------- | ||
**rateIds** | **array** | rate id retrieved from getFullRates response | [required] | ||
**payment** | **boolean** | whether the payment wrapper SDK is going to be used for this transaction | [required] | ||
**data** | **object** | the input parameters for the API request | [required] | ||
@@ -393,0 +392,0 @@ * <h4 style="color:#9155fd; font-weight: 800;"> Return type :</h4> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
135909
619
627