✨ جديد في v23 — انقر للانتقال
🎤 Voice API 💳 SDPay 🎉 Welcome Screen 🔌 Provider Auto-Integration 📈 VoiceGrowth Engine
v23 Production — sudanna.ai/

🇸🇩 سودانا — بوابة المطورين

AI Brain · Telemedicine · StepController · Subscription Engine

Designed for national-scale deployment · Government integration · NGO & institutional usage

Get API Key →

🟢 حالة النظام اللحظية

جاري تحميل حالة النظام...

🧪 Live Execution Trace — Real Example

Actual execution path for: "عندي ألم في الصدر"

REQUEST
POST /api/visitor_ask.php
Content-Type: application/json

{
  "question": "عندي ألم في الصدر"
}
EXECUTION TRACE
Gateway::handle()
  → revenueGate(plan_key=free)    ✅
  → IE(988+ قاعدة) → conf≥0.72     (no direct answer)
  → detectService: medical         ✅
  → PDE: REAL + mandatory          ⛔
  → HARD GATE triggered
  → tryStartFlow(medical_tele_v1)  ✅
  → StepController.start()
  → flow_session created (DB)
  → createMedicalCase() pending
DB WRITES
INSERT → flow_sessions
  session_id: abc123...
  flow_id: medical_telemedicine_v1
  status: active
  current_step: intake_symptoms

(after triage)
INSERT → medical_records
  user_id, symptoms, triage_level
  specialization, session_id
RESPONSE
{
  "success": true,
  "source": "flow",
  "blocked_ai": true,
  "medical_context": true,
  "flow": {
    "session_id": "abc123...",
    "step": "intake_symptoms",
    "progress": {
      "current": 1,
      "total": 7,
      "pct": 14
    }
  }
}
⛔ blocked_ai: true — Gateway never called AIClient for this request. StepController has full control. No AI answer was served or possible.
This is a real execution path from Sudanna Engine v23 — not a mock or simulation.

📊 إحصائيات اليوم

🗄️ حالة الجداول

📊 مخطط التدفق المرئي

User Symptoms Intake Step 1-2 Triage AI + PDE Specialty Router Provider Verified Booking ✅ Done Step 1 Step 2-3 Hard Gate Step 4-5 Step 6 Step 7 🚨 طوارئ → 999

💳 Payment Flow + Engine Cascade

🏗️ System Architecture

1. Client → AI → Bank Flow

Client AI Layer Risk+Fraud+Limits Orchestrator D→P→C→T→G Bank Adapter NO_CUSTODY Bank Core Source of Truth FinancialAgent Ledger+Receipt EventBus →Queue→Worker webhook

2. Payment Flow — Dual (Offline + Gateway)

Invoice Created (reference_code UNIQUE)
         │
    ┌────┴────┐
    │         │
OFFLINE    GATEWAY
    │         │
Transfer   Gateway
Bank Proof  Webhook
    │         │
Admin       Signature
Review       Verify
    │         │
    └────┬────┘
         │
FinancialAgent::confirmPayment()
  ├── 4 Ledger entries (DEBIT=CREDIT)
  ├── Wallet balance updated
  ├── Receipt generated (RCP-YYYYMMDD-NNNNNN)
  └── Email → finance@sudanna.ai
         │
EventBus("payment.confirmed")
  └── Queue → Worker → TaskEngine
        ├── notification to user
        └── kpi_daily updated

3. Decision Gate — AI Pipeline

Request (amount + user_id)
    │
    ├── RiskEngine.assess()     → risk_level: low/medium/high/critical
    ├── FraudGraph.check()      → is_fraud: true/false
    ├── SmartLimits.check()     → allowed: true/false
    └── CashFlowEngine.canAfford() → can_afford: true/false
                │
    MOST RESTRICTIVE WINS
                │
    ┌───────────┴───────────┐
  BLOCK                  ALLOW
(403)                  (200)
                          │
                    Execute Service

4. Reconciliation — Bank ↔ System ↔ Ledger

Daily at 2:30 AM (cron)
        │
ReconciliationEngine::run(date)
  ├── System: SELECT paid invoices WHERE DATE=?
  ├── Ledger: SUM(debit), SUM(credit) WHERE DATE=?
  └── Bank: BankAdapter::getStatement(from, to)
        │
  ┌─────┴─────┐
PASS         FAIL
  │           │
  ├── Log     ├── Alert Admin (notification)
  │           ├── BLOCK all payouts for date
  │           └── Log audit_logs (immutable)
  │
Settlement ALLOWED (3:00 AM)
  └── SettlementEngine::processDate(date)
        ├── ReconciliationEngine::isPassed(date) → GATE
        ├── provider_earnings WHERE status=pending
        ├── BankAdapter::initiatePayout()
        └── Ledger: DEBIT Provider(2002) CREDIT Cash(1001)

5. Accounting — Double-Entry Ledger

Payment Received (1000 SDG):
  DEBIT  Cash(1001)           1000  ← money enters
  CREDIT UserLiability(2001)  1000  ← owed to user
  DEBIT  UserLiability(2001)  1000  ← settling
  CREDIT UserWallet(1002)     1000  ← wallet funded
  ─────────────────────────────────
  SUM(debit) = 2000 = SUM(credit) ✅

Settlement Payout (900 SDG to provider):
  DEBIT  ProviderLiability(2002) 900 ← paying out
  CREDIT Cash(1001)              900 ← money leaves
  ─────────────────────────────────
  BALANCED ✅ — Sudanna never holds

6. Revenue Streams — All Through Ledger

Stream              Rate    Ledger Account    Trigger
────────────────────────────────────────────────────
Service Commission  10%     Revenue(4001)     booking.completed
Payment Fee         0.5%    Revenue(4001)     payment.confirmed
Subscription        Fixed   Revenue(4002)     subscription.paid
API Usage           /call   Revenue(4002)     api_engine.used
Provider Listing    Fixed   Revenue(4001)     listing_boost

ALL revenue:
  ✔ goes through ledger
  ✔ linked to invoice_id
  ✔ reconciled with bank
  ✔ auditable (trace_id)

7. Production API Endpoints

Endpoint MethodSLAAuthPurpose
/api/decision/check POST<100msSessionAI decision gate
/api/cashflow/summary GET<200msSessionSpending analysis
/api/limits/check POST<50msSessionLimit validation
/api/fraud/check POST<100msSessionFraud detection
/api/payment/webhook POST<2sHMACGateway webhook
/api/payment/status GET<200msPublicPayment status
/api/reconcile/run POST<5minAdminTrigger reconcile
/api/payout/process POST<30sAdminTrigger settlement

8. System Principles + SLA

Principle          Definition
──────────────────────────────────────────────────────
NO_CUSTODY         Sudanna never holds money (shadow ledger only)
DEBIT_ONLY         No credit/loans ever extended
BANK_SOURCE        Bank statement wins on any mismatch
IDEMPOTENT         Every operation safe to retry
EVENT_DRIVEN       All state changes via EventBus
AI_CONTROLLED      AI gates every payment decision
AUDITABLE          trace_id on every action, immutable logs

SLA
──────────────────────────────────────────────────────
Decision check     < 100ms
Webhook confirm    < 2s
Full payment       < 5s
Email dispatch     < 10s
Reconciliation     < 5min (daily)
Settlement         after reconciliation PASS
🤖

مساعد مطور سودانا

Local · No API
مرحباً بالمطور 👋 أنا مساعدك الذكي لفهم منصة سودانا.
بدء flow طبي Hard Gate listing_boost blocked_ai

🔌 ربط API خدمتك

Gemini يحلل API تلقائياً — بعد موافقة الإدارة تُفعَّل خدمتك فوراً

Gemini يحلل ← Admin يراجع ← تُفعَّل خدمتك ⚡

بعد الموافقة تلقائياً:✅ قواعد IE جديدة في المساعد الذكي والصوتي
✅ إعلان ترحيبي على Facebook + Telegram
✅ Q&A تُحقن في InferenceEngine + VoiceGrowthEngine
✅ عقد + عمولة + تسويات مالية