mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
Merge pull request #1796 from woocommerce/PCP-1852-card-button-subs
Fix card button subscription support declaration
This commit is contained in:
commit
96aaed5a5d
2 changed files with 12 additions and 23 deletions
|
@ -171,13 +171,17 @@ class CardButtonGateway extends \WC_Payment_Gateway {
|
||||||
$this->payment_token_repository = $payment_token_repository;
|
$this->payment_token_repository = $payment_token_repository;
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
|
|
||||||
if ( $this->onboarded ) {
|
$this->supports = array(
|
||||||
$this->supports = array( 'refunds' );
|
'refunds',
|
||||||
}
|
'products',
|
||||||
if ( $this->gateways_enabled() ) {
|
);
|
||||||
$this->supports = array(
|
|
||||||
'refunds',
|
if (
|
||||||
'products',
|
( $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',
|
'subscriptions',
|
||||||
'subscription_cancellation',
|
'subscription_cancellation',
|
||||||
'subscription_suspension',
|
'subscription_suspension',
|
||||||
|
@ -187,7 +191,7 @@ class CardButtonGateway extends \WC_Payment_Gateway {
|
||||||
'subscription_payment_method_change',
|
'subscription_payment_method_change',
|
||||||
'subscription_payment_method_change_customer',
|
'subscription_payment_method_change_customer',
|
||||||
'subscription_payment_method_change_admin',
|
'subscription_payment_method_change_admin',
|
||||||
'multiple_subscriptions',
|
'multiple_subscriptions'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,21 +18,6 @@ use WooCommerce\PayPalCommerce\WcGateway\Exception\GatewayGenericException;
|
||||||
* Trait ProcessPaymentTrait
|
* Trait ProcessPaymentTrait
|
||||||
*/
|
*/
|
||||||
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.
|
* Handles the payment failure.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue