From ab53eaf5b32c7830f0b830dda25cdf4b386fbf53 Mon Sep 17 00:00:00 2001 From: Pritish Budhiraja <1805317@kiit.ac.in> Date: Tue, 12 Mar 2024 20:03:05 +0530 Subject: [PATCH] fix: displaySavedPaymentMethods prop --- src/PaymentElement.res | 16 ++++++++++++---- src/Payments/CardPayment.res | 5 ++++- src/orca-loader/Elements.res | 4 +--- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/PaymentElement.res b/src/PaymentElement.res index e61570840..0f5a01b56 100644 --- a/src/PaymentElement.res +++ b/src/PaymentElement.res @@ -21,6 +21,7 @@ let make = ( paymentMethodOrder, layout, customerPaymentMethods, + displaySavedPaymentMethods, displaySavedPaymentMethodsCheckbox, } = Recoil.useRecoilValueFromAtom(optionAtom) let isApplePayReady = Recoil.useRecoilValueFromAtom(isApplePayReady) @@ -369,13 +370,20 @@ let make = ( } - let paymentLabel = showFields - ? localeString.selectPaymentMethodLabel - : localeString.savedPaymentMethodsLabel + React.useEffect0(() => { + setShowFields(._ => !displaySavedPaymentMethods) + None + }) + + let paymentLabel = if displaySavedPaymentMethods { + showFields ? localeString.selectPaymentMethodLabel : localeString.savedPaymentMethodsLabel + } else { + localeString.selectPaymentMethodLabel + } <>
{React.string(paymentLabel)}
- + diff --git a/src/Payments/CardPayment.res b/src/Payments/CardPayment.res index 3d7c08669..30d71d577 100644 --- a/src/Payments/CardPayment.res +++ b/src/Payments/CardPayment.res @@ -271,7 +271,10 @@ let make = ( - Js.Array2.length > 0 && !isBancontact}> + Js.Array2.length > 0 && + !isBancontact}>
ignore fetchPaymentsList(mountedIframeRef) - if displaySavedPaymentMethods { - fetchCustomerDetails(mountedIframeRef) - } + fetchCustomerDetails(mountedIframeRef) mountedIframeRef->Window.iframePostMessage(message) }