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 = {
|
export const bookingFlowConfig: BookingFlowConfig = {
|
||||||
bookingCodeEnabled: false,
|
bookingCodeEnabled: false,
|
||||||
|
savedCreditCardsEnabled: false,
|
||||||
redemptionEnabled: env.REDEMPTION_ENABLED === true,
|
redemptionEnabled: env.REDEMPTION_ENABLED === true,
|
||||||
enterDetailsMembershipIdInputLocation: "join-card",
|
enterDetailsMembershipIdInputLocation: "join-card",
|
||||||
variant: "partner-sas",
|
variant: "partner-sas",
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import type { BookingFlowConfig } from "@scandic-hotels/booking-flow/BookingFlow
|
|||||||
export const bookingFlowConfig: BookingFlowConfig = {
|
export const bookingFlowConfig: BookingFlowConfig = {
|
||||||
bookingCodeEnabled: true,
|
bookingCodeEnabled: true,
|
||||||
redemptionEnabled: true,
|
redemptionEnabled: true,
|
||||||
|
savedCreditCardsEnabled: true,
|
||||||
enterDetailsMembershipIdInputLocation: "form",
|
enterDetailsMembershipIdInputLocation: "form",
|
||||||
variant: "scandic",
|
variant: "scandic",
|
||||||
routes: {
|
routes: {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import type { BookingFlowVariant } from "./bookingFlowVariants"
|
|||||||
export type BookingFlowConfig = {
|
export type BookingFlowConfig = {
|
||||||
bookingCodeEnabled: boolean
|
bookingCodeEnabled: boolean
|
||||||
redemptionEnabled: boolean
|
redemptionEnabled: boolean
|
||||||
|
savedCreditCardsEnabled: boolean
|
||||||
enterDetailsMembershipIdInputLocation: "form" | "join-card"
|
enterDetailsMembershipIdInputLocation: "form" | "join-card"
|
||||||
variant: BookingFlowVariant
|
variant: BookingFlowVariant
|
||||||
routes: {
|
routes: {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { cache } from "react"
|
import { cache } from "react"
|
||||||
|
|
||||||
|
import { getBookingFlowConfig } from "../../bookingFlowConfig/bookingFlowConfig"
|
||||||
import { serverClient } from "../../trpc"
|
import { serverClient } from "../../trpc"
|
||||||
|
|
||||||
import type { GetSavedPaymentCardsInput } from "@scandic-hotels/trpc/routers/user/input"
|
import type { GetSavedPaymentCardsInput } from "@scandic-hotels/trpc/routers/user/input"
|
||||||
@@ -8,6 +9,11 @@ export const getSavedPaymentCardsSafely = cache(
|
|||||||
async function getMemoizedSavedPaymentCardsSafely(
|
async function getMemoizedSavedPaymentCardsSafely(
|
||||||
input: GetSavedPaymentCardsInput
|
input: GetSavedPaymentCardsInput
|
||||||
) {
|
) {
|
||||||
|
const config = getBookingFlowConfig()
|
||||||
|
if (!config.savedCreditCardsEnabled) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
const caller = await serverClient()
|
const caller = await serverClient()
|
||||||
return caller.user.safePaymentCards(input)
|
return caller.user.safePaymentCards(input)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user