From 88b263fef8209e58e00fa1ee6874143067e64e3c Mon Sep 17 00:00:00 2001 From: Rostyslav Ugryniuk Date: Tue, 12 May 2020 15:34:24 +0300 Subject: [PATCH] fix(client): prevent PayPal script loads in development (#38785) --- client/src/components/Donation/PayPalButtonScriptLoader.js | 4 ++-- client/src/components/Donation/PaypalButton.js | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/client/src/components/Donation/PayPalButtonScriptLoader.js b/client/src/components/Donation/PayPalButtonScriptLoader.js index c476552c51..ce8be6a63e 100644 --- a/client/src/components/Donation/PayPalButtonScriptLoader.js +++ b/client/src/components/Donation/PayPalButtonScriptLoader.js @@ -34,7 +34,7 @@ export class PayPalButtonScriptLoader extends Component { loadScript(subscription, deleteScript) { if (deleteScript) scriptRemover('paypal-sdk'); - let queries = `?client-id=${this.props.clinetId}&disable-funding=credit,card`; + let queries = `?client-id=${this.props.clientId}&disable-funding=credit,card`; if (subscription) queries += '&vault=true'; scriptLoader( @@ -92,7 +92,7 @@ export class PayPalButtonScriptLoader extends Component { } const propTypes = { - clinetId: PropTypes.string, + clientId: PropTypes.string, createOrder: PropTypes.func, createSubscription: PropTypes.func, donationAmount: PropTypes.number, diff --git a/client/src/components/Donation/PaypalButton.js b/client/src/components/Donation/PaypalButton.js index 230d2fb30e..97ffabc25b 100644 --- a/client/src/components/Donation/PaypalButton.js +++ b/client/src/components/Donation/PaypalButton.js @@ -76,10 +76,15 @@ export class PaypalButton extends Component { render() { const { duration, planId, amount } = this.state; const isSubscription = duration !== 'onetime'; + + if (!paypalClientId) { + return null; + } + return ( { return actions.order.create({ purchase_units: [