diff --git a/src/Payments/ApplePay.res b/src/Payments/ApplePay.res index 1bd4408ff..f234d0b43 100644 --- a/src/Payments/ApplePay.res +++ b/src/Payments/ApplePay.res @@ -1,7 +1,7 @@ type props = {sessionObj: option, list: PaymentMethodListType.list} let default = (props: props) => { - let {clientSecret, publishableKey} = Recoil.useRecoilValueFromAtom(RecoilAtoms.keys) + let {publishableKey} = Recoil.useRecoilValueFromAtom(RecoilAtoms.keys) let (showApplePay, setShowApplePay) = React.useState(() => false) let (showApplePayLoader, setShowApplePayLoader) = React.useState(() => false) let intent = PaymentHelpers.usePaymentIntent(None, Applepay) diff --git a/src/Payments/GPay.res b/src/Payments/GPay.res index a32acb090..b03cfb673 100644 --- a/src/Payments/GPay.res +++ b/src/Payments/GPay.res @@ -19,7 +19,7 @@ external resToJson: Fetch.Response.t => Js.Json.t = "%identity" let default = (props: props) => { let (loggerState, _setLoggerState) = Recoil.useRecoilState(loggerAtom) let {iframeId} = Recoil.useRecoilValueFromAtom(keys) - let {clientSecret, publishableKey} = Recoil.useRecoilValueFromAtom(keys) + let {publishableKey} = Recoil.useRecoilValueFromAtom(keys) let options = Recoil.useRecoilValueFromAtom(optionAtom) let intent = PaymentHelpers.usePaymentIntent(Some(loggerState), Gpay) let sync = PaymentHelpers.usePaymentSync(Some(loggerState), Gpay) diff --git a/src/Payments/PayPal.res b/src/Payments/PayPal.res index 7583b2097..b12909fee 100644 --- a/src/Payments/PayPal.res +++ b/src/Payments/PayPal.res @@ -14,7 +14,7 @@ let payPalIcon = let default = (props: props) => { let loggerState = Recoil.useRecoilValueFromAtom(loggerAtom) let (paypalClicked, setPaypalClicked) = React.useState(_ => false) - let {clientSecret, publishableKey} = Recoil.useRecoilValueFromAtom(keys) + let {publishableKey} = Recoil.useRecoilValueFromAtom(keys) let options = Recoil.useRecoilValueFromAtom(optionAtom) let (_, _, labelType) = options.wallets.style.type_ let _label = switch labelType { diff --git a/src/Payments/PaymentRequestButtonElement.res b/src/Payments/PaymentRequestButtonElement.res index cb8c6a44b..2f632836b 100644 --- a/src/Payments/PaymentRequestButtonElement.res +++ b/src/Payments/PaymentRequestButtonElement.res @@ -28,40 +28,49 @@ let make = (~sessions, ~walletOptions, ~list) => { Gpay, ) + let {clientSecret} = Recoil.useRecoilValueFromAtom(RecoilAtoms.keys) +
{walletOptions ->Js.Array2.mapi((item, i) => { } key={i->Belt.Int.toString}> - {switch item->paymentMode { - | GPayWallet => - - {switch gPayToken { - | OtherTokenOptional(optToken) => - switch googlePayThirdPartyToken { - | GooglePayThirdPartyTokenOptional(googlePayThirdPartyOptToken) => - | _ => - } + {switch clientSecret { + | Some(_) => + switch item->paymentMode { + | GPayWallet => + + {switch gPayToken { + | OtherTokenOptional(optToken) => + switch googlePayThirdPartyToken { + | GooglePayThirdPartyTokenOptional(googlePayThirdPartyOptToken) => + + | _ => + } + | _ => React.null + }} + + | PaypalWallet => + + {switch paypalToken { + | OtherTokenOptional(optToken) => + switch optToken { + | Some(token) => + | None => + } + | _ => + }} + + | ApplePayWallet => + switch applePayToken { + | ApplePayTokenOptional(optToken) => | _ => React.null - }} - - | PaypalWallet => - - {switch paypalToken { - | OtherTokenOptional(optToken) => - switch optToken { - | Some(token) => - | None => - } - | _ => - }} - - | ApplePayWallet => - switch applePayToken { - | ApplePayTokenOptional(optToken) => - | _ => React.null - } + } - | NONE => React.null + | NONE => React.null + } + | None => React.null }} }) diff --git a/src/Payments/PaypalSDK.res b/src/Payments/PaypalSDK.res index dae35798d..5a37cc4f1 100644 --- a/src/Payments/PaypalSDK.res +++ b/src/Payments/PaypalSDK.res @@ -4,7 +4,7 @@ open RecoilAtoms type props = {sessionObj: SessionsType.token, list: PaymentMethodListType.list} let default = (props: props) => { - let {iframeId, clientSecret, publishableKey} = Recoil.useRecoilValueFromAtom(keys) + let {iframeId, publishableKey} = Recoil.useRecoilValueFromAtom(keys) let (loggerState, _setLoggerState) = Recoil.useRecoilState(loggerAtom) let token = props.sessionObj.token