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:
@@ -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