diff --git a/src/Hooks/UtilityHooks.res b/src/Hooks/UtilityHooks.res index ec1e2867..512fe8ad 100644 --- a/src/Hooks/UtilityHooks.res +++ b/src/Hooks/UtilityHooks.res @@ -22,24 +22,19 @@ let useHandlePostMessages = (~complete, ~empty, ~paymentType, ~savedMethod=false } let useIsCustomerAcceptanceRequired = ( - ~displaySavedPaymentMethodsCheckbox, + ~options: PaymentType.options, ~isSaveCardsChecked, ~isGuestCustomer, ) => { let paymentMethodListValue = Recoil.useRecoilValueFromAtom(PaymentUtils.paymentMethodListValue) React.useMemo(() => { - if displaySavedPaymentMethodsCheckbox { + if options.displaySavedPaymentMethodsCheckbox { isSaveCardsChecked || paymentMethodListValue.payment_type === SETUP_MANDATE } else { !(isGuestCustomer || paymentMethodListValue.payment_type === NORMAL) } - }, ( - isSaveCardsChecked, - paymentMethodListValue.payment_type, - isGuestCustomer, - displaySavedPaymentMethodsCheckbox, - )) + }, (isSaveCardsChecked, paymentMethodListValue.payment_type, isGuestCustomer, options)) } let useSendEventsToParent = eventsToSendToParent => { diff --git a/src/Payments/CardPayment.res b/src/Payments/CardPayment.res index 2758da9e..ef619351 100644 --- a/src/Payments/CardPayment.res +++ b/src/Payments/CardPayment.res @@ -62,7 +62,6 @@ let make = ( cvcError, setCvcError, ) = cvcProps - let {displaySavedPaymentMethodsCheckbox} = Recoil.useRecoilValueFromAtom(RecoilAtoms.optionAtom) let intent = PaymentHelpers.usePaymentIntent(Some(loggerState), Card) let showFields = Recoil.useRecoilValueFromAtom(RecoilAtoms.showCardFieldsAtom) let setComplete = Recoil.useSetRecoilState(RecoilAtoms.fieldsComplete) @@ -120,7 +119,7 @@ let make = ( ) let isCustomerAcceptanceRequired = useIsCustomerAcceptanceRequired( - ~displaySavedPaymentMethodsCheckbox, + ~options, ~isSaveCardsChecked, ~isGuestCustomer, ) @@ -352,7 +351,7 @@ let make = ( CardUtils.getCardType} /> - + {switch ( paymentMethodListValue.mandate_payment, options.terms.card,