Update: 2026-05-07 03:06:15
This commit is contained in:
35
app/modules_app/payments/my_requests.php
Normal file
35
app/modules_app/payments/my_requests.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* My Payment Requests (Admin/Accountant)
|
||||
* GET /api/v1/payments/my-requests
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use App\Core\Database;
|
||||
use App\Middleware\AuthMiddleware;
|
||||
|
||||
$decoded = AuthMiddleware::check();
|
||||
$tenantId = $decoded['tenant_id'];
|
||||
|
||||
$db = Database::getInstance();
|
||||
|
||||
try {
|
||||
$stmt = $db->prepare("
|
||||
SELECT pr.id, pr.plan_id, pr.amount_jod, pr.reference_number, pr.cliq_alias,
|
||||
pr.status, pr.ai_match_score, pr.created_at, pr.verified_at,
|
||||
sp.name_ar AS plan_name
|
||||
FROM payment_requests pr
|
||||
LEFT JOIN subscription_plans sp ON pr.plan_id = sp.id
|
||||
WHERE pr.tenant_id = ?
|
||||
ORDER BY pr.created_at DESC
|
||||
");
|
||||
$stmt->execute([$tenantId]);
|
||||
$requests = $stmt->fetchAll();
|
||||
|
||||
json_success($requests, 'طلبات الدفع الخاصة بك');
|
||||
|
||||
} catch (\Exception $e) {
|
||||
error_log("My Payment Requests Error: " . $e->getMessage());
|
||||
json_error('حدث خطأ أثناء جلب طلبات الدفع.', 500);
|
||||
}
|
||||
Reference in New Issue
Block a user