دليل التكاملات السعودية
منصة 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
- ابنِ كلاس جديد في
app/Integrations/Production/يطبّق الـ contract - أضف اسم الكلاس إلى
Registry::all()في حقلproduction_class - ضع credentials الموزود في
.env(مثلاًNAFATH_API_KEY=...) - غيّر
driver=productionفي.env(مثلاًNAFATH_DRIVER=production) - أعد تشغيل الخدمة — الـ 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}
}
}
قواعد التكامل السعودي
- الدفع: Mada · STC Pay · Tap · HyperPay (وليس Stripe المباشر)
- الهوية: Nafath عبر ELM (وليس Google/Facebook)
- SMS للأرقام السعودية: Unifonic (CITC requirement — لا Twilio)
- التأمين الصحي: NPHIES (الإلزامي عبر CCHI)
- الوصفات: Wasfaty (MOH)
- الفيديو الطبي: Sehhaty أو Cura أو Altibbi (data residency في السعودية)
- الـ Hosting: AWS me-central-1 (Bahrain) أو STC Cloud
- AI Models: Claude/OpenAI مسموح (لا بديل محلي) — مع DPA + لا تخزين PHI خام في prompts
موافقات لازمة لـ Production
قبل الإنتاج: ترخيص SCFHS · امتثال PDPL · SDAIA AI ethics review · CCHI integration agreement (للتأمين) · MOH partnership (للـ Sehhaty/Wasfaty).