♻️ Refactor ppcp-webhooks/factory

This commit is contained in:
Philipp Stracker 2025-02-17 17:49:35 +01:00
parent 554c9ad03c
commit 8c23462db5
No known key found for this signature in database

View file

@ -10,7 +10,6 @@ declare(strict_types=1);
namespace WooCommerce\PayPalCommerce\Webhooks;
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\WebhookEndpoint;
use WooCommerce\PayPalCommerce\Onboarding\State;
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
return array(
@ -18,8 +17,9 @@ return array(
$endpoint = $container->get( 'api.endpoint.webhook' );
assert( $endpoint instanceof WebhookEndpoint );
$state = $container->get( 'onboarding.state' );
if ( $state->current_state() >= State::STATE_ONBOARDED ) {
$is_connected = $container->get( 'settings.flag.is-connected' );
if ( $is_connected ) {
return $endpoint->list();
}