Merged in fix/book-607-page-not-found-confirmation-page (pull request #3345)
* fix(BOOK-607): updated to read from base URL env and contentstack slug instead * made url optional on interface * added url to findBooking query * added the correct (new) link in the confirmation header, add to calendar Approved-by: Erik Tiekstra
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
import { toApiLang } from "../../utils"
|
||||
import { encrypt } from "../../utils/encryption"
|
||||
import { isValidSession } from "../../utils/session"
|
||||
import { getHotelPageUrls } from "../contentstack/hotelPage/utils"
|
||||
import { getHotel } from "../hotels/services/getHotel"
|
||||
import { createBookingSchema } from "./mutation/create/schema"
|
||||
import { getHotelRoom } from "./helpers"
|
||||
@@ -62,13 +63,19 @@ export const bookingQueryRouter = router({
|
||||
return null
|
||||
}
|
||||
|
||||
const hotelData = await getHotel(
|
||||
{
|
||||
hotelId: booking.hotelId,
|
||||
isCardOnlyPayment: false,
|
||||
language: lang,
|
||||
},
|
||||
serviceToken
|
||||
const [hotelData, hotelPages] = await Promise.all([
|
||||
getHotel(
|
||||
{
|
||||
hotelId: booking.hotelId,
|
||||
isCardOnlyPayment: false,
|
||||
language: lang,
|
||||
},
|
||||
serviceToken
|
||||
),
|
||||
getHotelPageUrls(lang),
|
||||
])
|
||||
const hotelPage = hotelPages.find(
|
||||
(page) => page.hotelId === booking.hotelId
|
||||
)
|
||||
|
||||
if (!hotelData) {
|
||||
@@ -86,6 +93,7 @@ export const bookingQueryRouter = router({
|
||||
|
||||
return {
|
||||
...hotelData,
|
||||
url: hotelPage?.url || null,
|
||||
booking,
|
||||
room: getHotelRoom(hotelData.roomCategories, booking.roomTypeCode),
|
||||
}
|
||||
@@ -132,13 +140,19 @@ export const bookingQueryRouter = router({
|
||||
return null
|
||||
}
|
||||
|
||||
const hotelData = await getHotel(
|
||||
{
|
||||
hotelId: booking.hotelId,
|
||||
isCardOnlyPayment: false,
|
||||
language: lang,
|
||||
},
|
||||
serviceToken
|
||||
const [hotelData, hotelPages] = await Promise.all([
|
||||
getHotel(
|
||||
{
|
||||
hotelId: booking.hotelId,
|
||||
isCardOnlyPayment: false,
|
||||
language: lang,
|
||||
},
|
||||
serviceToken
|
||||
),
|
||||
getHotelPageUrls(lang),
|
||||
])
|
||||
const hotelPage = hotelPages.find(
|
||||
(page) => page.hotelId === booking.hotelId
|
||||
)
|
||||
|
||||
if (!hotelData) {
|
||||
@@ -156,6 +170,7 @@ export const bookingQueryRouter = router({
|
||||
|
||||
return {
|
||||
...hotelData,
|
||||
url: hotelPage?.url || null,
|
||||
booking,
|
||||
room: getHotelRoom(hotelData.roomCategories, booking.roomTypeCode),
|
||||
}
|
||||
|
||||
@@ -6,12 +6,14 @@ import type {
|
||||
} from "../routers/booking/output"
|
||||
import type { HotelData, Room } from "./hotel"
|
||||
|
||||
export interface BookingConfirmationSchema
|
||||
extends z.output<typeof bookingConfirmationSchema> {}
|
||||
export interface BookingConfirmationSchema extends z.output<
|
||||
typeof bookingConfirmationSchema
|
||||
> {}
|
||||
|
||||
export interface PackageSchema extends z.output<typeof packageSchema> {}
|
||||
|
||||
export interface BookingConfirmation extends HotelData {
|
||||
url: string | null
|
||||
booking: BookingConfirmationSchema
|
||||
room:
|
||||
| (Room & {
|
||||
|
||||
Reference in New Issue
Block a user