mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 10:55:00 +08:00
💡 Improve comments for connection-services
This commit is contained in:
parent
a693ca4455
commit
4afa8dd4dd
2 changed files with 30 additions and 11 deletions
|
@ -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 );
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue