From 77f3c3b2b529da2f301d84d5268e9657ced58653 Mon Sep 17 00:00:00 2001 From: Pritish Budhiraja Date: Thu, 5 Dec 2024 17:19:04 +0530 Subject: [PATCH] Revert "fix: re render issue of card nickname" (#824) --- src/Hooks/UtilityHooks.res | 11 ++++++++--- src/Payments/CardPayment.res | 5 +++-- 2 files changed, 11 insertions(+), 5 deletions(-) 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,