الدفع المحلي

Mada · STC Pay · Tap · HyperPay · Moyasar · المرحلة 1

الحالة الحالية: Mock (development) بطاقة مدى + محفظة STC Pay + Apple Pay عبر acquirer سعودي.

المواصفات

ContractApp\Integrations\Contracts\PaymentGateway
Mock adapterApp\Integrations\Mock\MockMadaGateway
Production adapter (مخطط)App\Integrations\Production\TapPaymentsAdapter
Driver keyconfig('safw.integrations.payment.driver')
الوثائق الرسميةhttps://www.tap.company/docs

الميزات المعتمدة عليه

الاستخدام في الـ 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

  1. اطلب credentials من الموزود الرسمي
    تواصل مع: Mada · STC Pay · Tap · HyperPay · Moyasar
  2. ابنِ 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(...)
    }
  3. ضع credentials في .env
    PAYMENT_DRIVER=production
    PAYMENT_API_KEY=your_real_key_here
  4. اختبر — كتب feature test يستخدم mock أولاً، ثم integration test على staging
  5. أعد تشغيلphp artisan config:clear

موافقات + Compliance

المتعلق