Merged in feat/add-config-flag-for-saved-credit-cards (pull request #3151)

feat(SW-3611): Add config flag for saved credit cards

* Add config flag for saved credit cards


Approved-by: Linus Flood
This commit is contained in:
Anton Gunnarsson
2025-11-13 13:20:05 +00:00
parent 0b28893e71
commit 6ed5dd1394
4 changed files with 9 additions and 0 deletions

View File

@@ -12,6 +12,7 @@ import type { LangRoute } from "@scandic-hotels/common/constants/routes/langRout
export const bookingFlowConfig: BookingFlowConfig = {
bookingCodeEnabled: false,
savedCreditCardsEnabled: false,
redemptionEnabled: env.REDEMPTION_ENABLED === true,
enterDetailsMembershipIdInputLocation: "join-card",
variant: "partner-sas",

View File

@@ -9,6 +9,7 @@ import type { BookingFlowConfig } from "@scandic-hotels/booking-flow/BookingFlow
export const bookingFlowConfig: BookingFlowConfig = {
bookingCodeEnabled: true,
redemptionEnabled: true,
savedCreditCardsEnabled: true,
enterDetailsMembershipIdInputLocation: "form",
variant: "scandic",
routes: {

View File

@@ -11,6 +11,7 @@ import type { BookingFlowVariant } from "./bookingFlowVariants"
export type BookingFlowConfig = {
bookingCodeEnabled: boolean
redemptionEnabled: boolean
savedCreditCardsEnabled: boolean
enterDetailsMembershipIdInputLocation: "form" | "join-card"
variant: BookingFlowVariant
routes: {

View File

@@ -1,5 +1,6 @@
import { cache } from "react"
import { getBookingFlowConfig } from "../../bookingFlowConfig/bookingFlowConfig"
import { serverClient } from "../../trpc"
import type { GetSavedPaymentCardsInput } from "@scandic-hotels/trpc/routers/user/input"
@@ -8,6 +9,11 @@ export const getSavedPaymentCardsSafely = cache(
async function getMemoizedSavedPaymentCardsSafely(
input: GetSavedPaymentCardsInput
) {
const config = getBookingFlowConfig()
if (!config.savedCreditCardsEnabled) {
return null
}
const caller = await serverClient()
return caller.user.safePaymentCards(input)
}