From 4b771d5e91e4e824ad00609c049587ee56be731e Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 29 Nov 2024 07:54:56 +0100 Subject: [PATCH] Make sure the time out is in place --- .../Controllers/Import/Spectre/ConnectionController.php | 6 ++++++ .../Nordigen/Conversion/Routine/GenerateTransactions.php | 1 + .../Nordigen/Services/AccountInformationCollector.php | 1 + app/Services/Shared/Import/Routine/ApiSubmitter.php | 1 + .../Spectre/Conversion/Routine/TransactionProcessor.php | 1 + app/Support/Internal/CollectsAccounts.php | 1 + 6 files changed, 11 insertions(+) diff --git a/app/Http/Controllers/Import/Spectre/ConnectionController.php b/app/Http/Controllers/Import/Spectre/ConnectionController.php index c5dbda0a..9009a299 100644 --- a/app/Http/Controllers/Import/Spectre/ConnectionController.php +++ b/app/Http/Controllers/Import/Spectre/ConnectionController.php @@ -77,6 +77,9 @@ public function index() // check if already has the correct customer: $hasCustomer = false; $request = new ListCustomersRequest($url, $appId, $secret); + + $request->setTimeOut(config('importer.connection.timeout')); + $list = $request->get(); $identifier = null; @@ -95,6 +98,7 @@ public function index() if (false === $hasCustomer) { // create new one $request = new PostCustomerRequest($url, $appId, $secret); + $request->setTimeOut(config('importer.connection.timeout')); $request->identifier = config('spectre.customer_identifier', 'default_ff3_customer'); /** @var PostCustomerResponse $customer */ @@ -121,6 +125,7 @@ public function index() app('log')->debug('About to get connections.'); $request = new ListConnectionsRequest($url, $appId, $secret); + $request->setTimeOut(config('importer.connection.timeout')); $request->customer = $identifier; $list = $request->get(); @@ -145,6 +150,7 @@ public function post(Request $request) $appId = SpectreSecretManager::getAppId(); $secret = SpectreSecretManager::getSecret(); $newToken = new PostConnectSessionsRequest($url, $appId, $secret); + $newToken->setTimeOut(config('importer.connection.timeout')); $newToken->customer = $configuration->getIdentifier(); $newToken->url = route('011-connections.callback'); diff --git a/app/Services/Nordigen/Conversion/Routine/GenerateTransactions.php b/app/Services/Nordigen/Conversion/Routine/GenerateTransactions.php index a7a148f3..f34691dd 100644 --- a/app/Services/Nordigen/Conversion/Routine/GenerateTransactions.php +++ b/app/Services/Nordigen/Conversion/Routine/GenerateTransactions.php @@ -393,6 +393,7 @@ private function getAccountType(int $accountId): string $url = SecretManager::getBaseUrl(); app('log')->debug(sprintf('Going to download account #%d', $accountId)); $request = new GetAccountRequest($url, $token); + $request->setTimeOut(config('importer.connection.timeout')); $request->setId($accountId); // @var GetAccountResponse $result diff --git a/app/Services/Nordigen/Services/AccountInformationCollector.php b/app/Services/Nordigen/Services/AccountInformationCollector.php index 3e0c3fc9..c10d07c5 100644 --- a/app/Services/Nordigen/Services/AccountInformationCollector.php +++ b/app/Services/Nordigen/Services/AccountInformationCollector.php @@ -107,6 +107,7 @@ protected static function getAccountDetails(Account $account): Account $url = config('nordigen.url'); $accessToken = TokenManager::getAccessToken(); $request = new GetAccountInformationRequest($url, $accessToken, $account->getIdentifier()); + $request->setTimeOut(config('importer.connection.timeout')); // @var ArrayResponse $response try { diff --git a/app/Services/Shared/Import/Routine/ApiSubmitter.php b/app/Services/Shared/Import/Routine/ApiSubmitter.php index d8f5cf6d..2d1a88b8 100644 --- a/app/Services/Shared/Import/Routine/ApiSubmitter.php +++ b/app/Services/Shared/Import/Routine/ApiSubmitter.php @@ -203,6 +203,7 @@ private function searchField(string $field, string $value): int $url = SecretManager::getBaseUrl(); $token = SecretManager::getAccessToken(); $request = new GetSearchTransactionsRequest($url, $token); + $request->setTimeOut(config('importer.connection.timeout')); $request->setQuery($query); try { diff --git a/app/Services/Spectre/Conversion/Routine/TransactionProcessor.php b/app/Services/Spectre/Conversion/Routine/TransactionProcessor.php index fa40a7cc..f2c99c4e 100644 --- a/app/Services/Spectre/Conversion/Routine/TransactionProcessor.php +++ b/app/Services/Spectre/Conversion/Routine/TransactionProcessor.php @@ -107,6 +107,7 @@ private function refreshConnection(): void $appId = SpectreSecretManager::getAppId(); $secret = SpectreSecretManager::getSecret(); $put = new PutRefreshConnectionRequest($url, $appId, $secret); + $put->setTimeOut(config('importer.connection.timeout')); $put->setConnection($this->configuration->getConnection()); $response = $put->put(); if ($response instanceof ErrorResponse) { diff --git a/app/Support/Internal/CollectsAccounts.php b/app/Support/Internal/CollectsAccounts.php index b2add347..1c2253bf 100644 --- a/app/Support/Internal/CollectsAccounts.php +++ b/app/Support/Internal/CollectsAccounts.php @@ -151,6 +151,7 @@ protected function getSpectreAccounts(Configuration $configuration): array $appId = SpectreSecretManager::getAppId(); $secret = SpectreSecretManager::getSecret(); $spectreList = new SpectreGetAccountsRequest($url, $appId, $secret); + $spectreList->setTimeOut(config('importer.connection.timeout')); $spectreList->connection = $configuration->getConnection(); /** @var GetAccountsResponse $spectreAccounts */