Created
August 20, 2020 13:11
-
-
Save Lunberg88/95608061445348b6313c4eedd39b26f8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.post(`${config.bookingApi}/ManageBooking/GetBooking`, booked, { | |
dataTransformer: ({data}) => { | |
console.log('transformer.data.response', data); | |
let customer = { | |
id: 1, | |
...data.bookerProfile, | |
...data.bookerProfile.address, | |
email: data.bookerProfile.email.address, | |
mobilePhone: data.bookerProfile.phone.countryCode.concat(' ', data.bookerProfile.phone.number) | |
}; | |
let checkout = []; | |
let totalPrices = []; | |
data.accommodationBooking.roomConfigurations.forEach((room, i) => { | |
let checkoutItem = { | |
...room, | |
configurationId: i + 1, | |
guests: room.paxes.map((pax) => { | |
return { | |
id: i + 1, | |
...pax, | |
...pax.customer, | |
type: pax.ageGroupTypeID, | |
} | |
}), | |
specialWishes: room.specialRequests | |
}; | |
totalPrices.push(room.totalPrice); | |
checkout.push(checkoutItem); | |
}); | |
return { | |
customer: customer, | |
checkout: checkout, | |
totalPrices: totalPrices, | |
voucher: {id: 1, quantity: 100} | |
}; | |
}, | |
persistBy: 'insertOrUpdate' | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment