From 4afa8dd4ddc512ea057bae7cd3ff2f97eb32fb03 Mon Sep 17 00:00:00 2001 From: Philipp Stracker Date: Fri, 14 Mar 2025 15:14:41 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=A1=20Improve=20comments=20for=20conne?= =?UTF-8?q?ction-services?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/ppcp-onboarding/services.php | 17 +++++++++++++++++ modules/ppcp-settings/services.php | 24 +++++++++++++----------- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/modules/ppcp-onboarding/services.php b/modules/ppcp-onboarding/services.php index 2e26885e4..8a87e4288 100644 --- a/modules/ppcp-onboarding/services.php +++ b/modules/ppcp-onboarding/services.php @@ -67,18 +67,35 @@ return array( return new ConnectionState( $is_connected, $environment ); }, + /** + * Checks if the onboarding process is completed and the merchant API can be used. + * This service only resolves the connection status once per request. + * + * @deprecated Use 'settings.connection-state' instead. + */ 'settings.flag.is-connected' => static function ( ContainerInterface $container ) : bool { $state = $container->get( 'settings.connection-state' ); assert( $state instanceof ConnectionState ); return $state->is_connected(); }, + /** + * Determines whether the merchant is connected to a sandbox account. + * This service only resolves the sandbox flag once per request. + * + * @deprecated Use 'settings.connection-state' instead. + */ 'settings.flag.is-sandbox' => static function ( ContainerInterface $container ) : bool { $state = $container->get( 'settings.connection-state' ); assert( $state instanceof ConnectionState ); return $state->is_sandbox(); }, + /** + * Returns details about the connected environment (production/sandbox). + * + * @deprecated Directly use 'settings.connection-state' instead of this. + */ 'settings.environment' => function ( ContainerInterface $container ) : Environment { $state = $container->get( 'settings.connection-state' ); assert( $state instanceof ConnectionState ); diff --git a/modules/ppcp-settings/services.php b/modules/ppcp-settings/services.php index 71ad9a724..2270d5738 100644 --- a/modules/ppcp-settings/services.php +++ b/modules/ppcp-settings/services.php @@ -137,34 +137,36 @@ return array( return new ConnectionState( $is_connected, $environment ); }, + /** + * Returns details about the connected environment (production/sandbox). + * + * @deprecated Directly use 'settings.connection-state' instead of this. + */ 'settings.environment' => static function ( ContainerInterface $container ) : Environment { - // We should remove this service in favor of directly using `settings.connection-state`. $state = $container->get( 'settings.connection-state' ); assert( $state instanceof ConnectionState ); return $state->get_environment(); }, /** - * Checks if valid merchant connection details are stored in the DB. + * Checks if the onboarding process is completed and the merchant API can be used. + * This service only resolves the connection status once per request. + * + * @deprecated Use 'settings.connection-state' instead. */ 'settings.flag.is-connected' => static function ( ContainerInterface $container ) : bool { - /* - * This service only resolves the connection status once per request. - * We should remove this service in favor of directly using `settings.connection-state`. - */ $state = $container->get( 'settings.connection-state' ); assert( $state instanceof ConnectionState ); return $state->is_connected(); }, /** - * Checks if the merchant is connected to a sandbox environment. + * Determines whether the merchant is connected to a sandbox account. + * This service only resolves the sandbox flag once per request. + * + * @deprecated Use 'settings.connection-state' instead. */ 'settings.flag.is-sandbox' => static function ( ContainerInterface $container ) : bool { - /* - * This service only resolves the sandbox flag once per request. - * We should remove this service in favor of directly using `settings.connection-state`. - */ $state = $container->get( 'settings.connection-state' ); assert( $state instanceof ConnectionState );