<?php
require_once '../includes/config.php';
$db = getDB();

$paymentID = $_GET['paymentID'] ?? '';
$status    = $_GET['status']    ?? '';
$ref       = $_GET['merchantInvoiceNumber'] ?? '';

$siteUrl = getSetting('site_url') ?: 'https://p1.enotice.top/telecom';

if ($status !== 'success' || !$paymentID) {
    header("Location: {$siteUrl}/deposit.php?bkash=failed");
    exit;
}

// Redirect to deposit page with payment ID for execution
header("Location: {$siteUrl}/deposit.php?bkash=execute&paymentID=".urlencode($paymentID)."&ref=".urlencode($ref));
exit;
