دليل التكاملات السعودية

منصة Sakeenah تستخدم design pattern واحد لكل تكامل: Contract + Adapter. كل تكامل له interface واضحة + mock adapter يعمل في dev بدون credentials.

المبدأ المعماري

// 1. Contract — interface واضحة لكل integration
interface IdentityProvider {
    public function requestAuth(string $nationalId): array;
    public function status(string $requestId): array;
}

// 2. Mock — يعمل في dev (لا credentials لازمة)
class MockNafath implements IdentityProvider { ... }

// 3. Production — يُبنى عند الجاهزية
class NafathAdapter implements IdentityProvider { ... }

// 4. Binding يتم تلقائياً في AppServiceProvider
// حسب config('sakeenah.integrations.identity.driver')

كيف ترفع تكاملاً من mock إلى production

  1. ابنِ كلاس جديد في app/Integrations/Production/ يطبّق الـ contract
  2. أضف اسم الكلاس إلى Registry::all() في حقل production_class
  3. ضع credentials الموزود في .env (مثلاً NAFATH_API_KEY=...)
  4. غيّر driver=production في .env (مثلاً NAFATH_DRIVER=production)
  5. أعد تشغيل الخدمة — الـ container binding يتغير تلقائياً
لا تحتاج تغيير أي controller أو service Type-hinting الـ contract كافٍ — Laravel يحقن الـ implementation الصحيح.

التكاملات المتاحة (8)

Integration Vendor السعودي Phase Status
الهوية الوطنية
تفاصيل ←
Nafath (نفاذ) — ELM P1 mock
الدفع المحلي
تفاصيل ←
Mada · STC Pay · Tap · HyperPay · Moyasar P1 mock
SMS + OTP
تفاصيل ←
Unifonic (يونيفونك) P1 mock
مطالبات التأمين
تفاصيل ←
NPHIES — CCHI P1 mock
خط الأزمات (نجاة)
تفاصيل ←
Najat 920033360 · MOH 937 · 911 P2 mock
دليل المعالجين المعتمدين
تفاصيل ←
SCFHS (الهيئة السعودية للتخصصات الصحية) P2 mock
الفيديو الطبي
تفاصيل ←
Sehhaty Telemedicine · Cura · Altibbi P2 mock
الوصفات الإلكترونية
تفاصيل ←
Wasfaty (وصفتي) — MOH P2 mock

مثال: استخدام تكامل في أي service

// In your controller or service
use App\Integrations\Contracts\IdentityProvider;

class SignupController {
    public function __construct(
        private readonly IdentityProvider $identity,
    ) {}

    public function verifyWithNafath(Request $req) {
        $result = $this->identity->requestAuth($req->national_id);
        return $result; // {request_id, deep_link, qr_url, expires_at}
    }
}

قواعد التكامل السعودي

موافقات لازمة لـ Production قبل الإنتاج: ترخيص SCFHS · امتثال PDPL · SDAIA AI ethics review · CCHI integration agreement (للتأمين) · MOH partnership (للـ Sehhaty/Wasfaty).