<?php
/**
 * بوابة الدفع - إعدادات Stripe، زين كاش، آسيا باي
 */
$config = require __DIR__ . '/../config/config.php';
$pdo = new PDO(
    'mysql:host=' . $config['db']['host'] . ';dbname=' . $config['db']['name'] . ';charset=utf8mb4',
    $config['db']['user'],
    $config['db']['pass'],
    [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]
);

$keys = [
    'payment_gateway' => 'link',
    'stripe_publishable_key' => '',
    'stripe_secret_key' => '',
    'stripe_webhook_secret' => '',
    'zaincash_merchant_id' => '',
    'zaincash_msisdn' => '',
    'zaincash_secret' => '',
    'zaincash_is_production' => '0',
    'asiapay_app_key' => '',
    'asiapay_app_secret' => '',
    'asiapay_merchant_code' => '',
    'asiapay_is_production' => '0'
];

$stmt = $pdo->prepare('INSERT IGNORE INTO settings (setting_key, setting_value) VALUES (?, ?)');
foreach ($keys as $k => $v) {
    try {
        $stmt->execute([$k, $v]);
    } catch (PDOException $e) {}
}

echo "Payment gateway settings added.\n";
