From 947d00a9f13cbe146f7fc7b1b6fdbd4de96e0715 Mon Sep 17 00:00:00 2001 From: Darko Gjorgjijoski Date: Sat, 11 Apr 2026 11:30:00 +0200 Subject: [PATCH] =?UTF-8?q?refactor(services):=20Documents=E2=86=92Documen?= =?UTF-8?q?t=20+=20ExchangeRate=E2=86=92Integrations/ExchangeRate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- app/Http/Controllers/Admin/CurrenciesController.php | 2 +- .../Controllers/Company/Estimate/EstimatesController.php | 2 +- .../ExchangeRate/ExchangeRateProviderController.php | 2 +- .../Controllers/Company/Expense/ExpensesController.php | 2 +- .../Company/General/SerialNumberController.php | 2 +- .../Controllers/Company/Invoice/InvoicesController.php | 2 +- .../Controllers/Company/Payment/PaymentsController.php | 2 +- .../RecurringInvoice/RecurringInvoiceController.php | 2 +- app/Http/Controllers/Pdf/DocumentPdfController.php | 4 ++-- app/Models/Estimate.php | 2 +- app/Models/Invoice.php | 2 +- app/Models/Payment.php | 2 +- app/Providers/DriverRegistryProvider.php | 8 ++++---- app/Services/{Documents => Document}/CurrencyService.php | 2 +- .../{Documents => Document}/DocumentItemService.php | 2 +- app/Services/{Documents => Document}/EstimateService.php | 2 +- app/Services/{Documents => Document}/ExpenseService.php | 2 +- app/Services/{Documents => Document}/InvoiceService.php | 2 +- app/Services/{Documents => Document}/PaymentService.php | 2 +- .../{Documents => Document}/RecurringInvoiceService.php | 2 +- .../{Documents => Document}/SerialNumberService.php | 2 +- .../{Documents => Document}/TransactionService.php | 2 +- .../ExchangeRate/CurrencyConverterDriver.php | 2 +- .../ExchangeRate/CurrencyFreakDriver.php | 2 +- .../ExchangeRate/CurrencyLayerDriver.php | 2 +- .../ExchangeRate/ExchangeRateDriver.php | 2 +- .../ExchangeRate/ExchangeRateDriverFactory.php | 2 +- .../ExchangeRate/ExchangeRateException.php | 2 +- .../ExchangeRate/ExchangeRateProviderService.php | 6 +++--- .../ExchangeRate/OpenExchangeRateDriver.php | 2 +- database/factories/EstimateFactory.php | 2 +- database/factories/InvoiceFactory.php | 2 +- database/factories/PaymentFactory.php | 2 +- routes/console.php | 2 +- tests/Unit/EstimateTest.php | 4 ++-- tests/Unit/ExchangeRateDriverFactoryTest.php | 6 +++--- tests/Unit/InvoiceTest.php | 4 ++-- 37 files changed, 47 insertions(+), 47 deletions(-) rename app/Services/{Documents => Document}/CurrencyService.php (95%) rename app/Services/{Documents => Document}/DocumentItemService.php (98%) rename app/Services/{Documents => Document}/EstimateService.php (99%) rename app/Services/{Documents => Document}/ExpenseService.php (98%) rename app/Services/{Documents => Document}/InvoiceService.php (99%) rename app/Services/{Documents => Document}/PaymentService.php (99%) rename app/Services/{Documents => Document}/RecurringInvoiceService.php (99%) rename app/Services/{Documents => Document}/SerialNumberService.php (99%) rename app/Services/{Documents => Document}/TransactionService.php (95%) rename app/Services/{ => Integrations}/ExchangeRate/CurrencyConverterDriver.php (97%) rename app/Services/{ => Integrations}/ExchangeRate/CurrencyFreakDriver.php (97%) rename app/Services/{ => Integrations}/ExchangeRate/CurrencyLayerDriver.php (97%) rename app/Services/{ => Integrations}/ExchangeRate/ExchangeRateDriver.php (94%) rename app/Services/{ => Integrations}/ExchangeRate/ExchangeRateDriverFactory.php (98%) rename app/Services/{ => Integrations}/ExchangeRate/ExchangeRateException.php (81%) rename app/Services/{ => Integrations}/ExchangeRate/ExchangeRateProviderService.php (95%) rename app/Services/{ => Integrations}/ExchangeRate/OpenExchangeRateDriver.php (96%) diff --git a/app/Http/Controllers/Admin/CurrenciesController.php b/app/Http/Controllers/Admin/CurrenciesController.php index 5d3ed760..00c8a051 100644 --- a/app/Http/Controllers/Admin/CurrenciesController.php +++ b/app/Http/Controllers/Admin/CurrenciesController.php @@ -4,7 +4,7 @@ namespace App\Http\Controllers\Admin; use App\Http\Controllers\Controller; use App\Http\Resources\CurrencyResource; -use App\Services\Documents\CurrencyService; +use App\Services\Document\CurrencyService; use Illuminate\Http\Request; use Illuminate\Http\Resources\Json\AnonymousResourceCollection; diff --git a/app/Http/Controllers/Company/Estimate/EstimatesController.php b/app/Http/Controllers/Company/Estimate/EstimatesController.php index cf26d882..5ac5a3f7 100644 --- a/app/Http/Controllers/Company/Estimate/EstimatesController.php +++ b/app/Http/Controllers/Company/Estimate/EstimatesController.php @@ -11,7 +11,7 @@ use App\Http\Resources\InvoiceResource; use App\Jobs\GenerateEstimatePdfJob; use App\Models\Estimate; use App\Models\Invoice; -use App\Services\Documents\EstimateService; +use App\Services\Document\EstimateService; use Illuminate\Http\Request; use Illuminate\Mail\Markdown; diff --git a/app/Http/Controllers/Company/ExchangeRate/ExchangeRateProviderController.php b/app/Http/Controllers/Company/ExchangeRate/ExchangeRateProviderController.php index c55ca669..436c3e4d 100644 --- a/app/Http/Controllers/Company/ExchangeRate/ExchangeRateProviderController.php +++ b/app/Http/Controllers/Company/ExchangeRate/ExchangeRateProviderController.php @@ -14,7 +14,7 @@ use App\Models\ExchangeRateProvider; use App\Models\Invoice; use App\Models\Payment; use App\Models\Tax; -use App\Services\ExchangeRate\ExchangeRateProviderService; +use App\Services\Integrations\ExchangeRate\ExchangeRateProviderService; use Illuminate\Http\Request; use Illuminate\Http\Response; use Illuminate\Support\Arr; diff --git a/app/Http/Controllers/Company/Expense/ExpensesController.php b/app/Http/Controllers/Company/Expense/ExpensesController.php index 27e692da..0a9ca30b 100644 --- a/app/Http/Controllers/Company/Expense/ExpensesController.php +++ b/app/Http/Controllers/Company/Expense/ExpensesController.php @@ -8,7 +8,7 @@ use App\Http\Requests\ExpenseRequest; use App\Http\Requests\UploadExpenseReceiptRequest; use App\Http\Resources\ExpenseResource; use App\Models\Expense; -use App\Services\Documents\ExpenseService; +use App\Services\Document\ExpenseService; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; diff --git a/app/Http/Controllers/Company/General/SerialNumberController.php b/app/Http/Controllers/Company/General/SerialNumberController.php index 4731c9a0..61dc98b0 100644 --- a/app/Http/Controllers/Company/General/SerialNumberController.php +++ b/app/Http/Controllers/Company/General/SerialNumberController.php @@ -6,7 +6,7 @@ use App\Http\Controllers\Controller; use App\Models\Estimate; use App\Models\Invoice; use App\Models\Payment; -use App\Services\Documents\SerialNumberService; +use App\Services\Document\SerialNumberService; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; diff --git a/app/Http/Controllers/Company/Invoice/InvoicesController.php b/app/Http/Controllers/Company/Invoice/InvoicesController.php index 51fa9df1..abe48b2a 100644 --- a/app/Http/Controllers/Company/Invoice/InvoicesController.php +++ b/app/Http/Controllers/Company/Invoice/InvoicesController.php @@ -11,7 +11,7 @@ use App\Http\Resources\InvoiceResource; use App\Jobs\GenerateInvoicePdfJob; use App\Models\Estimate; use App\Models\Invoice; -use App\Services\Documents\InvoiceService; +use App\Services\Document\InvoiceService; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; use Illuminate\Mail\Markdown; diff --git a/app/Http/Controllers/Company/Payment/PaymentsController.php b/app/Http/Controllers/Company/Payment/PaymentsController.php index 0ad4b1d3..473ef6ca 100644 --- a/app/Http/Controllers/Company/Payment/PaymentsController.php +++ b/app/Http/Controllers/Company/Payment/PaymentsController.php @@ -8,7 +8,7 @@ use App\Http\Requests\PaymentRequest; use App\Http\Requests\SendPaymentRequest; use App\Http\Resources\PaymentResource; use App\Models\Payment; -use App\Services\Documents\PaymentService; +use App\Services\Document\PaymentService; use Illuminate\Http\Request; use Illuminate\Http\Response; use Illuminate\Mail\Markdown; diff --git a/app/Http/Controllers/Company/RecurringInvoice/RecurringInvoiceController.php b/app/Http/Controllers/Company/RecurringInvoice/RecurringInvoiceController.php index 4aeac0ba..05121b2f 100644 --- a/app/Http/Controllers/Company/RecurringInvoice/RecurringInvoiceController.php +++ b/app/Http/Controllers/Company/RecurringInvoice/RecurringInvoiceController.php @@ -6,7 +6,7 @@ use App\Http\Controllers\Controller; use App\Http\Requests\RecurringInvoiceRequest; use App\Http\Resources\RecurringInvoiceResource; use App\Models\RecurringInvoice; -use App\Services\Documents\RecurringInvoiceService; +use App\Services\Document\RecurringInvoiceService; use Illuminate\Http\Request; use Illuminate\Http\Response; diff --git a/app/Http/Controllers/Pdf/DocumentPdfController.php b/app/Http/Controllers/Pdf/DocumentPdfController.php index c9a44357..4c97ab2d 100644 --- a/app/Http/Controllers/Pdf/DocumentPdfController.php +++ b/app/Http/Controllers/Pdf/DocumentPdfController.php @@ -6,8 +6,8 @@ use App\Http\Controllers\Controller; use App\Models\Estimate; use App\Models\Invoice; use App\Models\Payment; -use App\Services\Documents\EstimateService; -use App\Services\Documents\InvoiceService; +use App\Services\Document\EstimateService; +use App\Services\Document\InvoiceService; use Illuminate\Http\Request; class DocumentPdfController extends Controller diff --git a/app/Models/Estimate.php b/app/Models/Estimate.php index 40c190b7..2b05c54b 100644 --- a/app/Models/Estimate.php +++ b/app/Models/Estimate.php @@ -2,7 +2,7 @@ namespace App\Models; -use App\Services\Documents\EstimateService; +use App\Services\Document\EstimateService; use App\Support\Pdf\PdfHtmlSanitizer; use App\Support\Pdf\PdfTemplateUtils; use App\Traits\GeneratesPdfTrait; diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index a723e1bf..48089932 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -2,7 +2,7 @@ namespace App\Models; -use App\Services\Documents\InvoiceService; +use App\Services\Document\InvoiceService; use App\Support\Pdf\PdfHtmlSanitizer; use App\Support\Pdf\PdfTemplateUtils; use App\Traits\GeneratesPdfTrait; diff --git a/app/Models/Payment.php b/app/Models/Payment.php index 9f716751..30c4aaa9 100644 --- a/app/Models/Payment.php +++ b/app/Models/Payment.php @@ -3,7 +3,7 @@ namespace App\Models; use App\Jobs\GeneratePaymentPdfJob; -use App\Services\Documents\PaymentService; +use App\Services\Document\PaymentService; use App\Support\Pdf\PdfHtmlSanitizer; use App\Traits\GeneratesPdfTrait; use App\Traits\HasCustomFieldsTrait; diff --git a/app/Providers/DriverRegistryProvider.php b/app/Providers/DriverRegistryProvider.php index aecc4d8e..dda68f4b 100644 --- a/app/Providers/DriverRegistryProvider.php +++ b/app/Providers/DriverRegistryProvider.php @@ -2,10 +2,10 @@ namespace App\Providers; -use App\Services\ExchangeRate\CurrencyConverterDriver; -use App\Services\ExchangeRate\CurrencyFreakDriver; -use App\Services\ExchangeRate\CurrencyLayerDriver; -use App\Services\ExchangeRate\OpenExchangeRateDriver; +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; diff --git a/app/Services/Documents/CurrencyService.php b/app/Services/Document/CurrencyService.php similarity index 95% rename from app/Services/Documents/CurrencyService.php rename to app/Services/Document/CurrencyService.php index f47e6e22..583e7fd8 100644 --- a/app/Services/Documents/CurrencyService.php +++ b/app/Services/Document/CurrencyService.php @@ -1,6 +1,6 @@