feat(admin): improve payments and server settings
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user