Fix: Added optional merchantInformationData

This commit is contained in:
Pontus Dreij
2024-12-13 14:03:13 +01:00
parent 78bf7ef387
commit eb2a0a4cb9
4 changed files with 12 additions and 12 deletions

View File

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

View File

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