Refactor process_payment_record into reusable payment_processor.php helper

Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-10-29 01:42:24 +00:00
parent c9e5e6d18a
commit 4e73997a4b
4 changed files with 196 additions and 187 deletions

View file

@ -169,16 +169,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && !empty($_POST['create_free_for']))
file_put_contents($fname, json_encode($rec, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES));
// If available, process the payment record immediately so webhooks logic runs during creation
$ps = __DIR__ . '/payment_success.php';
if (is_file($ps)) {
try {
require_once($ps);
require_once(__DIR__ . '/includes/payment_processor.php');
try {
if (function_exists('process_payment_record')) {
process_payment_record($rec);
}
} catch (Exception $e) {
} catch (Exception $e) {
error_log('[cart create_free] process_payment_record failed: ' . $e->getMessage());
}
}
header('Location: return.php?invoice=' . urlencode($rec['invoice']));