diff --git a/src/Hooks/UtilityHooks.res b/src/Hooks/UtilityHooks.res index 512fe8ad..ec1e2867 100644 --- a/src/Hooks/UtilityHooks.res +++ b/src/Hooks/UtilityHooks.res @@ -22,19 +22,24 @@ let useHandlePostMessages = (~complete, ~empty, ~paymentType, ~savedMethod=false } let useIsCustomerAcceptanceRequired = ( - ~options: PaymentType.options, + ~displaySavedPaymentMethodsCheckbox, ~isSaveCardsChecked, ~isGuestCustomer, ) => { let paymentMethodListValue = Recoil.useRecoilValueFromAtom(PaymentUtils.paymentMethodListValue) React.useMemo(() => { - if options.displaySavedPaymentMethodsCheckbox { + if displaySavedPaymentMethodsCheckbox { isSaveCardsChecked || paymentMethodListValue.payment_type === SETUP_MANDATE } else { !(isGuestCustomer || paymentMethodListValue.payment_type === NORMAL) } - }, (isSaveCardsChecked, paymentMethodListValue.payment_type, isGuestCustomer, options)) + }, ( + isSaveCardsChecked, + paymentMethodListValue.payment_type, + isGuestCustomer, + displaySavedPaymentMethodsCheckbox, + )) } let useSendEventsToParent = eventsToSendToParent => { diff --git a/src/Payments/CardPayment.res b/src/Payments/CardPayment.res index ef619351..2758da9e 100644 --- a/src/Payments/CardPayment.res +++ b/src/Payments/CardPayment.res @@ -62,6 +62,7 @@ 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) @@ -119,7 +120,7 @@ let make = ( ) let isCustomerAcceptanceRequired = useIsCustomerAcceptanceRequired( - ~options, + ~displaySavedPaymentMethodsCheckbox, ~isSaveCardsChecked, ~isGuestCustomer, ) @@ -351,7 +352,7 @@ let make = ( CardUtils.getCardType} /> - + {switch ( paymentMethodListValue.mandate_payment, options.terms.card,