<?php
/**
 * Update Zashof settings with correct API key
 */
require_once 'config/database.php';

// The correct API key from the requirements
$correct_api_key = '73765654368fafdf094aa6841252168132430908268fafdf094aa82125124609';
$base_url = 'https://pay.zashof.com/api';

try {
    // Update settings with correct values
    $settings = [
        'zashof_enabled' => '1',
        'zashof_api_key' => $correct_api_key,
        'zashof_base_url' => $base_url,
        'zashof_create_charge_url' => $base_url . '/create-charge',
        'zashof_verify_payment_url' => $base_url . '/verify-payments'
    ];
    
    foreach ($settings as $key => $value) {
        $stmt = $pdo->prepare("
            INSERT INTO settings (setting_key, setting_value) 
            VALUES (?, ?) 
            ON DUPLICATE KEY UPDATE setting_value = VALUES(setting_value)
        ");
        $stmt->execute([$key, $value]);
        echo "✓ Updated setting: " . $key . "\n";
    }
    
    echo "\nZashof settings have been updated successfully!\n";
    echo "API Key: " . substr($correct_api_key, 0, 10) . '...' . substr($correct_api_key, -10) . "\n";
    echo "Base URL: " . $base_url . "\n";
    echo "Create Charge URL: " . $base_url . "/create-charge\n";
    echo "Verify Payment URL: " . $base_url . "/verify-payments\n";
    
    echo "\nYou can now test the payment integration.\n";
    
} catch (Exception $e) {
    echo "Error updating settings: " . $e->getMessage() . "\n";
}
?>