♻️ Refactor CardButtonGateway

This commit is contained in:
Philipp Stracker 2025-02-17 16:57:41 +01:00
parent 262d3abd26
commit 6294dcac52
No known key found for this signature in database
2 changed files with 4 additions and 13 deletions

View file

@ -234,7 +234,7 @@ return array(
$container->get( 'wcgateway.settings' ),
$container->get( 'session.handler' ),
$container->get( 'wcgateway.processor.refunds' ),
$container->get( 'onboarding.state' ),
$container->get( 'settings.flag.is-connected' ),
$container->get( 'wcgateway.transaction-url-provider' ),
$container->get( 'wc-subscriptions.helper' ),
$container->get( 'wcgateway.settings.allow_card_button_gateway.default' ),

View file

@ -14,7 +14,6 @@ use Psr\Log\LoggerInterface;
use WC_Order;
use WooCommerce\PayPalCommerce\ApiClient\Exception\PayPalApiException;
use WooCommerce\PayPalCommerce\WcGateway\Helper\Environment;
use WooCommerce\PayPalCommerce\Onboarding\State;
use WooCommerce\PayPalCommerce\Session\SessionHandler;
use WooCommerce\PayPalCommerce\WcSubscriptions\FreeTrialHandlerTrait;
use WooCommerce\PayPalCommerce\WcSubscriptions\Helper\SubscriptionHelper;
@ -70,13 +69,6 @@ class CardButtonGateway extends \WC_Payment_Gateway {
*/
private $refund_processor;
/**
* The state.
*
* @var State
*/
protected $state;
/**
* Service able to provide transaction url for an order.
*
@ -141,7 +133,7 @@ class CardButtonGateway extends \WC_Payment_Gateway {
* @param ContainerInterface $config The settings.
* @param SessionHandler $session_handler The Session Handler.
* @param RefundProcessor $refund_processor The Refund Processor.
* @param State $state The state.
* @param bool $is_connected Whether onboarding was completed.
* @param TransactionUrlProvider $transaction_url_provider Service providing transaction view URL based on order.
* @param SubscriptionHelper $subscription_helper The subscription helper.
* @param bool $default_enabled Whether the gateway should be enabled by default.
@ -157,7 +149,7 @@ class CardButtonGateway extends \WC_Payment_Gateway {
ContainerInterface $config,
SessionHandler $session_handler,
RefundProcessor $refund_processor,
State $state,
bool $is_connected,
TransactionUrlProvider $transaction_url_provider,
SubscriptionHelper $subscription_helper,
bool $default_enabled,
@ -173,12 +165,11 @@ class CardButtonGateway extends \WC_Payment_Gateway {
$this->config = $config;
$this->session_handler = $session_handler;
$this->refund_processor = $refund_processor;
$this->state = $state;
$this->transaction_url_provider = $transaction_url_provider;
$this->subscription_helper = $subscription_helper;
$this->default_enabled = $default_enabled;
$this->environment = $environment;
$this->onboarded = $state->current_state() === State::STATE_ONBOARDED;
$this->onboarded = $is_connected;
$this->payment_token_repository = $payment_token_repository;
$this->logger = $logger;
$this->paypal_checkout_url_factory = $paypal_checkout_url_factory;