diff --git a/src/Hooks/UtilityHooks.res b/src/Hooks/UtilityHooks.res index 890fac6c7..a9a1266f8 100644 --- a/src/Hooks/UtilityHooks.res +++ b/src/Hooks/UtilityHooks.res @@ -10,19 +10,21 @@ let useIsGuestCustomer = () => { }, [customerPaymentMethods]) } -let useHandlePostMessages = (~complete, ~empty, ~paymentType, ~savedMethod=false) => { +let useHandlePostMessages = ( + ~complete, + ~empty, + ~paymentType, + ~savedMethod=false, + ~isWallet=false, +) => { open RecoilAtoms let loggerState = Recoil.useRecoilValueFromAtom(loggerAtom) let setIsPayNowButtonDisable = Recoil.useSetRecoilState(payNowButtonDisable) let {sdkHandleConfirmPayment} = Recoil.useRecoilValueFromAtom(optionAtom) - let showMainScreen = Recoil.useRecoilValueFromAtom(showCardFieldsAtom) React.useEffect(() => { - let isPaymentMethodScreenAndWallet = - showMainScreen && - (paymentType === "google_pay" || paymentType === "paypal" || paymentType === "apple_pay") - if !sdkHandleConfirmPayment.allowButtonBeforeValidation && !isPaymentMethodScreenAndWallet { + if !sdkHandleConfirmPayment.allowButtonBeforeValidation && !isWallet { let isCompletelyFilled = complete && paymentType !== "" setIsPayNowButtonDisable(_ => !isCompletelyFilled) } diff --git a/src/Payments/ApplePay.res b/src/Payments/ApplePay.res index 840fc9736..cd4157cb2 100644 --- a/src/Payments/ApplePay.res +++ b/src/Payments/ApplePay.res @@ -30,6 +30,7 @@ let make = (~sessionObj: option, ~walletOptions, ~paymentType: CardTheme ~complete=areRequiredFieldsValid, ~empty=areRequiredFieldsEmpty, ~paymentType="apple_pay", + ~isWallet, ) let applePayPaymentMethodType = React.useMemo(() => { diff --git a/src/Payments/GPay.res b/src/Payments/GPay.res index 18d307bee..dd2c981d6 100644 --- a/src/Payments/GPay.res +++ b/src/Payments/GPay.res @@ -42,6 +42,7 @@ let make = ( ~complete=areRequiredFieldsValid, ~empty=areRequiredFieldsEmpty, ~paymentType="google_pay", + ~isWallet, ) let googlePayPaymentMethodType = switch PaymentMethodsRecord.getPaymentMethodTypeFromList( diff --git a/src/Payments/KlarnaSDK.res b/src/Payments/KlarnaSDK.res index db2466c64..5c59aba54 100644 --- a/src/Payments/KlarnaSDK.res +++ b/src/Payments/KlarnaSDK.res @@ -45,6 +45,7 @@ let make = (~sessionObj: SessionsType.token) => { ~complete=isCompleted, ~empty=!isCompleted, ~paymentType="klarna", + ~isWallet=true, ) React.useEffect(() => { diff --git a/src/Payments/PaypalSDK.res b/src/Payments/PaypalSDK.res index 2ddc0cbba..bafbab234 100644 --- a/src/Payments/PaypalSDK.res +++ b/src/Payments/PaypalSDK.res @@ -56,6 +56,7 @@ let make = (~sessionObj: SessionsType.token, ~paymentType: CardThemeType.mode) = ~complete=isCompleted, ~empty=!isCompleted, ~paymentType="paypal", + ~isWallet=true, ) let mountPaypalSDK = () => {