Skip to content

Commit

Permalink
Revert "fix: re render issue of card nickname (#823)"
Browse files Browse the repository at this point in the history
This reverts commit a4691b0.
  • Loading branch information
PritishBudhiraja authored Dec 5, 2024
1 parent 1054e7c commit 9e880ed
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
11 changes: 8 additions & 3 deletions src/Hooks/UtilityHooks.res
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
5 changes: 3 additions & 2 deletions src/Payments/CardPayment.res
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -119,7 +120,7 @@ let make = (
)

let isCustomerAcceptanceRequired = useIsCustomerAcceptanceRequired(
~options,
~displaySavedPaymentMethodsCheckbox,
~isSaveCardsChecked,
~isGuestCustomer,
)
Expand Down Expand Up @@ -351,7 +352,7 @@ let make = (
<RenderIf condition={showFields || isBancontact}>
<Surcharge paymentMethod paymentMethodType cardBrand={cardBrand->CardUtils.getCardType} />
</RenderIf>
<RenderIf condition={options.displaySavedPaymentMethodsCheckbox && !isBancontact}>
<RenderIf condition={displaySavedPaymentMethodsCheckbox && !isBancontact}>
{switch (
paymentMethodListValue.mandate_payment,
options.terms.card,
Expand Down

0 comments on commit 9e880ed

Please sign in to comment.