fix: send totalPrice to create booking

This commit is contained in:
Christel Westerberg
2024-11-06 14:09:18 +01:00
parent f4f771ec70
commit 560fb25aee
6 changed files with 23 additions and 24 deletions

View File

@@ -31,6 +31,7 @@ import { toast } from "@/components/TempDesignSystem/Toasts"
import { useHandleBookingStatus } from "@/hooks/booking/useHandleBookingStatus"
import useLang from "@/hooks/useLang"
import { bedTypeMap } from "../../SelectRate/RoomSelection/utils"
import GuaranteeDetails from "./GuaranteeDetails"
import PaymentOption from "./PaymentOption"
import { PaymentFormData, paymentSchema } from "./schema"
@@ -49,7 +50,7 @@ function isPaymentMethodEnum(value: string): value is PaymentMethodEnum {
}
export default function Payment({
hotelId,
roomPrice,
otherPaymentOptions,
savedCreditCards,
mustBeGuaranteed,
@@ -143,16 +144,19 @@ export default function Payment({
}
initiateBooking.mutate({
hotelId: hotelId,
hotelId: hotel,
checkInDate: fromDate,
checkOutDate: toDate,
rooms: rooms.map((room) => ({
adults: room.adults,
children: room.children,
childrenAges: room.children?.map((child) => ({
age: child.age,
bedType: bedTypeMap[parseInt(child.bed.toString())],
})),
rateCode: room.rateCode,
roomTypeCode: bedType!.roomTypeCode,
roomTypeCode: bedType!.roomTypeCode, // A selection has been made in order to get to this step.
guest: {
title: "", // TODO: do we need title?
title: "",
firstName,
lastName,
email,
@@ -170,6 +174,7 @@ export default function Payment({
room.packages?.includes(RoomPackageCodeEnum.ALLERGY_ROOM) ?? false,
},
smsConfirmationRequested: data.smsConfirmation,
roomPrice,
})),
payment: {
paymentMethod,