fix(client): prevent PayPal script loads in development (#38785)

pull/38800/head
Rostyslav Ugryniuk 2020-05-12 15:34:24 +03:00 committed by GitHub
parent c0905959a0
commit 88b263fef8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -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,

View File

@ -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 (
<PayPalButtonScriptLoader
amount={amount}
clinetId={paypalClientId}
clientId={paypalClientId}
createOrder={(data, actions) => {
return actions.order.create({
purchase_units: [