From ed4b09e32b0178aa7a02cab8dd316fd7805bbe54 Mon Sep 17 00:00:00 2001 From: Vrishab Srivatsa <136090360+vsrivatsa-juspay@users.noreply.github.com> Date: Fri, 17 Nov 2023 14:48:26 +0530 Subject: [PATCH] fix: HS-154: Added loggerState for ApplePay intent and sync (#26) --- src/Payments/ApplePay.res | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Payments/ApplePay.res b/src/Payments/ApplePay.res index ef4a11871..9de0848db 100644 --- a/src/Payments/ApplePay.res +++ b/src/Payments/ApplePay.res @@ -3,10 +3,11 @@ type props = {sessionObj: option, list: PaymentMethodsRecord.list} let default = (props: props) => { let loggerState = Recoil.useRecoilValueFromAtom(RecoilAtoms.loggerAtom) let {publishableKey} = Recoil.useRecoilValueFromAtom(RecoilAtoms.keys) + let setIsShowOrPayUsing = Recoil.useSetRecoilState(RecoilAtoms.isShowOrPayUsing) let (showApplePay, setShowApplePay) = React.useState(() => false) let (showApplePayLoader, setShowApplePayLoader) = React.useState(() => false) - let intent = PaymentHelpers.usePaymentIntent(None, Applepay) - let sync = PaymentHelpers.usePaymentSync(None, Applepay) + let intent = PaymentHelpers.usePaymentIntent(Some(loggerState), Applepay) + let sync = PaymentHelpers.usePaymentSync(Some(loggerState), Applepay) let options = Recoil.useRecoilValueFromAtom(RecoilAtoms.optionAtom) let (applePayClicked, setApplePayClicked) = React.useState(_ => false) let isApplePaySDKFlow = props.sessionObj->Belt.Option.isSome @@ -226,12 +227,6 @@ let default = (props: props) => { let bodyDict = PaymentBody.applePayRedirectBody(~connectors) processPayment(bodyDict) } - loggerState.setLogInfo( - ~value="", - ~eventName=PAYMENT_DATA_FILLED, - ~paymentMethod="APPLE_PAY", - (), - ) } React.useEffect1(() => { @@ -274,6 +269,11 @@ let default = (props: props) => { ) }, [isInvokeSDKFlow]) + React.useEffect0(() => { + setIsShowOrPayUsing(.prev => prev || showApplePay) + None + }) +
{if showApplePay {