Files
web/packages/booking-flow/lib/components/EnterDetails/Payment/utils.ts
2025-11-24 07:24:52 +00:00

42 lines
1.1 KiB
TypeScript

import type { IntlShape } from "react-intl"
export function getPaymentHeadingConfig(
intl: IntlShape,
bookingMustBeGuaranteed: boolean,
hasOnlyFlexRates: boolean
) {
if (hasOnlyFlexRates) {
return bookingMustBeGuaranteed
? {
heading: intl.formatMessage({
id: "enterDetails.payment.guaranteePaymentHeading",
defaultMessage: "Guarantee with card",
}),
subHeading: intl.formatMessage({
id: "enterDetails.payment.guaranteePaymentSubheading",
defaultMessage: "(your card won't be charged now)",
}),
showLearnMore: true,
}
: {
heading: intl.formatMessage({
id: "enterDetails.payment.onlyFlexRatesTitle",
defaultMessage: "Final step",
}),
showLearnMore: false,
}
}
return {
preHeading: intl.formatMessage({
id: "enterDetails.payment.label",
defaultMessage: "Payment",
}),
heading: intl.formatMessage({
id: "enterDetails.payment.title",
defaultMessage: "Select payment method",
}),
showLearnMore: false,
}
}