<?php
require 'db.php';
require 'helpers.php';
require_committee();

if (!isset($_GET['id']) || !isset($_GET['student_id'])) {
    die('Invalid request');
}

$payment_id = (int)$_GET['id'];
$student_id = $_GET['student_id'];

// Soft delete payment
$stmt = $mysqli1->prepare("UPDATE payments SET deleted_at = NOW() WHERE id = ?");
$stmt->bind_param("i", $payment_id);

if ($stmt->execute()) {
    header('Location: committee_student_profile.php?student_id=' . urlencode($student_id) . '&success=1');
} else {
    die('Error deleting payment: ' . $mysqli1->error);
}