mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-01 07:02:48 +08:00
Disabled GooglePay and ApplePay on locations with subsciption products.
This commit is contained in:
parent
ac7779bc41
commit
24f98cd038
10 changed files with 65 additions and 1 deletions
|
@ -10,6 +10,13 @@ class BaseHandler {
|
|||
this.externalHandler = externalHandler;
|
||||
}
|
||||
|
||||
validateContext() {
|
||||
if ( this.ppcpConfig?.locations_with_subscription_product?.cart ) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
shippingAllowed() {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,13 @@ import CheckoutActionHandler
|
|||
|
||||
class PayNowHandler extends BaseHandler {
|
||||
|
||||
validateContext() {
|
||||
if ( this.ppcpConfig?.locations_with_subscription_product?.payorder ) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
shippingAllowed() {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,13 @@ import BaseHandler from "./BaseHandler";
|
|||
|
||||
class SingleProductHandler extends BaseHandler {
|
||||
|
||||
validateContext() {
|
||||
if ( this.ppcpConfig?.locations_with_subscription_product?.product ) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
transactionInfo() {
|
||||
const errorHandler = new ErrorHandler(
|
||||
this.ppcpConfig.labels.error.generic,
|
||||
|
|
|
@ -40,6 +40,10 @@ class GooglepayButton {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!this.contextHandler.validateContext()) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.googlePayConfig = config;
|
||||
this.allowedPaymentMethods = config.allowedPaymentMethods;
|
||||
this.baseCardPaymentMethod = this.allowedPaymentMethods[0];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue