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