feat(admin): improve payments and server settings

This commit is contained in:
baodev0
2026-10-19 07:59:23 +07:00
parent 9ed77a85fd
commit ea9a53f742
32 changed files with 680 additions and 78 deletions
@@ -20,6 +20,7 @@ use App\Services\Api\Order\OrderQueryService;
use App\Services\Api\Order\OrderService;
use App\Services\InvoicePaymentService;
use App\Services\InvoicePdfService;
use App\Services\AdminPaymentNotifier;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -32,6 +33,7 @@ class OrderControllerRefactor extends Controller
private readonly OrderQueryService $orderQueryService,
private readonly ActivityLogger $activityLogger,
private readonly InvoicePaymentService $invoicePaymentService,
private readonly AdminPaymentNotifier $adminPaymentNotifier,
) {}
public function getList(Request $request): JsonResponse
@@ -234,6 +236,7 @@ class OrderControllerRefactor extends Controller
]);
try {
$amountPaidBefore = (int) $invoice->amount_paid;
$paidInvoice = $this->invoicePaymentService->payWithBalance(
$invoice,
$request->user(),
@@ -250,6 +253,11 @@ class OrderControllerRefactor extends Controller
);
$outstanding = \App\Services\InvoicePaymentService::outstanding($paidInvoice);
$this->adminPaymentNotifier->notify(
$paidInvoice,
(int) $paidInvoice->amount_paid - $amountPaidBefore,
'invoice',
);
return response()->json([
'success' => true,