mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 09:08:09 +08:00
Detach vaulting from subscriptions (WIP)
This commit is contained in:
parent
28031d927b
commit
2b3b4dcce2
5 changed files with 3 additions and 31 deletions
|
@ -239,10 +239,6 @@ class SmartButton implements SmartButtonInterface {
|
|||
$this->render_message_wrapper_registrar();
|
||||
}
|
||||
|
||||
if ( ! $this->can_save_vault_token() && $this->has_subscriptions() ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (
|
||||
$this->settings->has( 'dcc_enabled' )
|
||||
&& $this->settings->get( 'dcc_enabled' )
|
||||
|
@ -444,10 +440,6 @@ class SmartButton implements SmartButtonInterface {
|
|||
add_action(
|
||||
$this->mini_cart_button_renderer_hook(),
|
||||
function () {
|
||||
if ( ! $this->can_save_vault_token() && $this->has_subscriptions() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $this->is_cart_price_total_zero() || $this->is_free_trial_cart() ) {
|
||||
return;
|
||||
}
|
||||
|
@ -559,10 +551,6 @@ class SmartButton implements SmartButtonInterface {
|
|||
*/
|
||||
public function button_renderer( string $gateway_id ) {
|
||||
|
||||
if ( ! $this->can_save_vault_token() && $this->has_subscriptions() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$available_gateways = WC()->payment_gateways->get_available_payment_gateways();
|
||||
|
||||
if ( ! isset( $available_gateways[ $gateway_id ] ) ) {
|
||||
|
@ -578,9 +566,6 @@ class SmartButton implements SmartButtonInterface {
|
|||
* Renders the HTML for the credit messaging.
|
||||
*/
|
||||
public function message_renderer() {
|
||||
if ( ! $this->can_save_vault_token() && $this->has_subscriptions() ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$product = wc_get_product();
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ class CardButtonGateway extends \WC_Payment_Gateway {
|
|||
if ( $this->onboarded ) {
|
||||
$this->supports = array( 'refunds' );
|
||||
}
|
||||
if ($this->gateways_enabled() && $this->vault_setting_enabled()) {
|
||||
if ($this->gateways_enabled()) {
|
||||
$this->supports = array(
|
||||
'refunds',
|
||||
'products',
|
||||
|
|
|
@ -174,7 +174,7 @@ class CreditCardGateway extends \WC_Payment_Gateway_CC {
|
|||
if ( $state->current_state() === State::STATE_ONBOARDED ) {
|
||||
$this->supports = array( 'refunds' );
|
||||
}
|
||||
if ($this->gateways_enabled() && $this->vault_setting_enabled()) {
|
||||
if ($this->gateways_enabled()) {
|
||||
$this->supports = array(
|
||||
'refunds',
|
||||
'products',
|
||||
|
|
|
@ -204,7 +204,7 @@ class PayPalGateway extends \WC_Payment_Gateway {
|
|||
if ( $this->onboarded ) {
|
||||
$this->supports = array( 'refunds' );
|
||||
}
|
||||
if ($this->gateways_enabled() && $this->vault_setting_enabled()) {
|
||||
if ($this->gateways_enabled()) {
|
||||
$this->supports = array(
|
||||
'refunds',
|
||||
'products',
|
||||
|
|
|
@ -33,19 +33,6 @@ trait ProcessPaymentTrait {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if vault setting is enabled.
|
||||
*
|
||||
* @return bool Whether vault settings are enabled or not.
|
||||
* @throws \WooCommerce\PayPalCommerce\WcGateway\Exception\NotFoundException When a setting hasn't been found.
|
||||
*/
|
||||
protected function vault_setting_enabled(): bool {
|
||||
if ( $this->config->has( 'vault_enabled' ) && $this->config->get( 'vault_enabled' ) ) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Scheduled the vaulted payment check.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue