New services to check the onboarding status

This commit is contained in:
Philipp Stracker 2025-01-30 17:12:50 +01:00
parent 70abceeee0
commit 11f3071579
No known key found for this signature in database
2 changed files with 19 additions and 0 deletions

View file

@ -117,6 +117,16 @@ return array(
$settings = $container->get( 'wcgateway.settings' );
return new State( $settings );
},
/**
* Checks if the onboarding process is completed and the merchant API can be used.
* This service is overwritten by the ppcp-settings module, when it's active.
*/
'settings.flag.is-connected' => static function ( ContainerInterface $container ) : bool {
$state = $container->get( 'onboarding.state' );
assert( $state instanceof State );
return $state->current_state() >= State::STATE_ONBOARDED;
},
'onboarding.environment' => function( ContainerInterface $container ) : Environment {
$settings = $container->get( 'wcgateway.settings' );
return new Environment( $settings );