Implement verified curriculum, video review, watch sessions, ledger safeguards, and remove demo data

This commit is contained in:
Hamza-Ayed
2026-09-09 17:04:08 +03:00
parent 0dc5df7b5e
commit 5af684a892
49 changed files with 1809 additions and 3005 deletions
+25 -5
View File
@@ -27,14 +27,14 @@ class CliqPaymentService
public const DEFAULT_BANK_NAME = 'بنك الاتحاد / البنك العربي (الأردن)';
/**
* إنشاء الجداول المخصصة لمدفوعات كليك وطابور السحب تلقائياً إن لم تكن موجودة
* @deprecated Schema is installed through migrations only. This no-op
* prevents legacy callers from running DDL during an HTTP request.
*/
public static function ensureSchema(): void
{
static $ran = false;
if ($ran) return;
$ran = true;
/* Runtime DDL removed; apply 20260909_payment_safety_hold.sql instead. */
return;
/*
try {
// جدول مدفوعات كليك الواردة من الطلاب
Database::query(
@@ -79,6 +79,16 @@ class CliqPaymentService
} catch (\Throwable $e) {
error_log('[CliqPaymentService] ensureSchema warning: ' . $e->getMessage());
}
*/
}
private static function unavailable(string $operation): array
{
return [
'status' => 'unavailable',
'operation' => $operation,
'message' => 'هذه العملية المالية غير متاحة حتى يكتمل ربط مزود الدفع والتسوية الموثقة. لم يتم إنشاء حركة مالية أو تفعيل وصول أو سحب رصيد.',
];
}
/**
@@ -86,6 +96,8 @@ class CliqPaymentService
*/
public static function initiatePayment(int $studentId, int $courseId): array
{
return self::unavailable('initiate_payment');
self::ensureSchema();
$course = Database::selectOne("SELECT id, title, price_jod, teacher_id FROM courses WHERE id = ? LIMIT 1", [$courseId]);
@@ -130,6 +142,8 @@ class CliqPaymentService
string $receiptBase64,
?string $manualTxId = null
): array {
return self::unavailable('submit_receipt');
self::ensureSchema();
$payment = Database::selectOne(
@@ -225,6 +239,8 @@ class CliqPaymentService
*/
public static function requestTeacherPayout(int $teacherId, float $amountJod, string $teacherCliqAlias): array
{
return self::unavailable('request_payout');
self::ensureSchema();
if ($amountJod < 20.00) {
@@ -259,6 +275,8 @@ class CliqPaymentService
*/
public static function processPayoutQueue(): array
{
return self::unavailable('process_payout_queue');
self::ensureSchema();
$queuedItems = Database::select(
@@ -298,6 +316,8 @@ class CliqPaymentService
*/
public static function getTeacherPayouts(int $teacherId): array
{
return [];
self::ensureSchema();
$payouts = Database::select(