Files
InvoiceShelf/app/Services/Integrations/ExchangeRate/ExchangeRateDriver.php
Darko Gjorgjijoski 947d00a9f1 refactor(services): Documents→Document + ExchangeRate→Integrations/ExchangeRate
Two follow-ups to the Services reorg that landed in 6d1816bd.

**Documents → Document** (singular). Documents/ was the only plural subdir in app/Services/ — every other bucket (Company, Mail, Module, Pdf, Storage, Update, ExchangeRate) was singular. Renaming to Document/ normalizes the whole tree.

**ExchangeRate → Integrations/ExchangeRate**. Introduces Integrations/ as an umbrella for external-service adapter subsystems. Exchange rate providers move in first; AI providers, payment gateways, and any other driver-pattern integrations land as sibling subdirs (Integrations/Ai/, Integrations/Payment/) without another reorg. Integrations/ was chosen over Providers/ to avoid conceptual collision with Laravel's app/Providers/ — 'check the providers' shouldn't be ambiguous.

17 files moved, 21 consumer files rewritten to point at the new namespaces via literal-string replacement (same approach as the previous reorg). 350 tests pass, Pint clean.
2026-04-11 11:30:00 +02:00

35 lines
858 B
PHP

<?php
namespace App\Services\Integrations\ExchangeRate;
abstract class ExchangeRateDriver
{
public function __construct(
protected string $apiKey,
protected array $config = [],
) {}
/**
* Fetch exchange rate between two currencies.
*
* @return array Exchange rate values
*/
abstract public function getExchangeRate(string $baseCurrency, string $targetCurrency): array;
/**
* Get list of currencies supported by this provider.
*
* @return array Currency codes
*/
abstract public function getSupportedCurrencies(): array;
/**
* Validate that the API key and connection work.
*
* @return array Exchange rate values (proof of working connection)
*
* @throws ExchangeRateException
*/
abstract public function validateConnection(): array;
}