🧪 Test Cancellation System

📝 Create Test 📅 Calendar 🏠 Booking
"; try { $db = getDatabase(); $pdo = $db->getConnection(); // Get recent appointments with their cancellation tokens $stmt = $pdo->prepare(" SELECT a.booking_id, a.service_id, a.start_datetime, a.end_datetime, a.status, a.cancellation_token, c.first_name, c.last_name, c.email FROM appointments a LEFT JOIN customers c ON a.customer_id = c.id WHERE a.start_datetime >= NOW() AND a.status IN ('CONFIRMED', 'PENDING') ORDER BY a.start_datetime ASC LIMIT 10 "); $stmt->execute(); $appointments = $stmt->fetchAll(); if (empty($appointments)) { echo "
No active appointments found!
Create some test appointments first using the appointment creator.
"; } else { echo "
🎯 Active Appointments for Cancellation Testing
"; foreach ($appointments as $appt) { $date = date('l, F j, Y', strtotime($appt['start_datetime'])); $time = date('H:i', strtotime($appt['start_datetime'])); $client_name = trim($appt['first_name'] . ' ' . $appt['last_name']) ?: 'Anonymous'; echo "
{$appt['booking_id']}
👤 $client_name ({$appt['email']})
📅 $date at $time
🔧 Service: {$appt['service_id']}
Cancellation Token (first 50 chars):
" . substr($appt['cancellation_token'], 0, 50) . "...
"; } echo "
"; } // Test results area echo "
🔬 Test Results

Click on 'Test Cancel via API' buttons above to test the cancellation system.

"; } catch (Exception $e) { echo "

❌ Error

Failed to load test interface: " . htmlspecialchars($e->getMessage()) . "

"; } ?>