diff --git a/src/Components/PayNowButton.res b/src/Components/PayNowButton.res index a6affdced..b0298f63c 100644 --- a/src/Components/PayNowButton.res +++ b/src/Components/PayNowButton.res @@ -16,6 +16,7 @@ let make = () => { let (showLoader, setShowLoader) = React.useState(() => false) let {themeObj, localeString} = configAtom->Recoil.useRecoilValueFromAtom let {sdkHandleConfirmPayment} = optionAtom->Recoil.useRecoilValueFromAtom + let (isPayNowButtonDisable, setIsPayNowButtonDisable) = payNowButtonDisable->Recoil.useRecoilState let confirmPayload = sdkHandleConfirmPayment->PaymentBody.confirmPayloadForSDKButton let buttonText = sdkHandleConfirmPayment.buttonText->Option.getOr(localeString.payNowButton) @@ -27,6 +28,7 @@ let make = () => { switch dict->Dict.get("submitSuccessful") { | Some(submitSuccessfulVal) => if !(submitSuccessfulVal->JSON.Decode.bool->Option.getOr(false)) { + setIsPayNowButtonDisable(_ => false) setShowLoader(_ => false) } | None => () @@ -34,6 +36,7 @@ let make = () => { } let handleOnClick = _ => { + setIsPayNowButtonDisable(_ => true) setShowLoader(_ => true) EventListenerManager.addSmartEventListener("message", handleMessage, "onSubmitSuccessful") handlePostMessage([("handleSdkConfirm", confirmPayload)]) @@ -41,14 +44,15 @@ let make = () => {