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:
Matilda Haneling
2025-12-17 07:53:04 +00:00
parent c796f5bb81
commit b8bc94acb3
7 changed files with 69 additions and 32 deletions

View File

@@ -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),
}

View File

@@ -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 & {