<?php
require_once __DIR__.'/../../config.php';
require_once __DIR__ . '/../../engine/Kernel.php';
require_once __DIR__.'/../../engine/Logger.php';
require_once __DIR__.'/../../engine/ServicePaymentEngine.php';
$ctx = Kernel::handle(['auth' => true]);
$u   = $ctx['user'];
$limit = min((int)($_GET['limit']??20),50);
$history = ServicePaymentEngine::getUserServiceHistory((int)$u['id'], $limit);
echo json_encode(['ok'=>true,'data'=>$history], JSON_UNESCAPED_UNICODE);
