function( $container ) : WebhookRegistrar { $factory = $container->get( 'api.factory.webhook' ); $endpoint = $container->get( 'api.endpoint.webhook' ); $rest_endpoint = $container->get( 'webhook.endpoint.controller' ); $logger = $container->get( 'woocommerce.logger.woocommerce' ); return new WebhookRegistrar( $factory, $endpoint, $rest_endpoint, $logger ); }, 'webhook.endpoint.controller' => function( $container ) : IncomingWebhookEndpoint { $webhook_endpoint = $container->get( 'api.endpoint.webhook' ); $webhook_factory = $container->get( 'api.factory.webhook' ); $handler = $container->get( 'webhook.endpoint.handler' ); $logger = $container->get( 'woocommerce.logger.woocommerce' ); $verify_request = ! defined( 'PAYPAL_WEBHOOK_REQUEST_VERIFICATION' ) || PAYPAL_WEBHOOK_REQUEST_VERIFICATION; return new IncomingWebhookEndpoint( $webhook_endpoint, $webhook_factory, $logger, $verify_request, ... $handler ); }, 'webhook.endpoint.handler' => function( $container ) : array { $logger = $container->get( 'woocommerce.logger.woocommerce' ); $prefix = $container->get( 'api.prefix' ); $order_endpoint = $container->get( 'api.endpoint.order' ); return array( new CheckoutOrderApproved( $logger, $prefix, $order_endpoint ), new CheckoutOrderCompleted( $logger, $prefix ), new PaymentCaptureRefunded( $logger, $prefix ), new PaymentCaptureReversed( $logger, $prefix ), new PaymentCaptureCompleted( $logger, $prefix ), ); }, );