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.
This commit is contained in:
Darko Gjorgjijoski
2026-04-11 11:30:00 +02:00
parent 6d1816bd1b
commit 947d00a9f1
37 changed files with 47 additions and 47 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -1,6 +1,6 @@
<?php
namespace App\Services\Documents;
namespace App\Services\Document;
use App\Models\Currency;
use Illuminate\Database\Eloquent\Collection;

View File

@@ -1,6 +1,6 @@
<?php
namespace App\Services\Documents;
namespace App\Services\Document;
use Illuminate\Database\Eloquent\Model;

View File

@@ -1,6 +1,6 @@
<?php
namespace App\Services\Documents;
namespace App\Services\Document;
use App;
use App\Facades\Hashids;

View File

@@ -1,6 +1,6 @@
<?php
namespace App\Services\Documents;
namespace App\Services\Document;
use App\Models\CompanySetting;
use App\Models\ExchangeRateLog;

View File

@@ -1,6 +1,6 @@
<?php
namespace App\Services\Documents;
namespace App\Services\Document;
use App;
use App\Facades\Hashids;

View File

@@ -1,6 +1,6 @@
<?php
namespace App\Services\Documents;
namespace App\Services\Document;
use App\Facades\Hashids;
use App\Facades\Pdf;

View File

@@ -1,6 +1,6 @@
<?php
namespace App\Services\Documents;
namespace App\Services\Document;
use App\Facades\Hashids;
use App\Http\Requests\RecurringInvoiceRequest;

View File

@@ -1,6 +1,6 @@
<?php
namespace App\Services\Documents;
namespace App\Services\Document;
use App\Models\CompanySetting;
use App\Models\Customer;

View File

@@ -1,6 +1,6 @@
<?php
namespace App\Services\Documents;
namespace App\Services\Document;
use App\Facades\Hashids;
use App\Models\Transaction;

View File

@@ -1,6 +1,6 @@
<?php
namespace App\Services\ExchangeRate;
namespace App\Services\Integrations\ExchangeRate;
use Illuminate\Support\Facades\Http;

View File

@@ -1,6 +1,6 @@
<?php
namespace App\Services\ExchangeRate;
namespace App\Services\Integrations\ExchangeRate;
use Illuminate\Support\Facades\Http;

View File

@@ -1,6 +1,6 @@
<?php
namespace App\Services\ExchangeRate;
namespace App\Services\Integrations\ExchangeRate;
use Illuminate\Support\Facades\Http;

View File

@@ -1,6 +1,6 @@
<?php
namespace App\Services\ExchangeRate;
namespace App\Services\Integrations\ExchangeRate;
abstract class ExchangeRateDriver
{

View File

@@ -1,6 +1,6 @@
<?php
namespace App\Services\ExchangeRate;
namespace App\Services\Integrations\ExchangeRate;
use InvalidArgumentException;
use InvoiceShelf\Modules\Registry;

View File

@@ -1,6 +1,6 @@
<?php
namespace App\Services\ExchangeRate;
namespace App\Services\Integrations\ExchangeRate;
class ExchangeRateException extends \RuntimeException
{

View File

@@ -1,13 +1,13 @@
<?php
namespace App\Services\ExchangeRate;
namespace App\Services\Integrations\ExchangeRate;
use App\Http\Requests\ExchangeRateProviderRequest;
use App\Models\CompanySetting;
use App\Models\ExchangeRateLog;
use App\Models\ExchangeRateProvider;
use App\Services\ExchangeRate\ExchangeRateDriverFactory;
use App\Services\ExchangeRate\ExchangeRateException;
use App\Services\Integrations\ExchangeRate\ExchangeRateDriverFactory;
use App\Services\Integrations\ExchangeRate\ExchangeRateException;
class ExchangeRateProviderService
{

View File

@@ -1,6 +1,6 @@
<?php
namespace App\Services\ExchangeRate;
namespace App\Services\Integrations\ExchangeRate;
use Illuminate\Support\Facades\Http;

View File

@@ -6,7 +6,7 @@ use App\Models\Currency;
use App\Models\Customer;
use App\Models\Estimate;
use App\Models\User;
use App\Services\Documents\SerialNumberService;
use App\Services\Document\SerialNumberService;
use Illuminate\Database\Eloquent\Factories\Factory;
class EstimateFactory extends Factory

View File

@@ -7,7 +7,7 @@ use App\Models\Customer;
use App\Models\Invoice;
use App\Models\RecurringInvoice;
use App\Models\User;
use App\Services\Documents\SerialNumberService;
use App\Services\Document\SerialNumberService;
use Illuminate\Database\Eloquent\Factories\Factory;
class InvoiceFactory extends Factory

View File

@@ -7,7 +7,7 @@ use App\Models\Customer;
use App\Models\Payment;
use App\Models\PaymentMethod;
use App\Models\User;
use App\Services\Documents\SerialNumberService;
use App\Services\Document\SerialNumberService;
use Illuminate\Database\Eloquent\Factories\Factory;
class PaymentFactory extends Factory

View File

@@ -2,7 +2,7 @@
use App\Models\CompanySetting;
use App\Models\RecurringInvoice;
use App\Services\Documents\RecurringInvoiceService;
use App\Services\Document\RecurringInvoiceService;
use App\Support\Setup\InstallUtils;
use Illuminate\Support\Facades\Schedule;

View File

@@ -4,8 +4,8 @@ use App\Http\Requests\EstimatesRequest;
use App\Models\Estimate;
use App\Models\EstimateItem;
use App\Models\Tax;
use App\Services\Documents\DocumentItemService;
use App\Services\Documents\EstimateService;
use App\Services\Document\DocumentItemService;
use App\Services\Document\EstimateService;
use Illuminate\Support\Facades\Artisan;
beforeEach(function () {

View File

@@ -1,8 +1,8 @@
<?php
use App\Services\ExchangeRate\CurrencyFreakDriver;
use App\Services\ExchangeRate\ExchangeRateDriver;
use App\Services\ExchangeRate\ExchangeRateDriverFactory;
use App\Services\Integrations\ExchangeRate\CurrencyFreakDriver;
use App\Services\Integrations\ExchangeRate\ExchangeRateDriver;
use App\Services\Integrations\ExchangeRate\ExchangeRateDriverFactory;
use InvoiceShelf\Modules\Registry;
test('make resolves built-in drivers from the factory map', function () {

View File

@@ -4,8 +4,8 @@ use App\Http\Requests\InvoicesRequest;
use App\Models\Invoice;
use App\Models\InvoiceItem;
use App\Models\Tax;
use App\Services\Documents\DocumentItemService;
use App\Services\Documents\InvoiceService;
use App\Services\Document\DocumentItemService;
use App\Services\Document\InvoiceService;
use Illuminate\Support\Facades\Artisan;
beforeEach(function () {