mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-01 07:02:48 +08:00
onboarding module defines api.host
This commit is contained in:
parent
98d201968e
commit
637186cf97
1 changed files with 22 additions and 0 deletions
|
@ -23,6 +23,28 @@ use Inpsyde\PayPalCommerce\WcGateway\Settings\SettingsFields;
|
|||
|
||||
return [
|
||||
|
||||
'api.host' => static function (ContainerInterface $container): string {
|
||||
$state = $container->get('onboarding.state');
|
||||
$environment = $container->get('onboarding.environment');
|
||||
|
||||
//ToDo: Correct the URLs
|
||||
/**
|
||||
* @var Environment $environment
|
||||
* @var State $state
|
||||
*/
|
||||
if ($state->currentState() >= State::STATE_ONBOARDED) {
|
||||
if ($environment->currentEnvironmentIs(Environment::SANDBOX)) {
|
||||
return 'https://api.sandbox.paypal.com';
|
||||
}
|
||||
return 'https://api.sandbox.paypal.com';
|
||||
}
|
||||
|
||||
if ($environment->currentEnvironmentIs(Environment::SANDBOX)) {
|
||||
return 'https://api.sandbox.paypal.com';
|
||||
}
|
||||
return 'https://api.sandbox.paypal.com';
|
||||
|
||||
},
|
||||
'onboarding.state' => function(ContainerInterface $container) : State {
|
||||
$environment = $container->get('onboarding.environment');
|
||||
$settings = $container->get('wcgateway.settings');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue