diff --git a/modules/ppcp-wc-gateway/src/Gateway/CardButtonGateway.php b/modules/ppcp-wc-gateway/src/Gateway/CardButtonGateway.php index fecb495b6..010df9e9b 100644 --- a/modules/ppcp-wc-gateway/src/Gateway/CardButtonGateway.php +++ b/modules/ppcp-wc-gateway/src/Gateway/CardButtonGateway.php @@ -171,13 +171,17 @@ class CardButtonGateway extends \WC_Payment_Gateway { $this->payment_token_repository = $payment_token_repository; $this->logger = $logger; - if ( $this->onboarded ) { - $this->supports = array( 'refunds' ); - } - if ( $this->gateways_enabled() ) { - $this->supports = array( - 'refunds', - 'products', + $this->supports = array( + 'refunds', + 'products', + ); + + if ( + ( $this->config->has( 'vault_enabled' ) && $this->config->get( 'vault_enabled' ) ) + || ( $this->config->has( 'subscriptions_mode' ) && $this->config->get( 'subscriptions_mode' ) === 'subscriptions_api' ) + ) { + array_push( + $this->supports, 'subscriptions', 'subscription_cancellation', 'subscription_suspension', @@ -187,7 +191,7 @@ class CardButtonGateway extends \WC_Payment_Gateway { 'subscription_payment_method_change', 'subscription_payment_method_change_customer', 'subscription_payment_method_change_admin', - 'multiple_subscriptions', + 'multiple_subscriptions' ); } diff --git a/modules/ppcp-wc-gateway/src/Gateway/ProcessPaymentTrait.php b/modules/ppcp-wc-gateway/src/Gateway/ProcessPaymentTrait.php index 7f752ef18..3cf401b29 100644 --- a/modules/ppcp-wc-gateway/src/Gateway/ProcessPaymentTrait.php +++ b/modules/ppcp-wc-gateway/src/Gateway/ProcessPaymentTrait.php @@ -18,21 +18,6 @@ use WooCommerce\PayPalCommerce\WcGateway\Exception\GatewayGenericException; * Trait ProcessPaymentTrait */ trait ProcessPaymentTrait { - /** - * Checks if PayPal or Credit Card gateways are enabled. - * - * @return bool Whether any of the gateways is enabled. - */ - protected function gateways_enabled(): bool { - if ( $this->config->has( 'enabled' ) && $this->config->get( 'enabled' ) ) { - return true; - } - if ( $this->config->has( 'dcc_enabled' ) && $this->config->get( 'dcc_enabled' ) ) { - return true; - } - return false; - } - /** * Handles the payment failure. *