MSIN-4412 Enhance transaction resume feature in registration management with detailed PayPal refund information

This commit improves the transaction resume functionality by adding detailed PayPal refund information to the transaction summary. The changes include a refined SQL query to retrieve complete command details and the integration of a new section displaying PayPal capture details if available. This enhancement provides users with a comprehensive view of their transactions, including refunds, directly within the management interface, thereby improving usability and transparency.
This commit is contained in:
2026-06-29 11:24:02 -04:00
parent b5daa5a4ba
commit 028a9af4aa

View File

@ -151,18 +151,27 @@ switch ($strAction) {
break;
case 'transaction_resume':
// Resume de la transaction (meme rendu que facture.php cote promoteur), affichable
// a tout moment depuis la barre Gestion via un panneau repliable independant.
// Resume de la transaction (meme rendu que facture.php cote promoteur) + detail des
// remboursements PayPal, affichable a tout moment via le panneau repliable de la barre Gestion.
$strNoPanier = trim((string)($_REQUEST['no_panier'] ?? ''));
if ($strNoPanier === '') {
$tabRetour = array('state' => 'error', 'message' => 'no_panier_manquant');
break;
}
// L'eve_id fait foi cote serveur : on le derive de la commande (jamais du client).
$intEveId = intval($objDatabase->fxGetVar(
"SELECT eve_id FROM inscriptions_panier_acheteurs WHERE no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "' LIMIT 1"
));
// Commande complete (meme source que refund_form / Super Admin) : alimente fxRefundComputeContext.
$sqlCmd = "SELECT *, IF(a.com_id <> 0, (SELECT c.com_login FROM inscriptions_comptes c WHERE a.com_id = c.com_id), '') AS usager"
. " FROM inscriptions_panier_acheteurs a, inscriptions_panier_statuts s"
. " WHERE s.sta_id = a.sta_id AND a.no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "'";
$recCommandes = $objDatabase->fxGetRow($sqlCmd);
if (!$recCommandes) {
$tabRetour = array('state' => 'error', 'message' => 'commande_introuvable');
break;
}
// L'eve_id fait foi cote serveur (jamais le client). Acces = acces a la fiche :
// qui peut voir la transaction peut voir ses remboursements (decision produit).
$intEveId = intval($recCommandes['eve_id']);
if ($intEveId <= 0 || !fxInscrGestionCanAccess($intComId, $intEveId)) {
$tabRetour = array('state' => 'error', 'message' => 'unauthorized');
break;
@ -171,11 +180,23 @@ switch ($strAction) {
require_once $_SERVER['DOCUMENT_ROOT'] . '/php/inc_fx_panier.php';
$strResume = fxShowPanier($strNoPanier, 0, 'web', 1, $strLangue);
// Detail des remboursements PayPal (meme rendu que Super Admin). N'apparait que
// s'il existe une capture PayPal exploitable ; sinon rien (les cas gratuits/non-PayPal
// sont deja couverts par la facture ci-dessus).
$strRefunds = '';
require_once $_SERVER['DOCUMENT_ROOT'] . '/superadm/php/inc_fx_paypal.php';
$arrRefundCtx = fxRefundComputeContext($recCommandes);
if (!empty($arrRefundCtx['ok'])) {
$strRefunds = '<div style="margin-top:14px;border-top:1px solid #cfe0ff;padding-top:12px;">'
. renderPayPalCaptureHtml($arrRefundCtx['paypaldetails'])
. '</div>';
}
// Conteneur encadre (sans bascule interne : le bouton de la barre Gestion fait office de toggle).
$strHtml =
'<div class="ms1-transaction-resume"'
. ' style="border:1px solid #2d6cdf;border-radius:10px;background:#f4f7fc;overflow:hidden;box-shadow:0 1px 4px rgba(0,0,0,.12);">'
. '<div style="padding:14px;">' . $strResume . '</div>'
. '<div style="padding:14px;">' . $strResume . $strRefunds . '</div>'
. '</div>';
$tabRetour = array('state' => 'ok', 'html' => $strHtml);