feat: translate Voucher everywhere during booking flow
This commit is contained in:
committed by
Simon.Emanuelsson
parent
a0b0ed2544
commit
59f4a27cb1
@@ -167,7 +167,8 @@ export default function RateSummary() {
|
||||
const totalPriceToShow = getTotalPrice(
|
||||
mainRoomProduct,
|
||||
rateSummary,
|
||||
isUserLoggedIn
|
||||
isUserLoggedIn,
|
||||
intl
|
||||
)
|
||||
|
||||
const rateProduct = rateSummary.find((rate) => rate?.product)?.product
|
||||
|
||||
@@ -5,6 +5,7 @@ import { sumPackages } from "@/components/HotelReservation/utils"
|
||||
|
||||
import type { Packages } from "@scandic-hotels/trpc/types/packages"
|
||||
import type { RedemptionProduct } from "@scandic-hotels/trpc/types/roomAvailability"
|
||||
import type { IntlShape } from "react-intl"
|
||||
|
||||
import type { Price } from "@/types/components/hotelReservation/price"
|
||||
import type { Rate } from "@/types/components/hotelReservation/selectRate/selectRate"
|
||||
@@ -218,7 +219,8 @@ export function calculateCorporateChequePrice(selectedRateSummary: Rate[]) {
|
||||
export function getTotalPrice(
|
||||
mainRoomProduct: Rate | null,
|
||||
rateSummary: Array<Rate | null>,
|
||||
isUserLoggedIn: boolean
|
||||
isUserLoggedIn: boolean,
|
||||
intl: IntlShape
|
||||
): Price | null {
|
||||
const summaryArray = rateSummary.filter((rate): rate is Rate => rate !== null)
|
||||
|
||||
@@ -237,7 +239,11 @@ export function getTotalPrice(
|
||||
return calculateRedemptionTotalPrice(product.redemption, packages)
|
||||
}
|
||||
if ("voucher" in product) {
|
||||
return calculateVoucherPrice(summaryArray)
|
||||
const voucherPrice = calculateVoucherPrice(summaryArray)
|
||||
voucherPrice.local.currency = intl.formatMessage({
|
||||
defaultMessage: "Voucher",
|
||||
}) as CurrencyEnum
|
||||
return voucherPrice
|
||||
}
|
||||
|
||||
return calculateTotalPrice(summaryArray, isUserLoggedIn)
|
||||
|
||||
Reference in New Issue
Block a user