<?php
require_once 'config/database.php';
require_once 'includes/zashof.php';

echo "Testing Zashof API with Logging:\n";
echo "===============================\n";

try {
    $zashof = new ZashofPayment();
    
    if (!$zashof->isEnabled()) {
        throw new Exception("Zashof payment gateway is not enabled or properly configured");
    }
    
    // Prepare student info
    $student_info = [
        'student_id' => '12345',
        'name' => 'Test Student',
        'email' => 'test@example.com',
        'phone' => '01712345678'
    ];
    
    // URLs
    $redirect_url = 'http://localhost/fees/zashof_success.php';
    $cancel_url = 'http://localhost/fees/my_fees.php';
    
    // Create charge
    echo "Attempting to create charge...\n";
    $response = $zashof->createCharge(100, $student_info, $redirect_url, $cancel_url);
    
    echo "Response: " . json_encode($response) . "\n";
    
} catch (Exception $e) {
    echo "Exception: " . $e->getMessage() . "\n";
}

echo "\nCheck your PHP error log for debug information.\n";
?>