|
|
|
@ -27,11 +27,11 @@ namespace App\Services\Spectre; |
|
|
|
|
|
|
|
use App\Exceptions\ImporterHttpException; |
|
|
|
use App\Services\Enums\AuthenticationStatus; |
|
|
|
use App\Services\Session\Constants; |
|
|
|
use App\Services\Shared\Authentication\AuthenticationValidatorInterface; |
|
|
|
use App\Services\Shared\Authentication\IsRunningCli; |
|
|
|
use App\Services\Spectre\Request\ListCustomersRequest; |
|
|
|
use App\Services\Spectre\Response\ErrorResponse; |
|
|
|
use App\Services\Spectre\Authentication\SecretManager; |
|
|
|
|
|
|
|
/** |
|
|
|
* Class AuthenticationValidator |
|
|
|
@ -45,26 +45,17 @@ class AuthenticationValidator implements AuthenticationValidatorInterface |
|
|
|
*/ |
|
|
|
public function validate(): AuthenticationStatus |
|
|
|
{ |
|
|
|
die('must validate nordigen using secret manager'); |
|
|
|
// SecretManager::getUrl();
|
|
|
|
app('log')->debug(sprintf('Now at %s', __METHOD__)); |
|
|
|
|
|
|
|
$url = config('spectre.url'); |
|
|
|
$appId = config('spectre.app_id'); |
|
|
|
$secret = config('spectre.secret'); |
|
|
|
|
|
|
|
if ('' === $appId && !$this->isCli()) { |
|
|
|
$appId = (string) session()->get(Constants::SESSION_SPECTRE_APP_ID); |
|
|
|
} |
|
|
|
if ('' === $secret && !$this->isCli()) { |
|
|
|
$secret = (string) session()->get(Constants::SESSION_SPECTRE_SECRET); |
|
|
|
} |
|
|
|
|
|
|
|
$appId = SecretManager::getAppId(); |
|
|
|
$secret = SecretManager::getSecret(); |
|
|
|
|
|
|
|
if ('' === $appId || '' === $secret) { |
|
|
|
return AuthenticationStatus::nodata(); |
|
|
|
} |
|
|
|
$request = new ListCustomersRequest($url, $appId, $secret); |
|
|
|
|
|
|
|
$request = new ListCustomersRequest($url, $appId, $secret); |
|
|
|
$request->setTimeOut(config('importer.connection.timeout')); |
|
|
|
|
|
|
|
try { |
|
|
|
|