Merge pull request #41 from GameServerPanel/copilot/fix-error-500-issue

Fix HTTP 500 in PayPal capture endpoint - undefined function and variable
This commit is contained in:
Frank Harris 2025-10-29 19:06:44 -04:00 committed by GitHub
commit f81b425f81
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -10,6 +10,25 @@ $client_secret = 'EJ216np9cAj9n7KSddez3fLVxGe-zi4oKKKl1YGqPp88XIikr4Qzbxh0XW2as-
ini_set('display_errors', '0');
error_reporting(E_ALL);
// Setup comprehensive logging
$logDir = __DIR__ . '/../logs';
@mkdir($logDir, 0755, true);
$logFile = $logDir . '/paypal_capture_order.log';
$requestId = uniqid('req_', true); // Unique request identifier for tracking
function capture_log($label, $data) {
global $logFile, $requestId;
$timestamp = date('Y-m-d H:i:s');
$entry = "[$timestamp] [$requestId] $label\n";
if (is_array($data) || is_object($data)) {
$entry .= print_r($data, true);
} else {
$entry .= (string)$data;
}
$entry .= "\n" . str_repeat('-', 80) . "\n";
@file_put_contents($logFile, $entry, FILE_APPEND | LOCK_EX);
}
header('Content-Type: application/json');
// Read and parse input