mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-07-16 22:05:20 +00:00
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.
66 lines
2.5 KiB
PHP
66 lines
2.5 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Services\Integrations\ExchangeRate\CurrencyConverterDriver;
|
|
use App\Services\Integrations\ExchangeRate\CurrencyFreakDriver;
|
|
use App\Services\Integrations\ExchangeRate\CurrencyLayerDriver;
|
|
use App\Services\Integrations\ExchangeRate\OpenExchangeRateDriver;
|
|
use Illuminate\Support\ServiceProvider;
|
|
use InvoiceShelf\Modules\Registry;
|
|
|
|
class DriverRegistryProvider extends ServiceProvider
|
|
{
|
|
public function boot(): void
|
|
{
|
|
$this->registerExchangeRateDrivers();
|
|
}
|
|
|
|
protected function registerExchangeRateDrivers(): void
|
|
{
|
|
Registry::registerExchangeRateDriver('currency_converter', [
|
|
'class' => CurrencyConverterDriver::class,
|
|
'label' => 'settings.exchange_rate.currency_converter',
|
|
'website' => 'https://www.currencyconverterapi.com',
|
|
'config_fields' => [
|
|
[
|
|
'key' => 'type',
|
|
'type' => 'select',
|
|
'label' => 'settings.exchange_rate.server',
|
|
'options' => [
|
|
['label' => 'settings.preferences.premium', 'value' => 'PREMIUM'],
|
|
['label' => 'settings.preferences.prepaid', 'value' => 'PREPAID'],
|
|
['label' => 'settings.preferences.free', 'value' => 'FREE'],
|
|
['label' => 'settings.preferences.dedicated', 'value' => 'DEDICATED'],
|
|
],
|
|
'default' => 'FREE',
|
|
],
|
|
[
|
|
'key' => 'url',
|
|
'type' => 'text',
|
|
'label' => 'settings.exchange_rate.url',
|
|
'visible_when' => ['type' => 'DEDICATED'],
|
|
],
|
|
],
|
|
]);
|
|
|
|
Registry::registerExchangeRateDriver('currency_freak', [
|
|
'class' => CurrencyFreakDriver::class,
|
|
'label' => 'settings.exchange_rate.currency_freak',
|
|
'website' => 'https://currencyfreaks.com',
|
|
]);
|
|
|
|
Registry::registerExchangeRateDriver('currency_layer', [
|
|
'class' => CurrencyLayerDriver::class,
|
|
'label' => 'settings.exchange_rate.currency_layer',
|
|
'website' => 'https://currencylayer.com',
|
|
]);
|
|
|
|
Registry::registerExchangeRateDriver('open_exchange_rate', [
|
|
'class' => OpenExchangeRateDriver::class,
|
|
'label' => 'settings.exchange_rate.open_exchange_rate',
|
|
'website' => 'https://openexchangerates.org',
|
|
]);
|
|
}
|
|
}
|