2024-09-11 16:47:15 +03:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* The webhook module factories.
|
|
|
|
*
|
|
|
|
* @package WooCommerce\PayPalCommerce\Webhooks
|
|
|
|
*/
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace WooCommerce\PayPalCommerce\Webhooks;
|
|
|
|
|
|
|
|
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\WebhookEndpoint;
|
|
|
|
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
|
|
|
|
|
|
|
return array(
|
|
|
|
'webhook.status.registered-webhooks' => function( ContainerInterface $container ) : array {
|
|
|
|
$endpoint = $container->get( 'api.endpoint.webhook' );
|
|
|
|
assert( $endpoint instanceof WebhookEndpoint );
|
|
|
|
|
2025-02-17 17:49:35 +01:00
|
|
|
$is_connected = $container->get( 'settings.flag.is-connected' );
|
|
|
|
|
|
|
|
if ( $is_connected ) {
|
2024-09-11 16:47:15 +03:00
|
|
|
return $endpoint->list();
|
|
|
|
}
|
|
|
|
|
|
|
|
return array();
|
|
|
|
},
|
|
|
|
);
|