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:
@@ -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",
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user