diff --git a/ajax_inscr_gestion.php b/ajax_inscr_gestion.php index 19af69f..08d7820 100644 --- a/ajax_inscr_gestion.php +++ b/ajax_inscr_gestion.php @@ -180,15 +180,15 @@ 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). + // Sommaire des remboursements PayPal (vue compacte, pas la grande table 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 = '
' - . renderPayPalCaptureHtml($arrRefundCtx['paypaldetails']) + . renderPayPalRefundSummaryHtml($arrRefundCtx['paypaldetails']) . '
'; } diff --git a/superadm/php/inc_fx_paypal.php b/superadm/php/inc_fx_paypal.php index bd484f2..a33e67a 100644 --- a/superadm/php/inc_fx_paypal.php +++ b/superadm/php/inc_fx_paypal.php @@ -289,6 +289,125 @@ $html .= '
'; + $html .= '
Remboursements
'; + $html .= '
'; + $cell = static function (string $label, string $value, string $color) use ($h): string { + return '
' + . '
' . $h($label) . '
' + . '
' . $h($value) . '
' + . '
'; + }; + $html .= $cell('Statut', $statNice ?: '—', '#2d6cdf'); + $html .= $cell('Capturé', $fmtMoney($capTotal), '#333'); + $html .= $cell('Remboursé', $fmtMoney($refTotal), '#c0392b'); + $html .= $cell('Solde', $fmtMoney($remaining), '#1e7e34'); + $html .= '
'; + + // --- Lignes de remboursements (compactes) --- + $statusMapRef = [ + 'S' => 'Effectué', 'COMPLETED' => 'Effectué', + 'P' => 'En attente', 'PENDING' => 'En attente', + 'D' => 'Refusé', 'DENIED' => 'Refusé', 'FAILED' => 'Échoué', + 'V' => 'Annulé', 'VOIDED' => 'Annulé', + 'R' => 'Reversé', 'REVERSED' => 'Reversé', + ]; + if (!empty($refundItems)) { + foreach ($refundItems as $rf) { + $rid = $get($rf, ['refund_id']) ?: $get($rf, ['id']); + $amt = $moneyVal(['value' => $get($rf, ['amount'], 0)]); + $cur = $get($rf, ['currency'], $currency); + $srfRaw = (string)$get($rf, ['status'], ''); + $srf = $statusMapRef[$srfRaw] ?? $srfRaw; + $time = $get($rf, ['create_time']) ?: $get($rf, ['time']); + $html .= '
' + . '' . $h($fmtDate($time, $tz)) . '' + . '' . $h(number_format($amt, 2, '.', '') . ($cur ? ' ' . $cur : '')) . '' + . '' . $h($srf) . '' + . '
'; + } + } + + $html .= '
'; + return $html; +} + function money2($v) { return number_format((float)$v, 2, '.', ''); }