const request = require('request');
const options = {
method: 'POST',
url: 'https://api.betterez.com/sales/cart',
headers: {
authorization: 'Bearer {{jwtToken}}',
'Content-Type': 'application/json;charset=UTF-8',
Accept: 'application/json, text/plain, */*',
'x-api-key': '{{x-api-key}}'
},
body: {
operationId: 'eb606e6a-1c15-4877-a719-ae1cd4dc7109',
channel: 'backoffice',
ignoreCutoffs: true,
ignoreOmitByAvailability: true,
providerId: '52a377ec430c7d4e220001fc',
items: {
reservation: [
{
channel: 'backoffice',
productId: '52a377ec430c7d4e220001fe',
fromId: '52a378c1430c7d4e2200020c',
from: {
_id: '52a378c1430c7d4e2200020c',
name: 'As (test1)',
province: 'Ontario',
airlines: [],
airlinesSelected: []
},
toId: '52a378c8430c7d4e2200020e',
to: {
_id: '52a378c8430c7d4e2200020e',
name: 'B (testB)',
province: 'Ontario',
airlines: [],
airlinesSelected: []
},
openReturn: false,
selectedTrips: {
departureTripId: 'eyJhY2NvdW50SWQiOiI1MmEzNzdlYzQzMGM3ZDRlMjIwMDAxZmMiLCJwcm9kdWN0SWQiOiI1MmEzNzdlYzQzMGM3ZDRlMjIwMDAxZmUiLCJvcmlnaW5JZCI6IjUyYTM3OGMxNDMwYzdkNGUyMjAwMDIwYyIsImRlc3RpbmF0aW9uSWQiOiI1MmEzNzhjODQzMGM3ZDRlMjIwMDAyMGUiLCJmYXJlSWRzIjoiNTVkMzRhM2FmODY3OTQ3ODFhMDAwMTFjOjEiLCJkZXBhcnR1cmVEYXRlIjoiMjAyMi0xMC0yNiIsImRlcGFydHVyZVRpbWUiOiIwNzowMCIsInRyaXBEaXJlY3Rpb24iOiJvdXRib3VuZCIsImNoYW5uZWwiOiJiYWNrb2ZmaWNlIiwic2VnbWVudHMiOlt7InJvdXRlSWQiOiI1YzkwZjg1NGQ5OWUyN2UyMGQwMDAwMDEiLCJzY2hlZHVsZUlkIjoiM2NjMTQzODktZmQ4Ni00OWU1LWI1MTUtNmM1ZTQxZDY4MTBlIiwib3JpZ2luIjoiQXMgKHRlc3QxKSIsImRlc3RpbmF0aW9uIjoiQiAodGVzdEIpIn1dLCJmYXJlcyI6W3siaWQiOiI1NWQzNGEzYWY4Njc5NDc4MWEwMDAxMWMiLCJ2YWx1ZSI6NDU5MDAwMH1dLCJmYXJlQ2xhc3NlcyI6W10sInRpY2tldFR5cGUiOiJvbmV3YXkifQ',
returnTripId: null
},
roundTrip: false,
dateFrom: '2022-10-26',
dateTo: '',
promo: null,
manualFees: [],
passengers: [
{
firstName: 'test',
lastName: 'test',
email: 'test@example.com',
comments: 'Comment for the passenger',
fare: 'Adult',
fareId: '55d34a3af86794781a00011c',
ssrs: [],
items: [
{
_id: '6262a7d544274d08384179c7',
quantity: 1,
textInformation: '',
selectedMultivalues: []
},
{
_id: '55e47bf2f5e0df601a0000a8',
quantity: 1,
textInformation: '',
selectedMultivalues: []
},
{
_id: '5c53d1a7503bd5fd11000009',
quantity: 1,
textInformation: '',
selectedMultivalues: []
}
],
seats: [],
removedSeats: [],
extraInput: '',
syncEntryId: 'cbc5733d-4995-492f-ad74-9fab4e15e1d7'
}
]
}
]
},
language: 'en'
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});