From c97df85c570d8256bcbc20f47721bfa78b2e5a54 Mon Sep 17 00:00:00 2001 From: Alex P Date: Thu, 15 Jun 2023 10:01:05 +0300 Subject: [PATCH] Fix code duplication --- .../src/Checkout/DisableGateways.php | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/modules/ppcp-wc-gateway/src/Checkout/DisableGateways.php b/modules/ppcp-wc-gateway/src/Checkout/DisableGateways.php index bbd9b30d3..1d297c4e9 100644 --- a/modules/ppcp-wc-gateway/src/Checkout/DisableGateways.php +++ b/modules/ppcp-wc-gateway/src/Checkout/DisableGateways.php @@ -9,6 +9,7 @@ declare(strict_types=1); namespace WooCommerce\PayPalCommerce\WcGateway\Checkout; +use WooCommerce\PayPalCommerce\Button\Helper\ContextTrait; use WooCommerce\PayPalCommerce\Session\SessionHandler; use WooCommerce\PayPalCommerce\WcGateway\Gateway\CardButtonGateway; use WooCommerce\PayPalCommerce\WcGateway\Gateway\CreditCardGateway; @@ -20,6 +21,7 @@ use WooCommerce\PayPalCommerce\WcGateway\Helper\SettingsStatus; * Class DisableGateways */ class DisableGateways { + use ContextTrait; /** * The Session Handler. @@ -124,20 +126,6 @@ class DisableGateways { * @return bool */ private function needs_to_disable_gateways(): bool { - $order = $this->session_handler->order(); - if ( ! $order ) { - return false; - } - - $source = $order->payment_source(); - if ( $source && $source->card() ) { - return false; // DCC. - } - - if ( 'card' === $this->session_handler->funding_source() ) { - return false; // Card buttons. - } - - return true; + return $this->is_paypal_continuation(); } }