diff --git a/app/[lang]/(live)/(public)/hotelreservation/(standard)/step/page.tsx b/app/[lang]/(live)/(public)/hotelreservation/(standard)/step/page.tsx index 82feef50c..63ec174a5 100644 --- a/app/[lang]/(live)/(public)/hotelreservation/(standard)/step/page.tsx +++ b/app/[lang]/(live)/(public)/hotelreservation/(standard)/step/page.tsx @@ -216,10 +216,11 @@ export default async function StepPage({ roomPrice={roomPrice} otherPaymentOptions={ hotelData.data.attributes.merchantInformationData - .alternatePaymentOptions + ?.alternatePaymentOptions ?? [] } supportedCards={ - hotelData.data.attributes.merchantInformationData.cards + hotelData.data.attributes.merchantInformationData + ?.cards ?? [] } mustBeGuaranteed={mustBeGuaranteed} /> diff --git a/server/routers/hotels/output.ts b/server/routers/hotels/output.ts index 937506b5d..aba2ecbb1 100644 --- a/server/routers/hotels/output.ts +++ b/server/routers/hotels/output.ts @@ -470,11 +470,7 @@ export const hotelAttributesSchema = z.object({ isPublished: z.boolean(), keywords: z.array(z.string()), location: locationSchema, - merchantInformationData: merchantInformationSchema.default({ - webMerchantId: "", - cards: {}, - alternatePaymentOptions: {}, - }), + merchantInformationData: merchantInformationSchema.optional(), name: z.string(), operaId: z.string(), parking: z.array(parkingSchema), diff --git a/server/routers/hotels/query.ts b/server/routers/hotels/query.ts index 4b40ecc33..155426bc9 100644 --- a/server/routers/hotels/query.ts +++ b/server/routers/hotels/query.ts @@ -193,8 +193,12 @@ export const getHotelData = cache( const hotelData = validateHotelData.data if (isCardOnlyPayment) { - hotelData.data.attributes.merchantInformationData.alternatePaymentOptions = - [] + const currentData = hotelData.data.attributes.merchantInformationData + hotelData.data.attributes.merchantInformationData = { + webMerchantId: currentData?.webMerchantId ?? "", + cards: currentData?.cards ?? [], + alternatePaymentOptions: [], + } } if (hotelData.data.attributes.gallery) { const smallerImages = hotelData.data.attributes.gallery.smallerImages diff --git a/types/components/hotelReservation/selectRate/section.ts b/types/components/hotelReservation/selectRate/section.ts index 15f50da7c..164222a88 100644 --- a/types/components/hotelReservation/selectRate/section.ts +++ b/types/components/hotelReservation/selectRate/section.ts @@ -1,6 +1,5 @@ -import { PaymentMethodEnum } from "@/constants/booking" - -import { CreditCard, SafeUser } from "@/types/user" +import type { CreditCard, SafeUser } from "@/types/user" +import type { PaymentMethodEnum } from "@/constants/booking" export interface SectionProps { nextPath: string