From d6896fa5916b89365d0766e60fd15f4c2e0e479e Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 30 Oct 2025 14:21:41 +0100 Subject: [PATCH] Fix receipt page display issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Issues Fixed: 1. **Better Icon**: Replaced bell icon with leaf/plant icon for carbon offset - More appropriate visual representation 2. **Currency Formatting**: Added thousand separators to all amounts - Added formatCurrency() helper function - Total now shows "$13,414.12" instead of "$13414.12" - Applied to base amount, processing fee, and total 3. **Print Functionality**: Fixed empty page printing - Removed "no-print" class from outer wrapper - Only interactive elements (buttons) hidden when printing - Receipt content now prints properly 4. **Status Display**: Shows "Confirmed" immediately after payment - Uses Stripe session.paymentStatus for just-completed payments - Falls back to order.status for older orders - Prevents showing "Processing" when payment is already complete ## Technical Changes: - CheckoutSuccess.tsx (line 27-32): Added formatCurrency helper - CheckoutSuccess.tsx (line 120-121): Use Stripe payment status - CheckoutSuccess.tsx (line 145): Removed no-print from wrapper - CheckoutSuccess.tsx (line 208-210): Changed to leaf SVG icon - CheckoutSuccess.tsx (lines 228, 234, 241): Use formatCurrency() 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/pages/CheckoutSuccess.tsx | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/pages/CheckoutSuccess.tsx b/src/pages/CheckoutSuccess.tsx index 7d81068..0dcd329 100644 --- a/src/pages/CheckoutSuccess.tsx +++ b/src/pages/CheckoutSuccess.tsx @@ -23,6 +23,14 @@ const getStatusDisplay = (status: string): { label: string; className: string } } }; +// Format currency with commas +const formatCurrency = (amount: number): string => { + return amount.toLocaleString('en-US', { + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }); +}; + export default function CheckoutSuccess({ onNavigateHome, onNavigateCalculator @@ -106,7 +114,11 @@ export default function CheckoutSuccess({ const totalAmount = order.totalAmount / 100; // Convert cents to dollars const baseAmount = order.baseAmount / 100; const processingFee = order.processingFee / 100; - const statusDisplay = getStatusDisplay(order.status); + + // Use Stripe payment status if available (more accurate for just-completed payments) + // Otherwise fall back to order status + const effectiveStatus = session.paymentStatus === 'paid' ? 'paid' : order.status; + const statusDisplay = getStatusDisplay(effectiveStatus); return ( <> @@ -134,7 +146,7 @@ export default function CheckoutSuccess({ } `} -
+
- +
@@ -217,20 +229,20 @@ export default function CheckoutSuccess({
Offset Cost - ${baseAmount.toFixed(2)} + ${formatCurrency(baseAmount)}
Processing Fee (5%) - ${processingFee.toFixed(2)} + ${formatCurrency(processingFee)}
Total Paid - ${totalAmount.toFixed(2)} + ${formatCurrency(totalAmount)}