الدفع المحلي
Mada · STC Pay · Tap · HyperPay · Moyasar · المرحلة 1
الحالة الحالية:
Mock (development)
بطاقة مدى + محفظة STC Pay + Apple Pay عبر acquirer سعودي.
المواصفات
| Contract | App\Integrations\Contracts\PaymentGateway |
|---|---|
| Mock adapter | App\Integrations\Mock\MockMadaGateway |
| Production adapter (مخطط) | App\Integrations\Production\TapPaymentsAdapter |
| Driver key | config('safw.integrations.payment.driver') |
| الوثائق الرسمية | https://www.tap.company/docs |
الميزات المعتمدة عليه
subscription_billingpay_per_session
الاستخدام في الـ Code
use App\Integrations\Contracts\PaymentGateway;
class MyController {
public function __construct(
private readonly PaymentGateway $service,
) {}
public function action() {
// $this->service يتحقن تلقائياً (mock أو production)
// حسب config('safw.integrations.payment.driver')
}
}
لرفع التكامل إلى Production
-
اطلب credentials من الموزود الرسمي
تواصل مع: Mada · STC Pay · Tap · HyperPay · Moyasar -
ابنِ Production Adapter
// app/Integrations/Production/TapPaymentsAdapter.php namespace App\Integrations\Production; use App\Integrations\Contracts\PaymentGateway; use Illuminate\Support\Facades\Http; class TapPaymentsAdapter implements PaymentGateway { public function __construct( private string $apiKey = config('safw.integrations.payment.api_key'), ) {} // Implement all interface methods using real HTTP calls // Use Laravel's Http::withToken($this->apiKey)->post(...) } -
ضع credentials في .env
PAYMENT_DRIVER=production PAYMENT_API_KEY=your_real_key_here - اختبر — كتب feature test يستخدم mock أولاً، ثم integration test على staging
-
أعد تشغيل —
php artisan config:clear
موافقات + Compliance
- تحقق من شروط الموزود الرسمي (في الـ docs URL أعلاه)
- وثّق DPA (Data Processing Agreement) موقّع
- أضف الموزود إلى قائمة الـ subprocessors المنشورة للمستخدمين
- إذا الموزود يخزّن PHI، تأكد أنه ضمن السعودية (data residency)