Update: 2026-05-05 00:01:17
This commit is contained in:
25
app/modules_app/subscriptions/current.php
Normal file
25
app/modules_app/subscriptions/current.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* Get Current Tenant Subscription & Usage
|
||||
* GET /api/v1/subscriptions/current
|
||||
*/
|
||||
|
||||
use App\Middleware\AuthMiddleware;
|
||||
use App\Middleware\QuotaMiddleware;
|
||||
|
||||
$decoded = AuthMiddleware::check();
|
||||
$tenantId = $decoded['tenant_id'];
|
||||
|
||||
try {
|
||||
$usage = QuotaMiddleware::getUsageSummary($tenantId);
|
||||
|
||||
if (!$usage['has_subscription']) {
|
||||
json_error('لم يتم العثور على اشتراك نشط لهذا المكتب.', 404);
|
||||
}
|
||||
|
||||
json_success($usage, 'تفاصيل الاشتراك الحالي');
|
||||
|
||||
} catch (\Exception $e) {
|
||||
error_log("Subscription Current Error: " . $e->getMessage());
|
||||
json_error('حدث خطأ أثناء جلب بيانات الاشتراك', 500);
|
||||
}
|
||||
Reference in New Issue
Block a user