🚀 مُصادَق: تحديث برمجي جديد 2026-05-03 14:50
This commit is contained in:
23
app/Modules/Invoices/Actions/SubmitInvoiceAction.php
Normal file
23
app/Modules/Invoices/Actions/SubmitInvoiceAction.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
namespace App\Modules\Invoices\Actions;
|
||||
|
||||
use App\Services\QueueService;
|
||||
use App\Core\Database;
|
||||
use Exception;
|
||||
|
||||
final class SubmitInvoiceAction {
|
||||
public function execute(string $invoiceId, string $tenantId): void {
|
||||
$db = Database::getInstance();
|
||||
$stmt = $db->prepare("SELECT id FROM invoices WHERE id = ? AND tenant_id = ? AND deleted_at IS NULL LIMIT 1");
|
||||
$stmt->execute([$invoiceId, $tenantId]);
|
||||
|
||||
if (!$stmt->fetch()) {
|
||||
throw new Exception('الفاتورة غير موجودة', 404);
|
||||
}
|
||||
|
||||
QueueService::push('submit_jofotara', [
|
||||
'invoice_id' => $invoiceId
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user