|
30 | 30 | use App\Services\InfoProviderSystem\DTOs\PriceDTO; |
31 | 31 | use App\Services\InfoProviderSystem\DTOs\PurchaseInfoDTO; |
32 | 32 | use App\Services\OAuth\OAuthTokenManager; |
| 33 | +use App\Settings\InfoProviderSystem\OctopartSettings; |
33 | 34 | use Psr\Cache\CacheItemPoolInterface; |
34 | 35 | use Symfony\Component\HttpClient\HttpOptions; |
35 | 36 | use Symfony\Contracts\HttpClient\HttpClientInterface; |
@@ -114,9 +115,8 @@ class OctopartProvider implements InfoProviderInterface |
114 | 115 |
|
115 | 116 | public function __construct(private readonly HttpClientInterface $httpClient, |
116 | 117 | private readonly OAuthTokenManager $authTokenManager, private readonly CacheItemPoolInterface $partInfoCache, |
117 | | - private readonly string $clientId, private readonly string $secret, |
118 | | - private readonly string $currency, private readonly string $country, |
119 | | - private readonly int $search_limit, private readonly bool $onlyAuthorizedSellers) |
| 118 | + private readonly OctopartSettings $settings, |
| 119 | + ) |
120 | 120 | { |
121 | 121 |
|
122 | 122 | } |
@@ -183,7 +183,7 @@ public function isActive(): bool |
183 | 183 | { |
184 | 184 | //The client ID has to be set and a token has to be available (user clicked connect) |
185 | 185 | //return /*!empty($this->clientId) && */ $this->authTokenManager->hasToken(self::OAUTH_APP_NAME); |
186 | | - return $this->clientId !== '' && $this->secret !== ''; |
| 186 | + return $this->settings->clientId !== '' && $this->settings->secret !== ''; |
187 | 187 | } |
188 | 188 |
|
189 | 189 | private function mapLifeCycleStatus(?string $value): ?ManufacturingStatus |
@@ -347,10 +347,10 @@ public function searchByKeyword(string $keyword): array |
347 | 347 |
|
348 | 348 | $result = $this->makeGraphQLCall($graphQL, [ |
349 | 349 | 'keyword' => $keyword, |
350 | | - 'limit' => $this->search_limit, |
351 | | - 'currency' => $this->currency, |
352 | | - 'country' => $this->country, |
353 | | - 'authorizedOnly' => $this->onlyAuthorizedSellers, |
| 350 | + 'limit' => $this->settings->searchLimit, |
| 351 | + 'currency' => $this->settings->currency, |
| 352 | + 'country' => $this->settings->country, |
| 353 | + 'authorizedOnly' => $this->settings->onlyAuthorizedSellers, |
354 | 354 | ]); |
355 | 355 |
|
356 | 356 | $tmp = []; |
@@ -383,9 +383,9 @@ public function getDetails(string $id): PartDetailDTO |
383 | 383 |
|
384 | 384 | $result = $this->makeGraphQLCall($graphql, [ |
385 | 385 | 'ids' => [$id], |
386 | | - 'currency' => $this->currency, |
387 | | - 'country' => $this->country, |
388 | | - 'authorizedOnly' => $this->onlyAuthorizedSellers, |
| 386 | + 'currency' => $this->settings->currency, |
| 387 | + 'country' => $this->settings->country, |
| 388 | + 'authorizedOnly' => $this->settings->onlyAuthorizedSellers, |
389 | 389 | ]); |
390 | 390 |
|
391 | 391 | $tmp = $this->partResultToDTO($result['data']['supParts'][0]); |
|
0 commit comments