From e21de9e02c80787ba21f57f80cd1d923ea7acf94 Mon Sep 17 00:00:00 2001 From: Test User Date: Thu, 23 Apr 2026 23:24:04 +0000 Subject: [PATCH] fix(GRO-876): add partial refund validation and fix modal indentation --- apps/web/src/pages/Invoices.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/web/src/pages/Invoices.tsx b/apps/web/src/pages/Invoices.tsx index a3164b6..246a9be 100644 --- a/apps/web/src/pages/Invoices.tsx +++ b/apps/web/src/pages/Invoices.tsx @@ -530,6 +530,14 @@ const [showRefundDialog, setShowRefundDialog] = useState(false); setRefunding(true); setRefundError(null); try { + if (refundType === "partial") { + const parsed = parseFloat(refundAmount); + if (isNaN(parsed) || parsed <= 0) { + setRefundError("Please enter a valid amount greater than zero."); + setRefunding(false); + return; + } + } const body = refundType === "partial" ? { amountCents: Math.round(parseFloat(refundAmount) * 100) } : {}; const res = await fetch(`/api/invoices/${invoice.id}/refund`, { method: "POST", @@ -557,8 +565,7 @@ const [showRefundDialog, setShowRefundDialog] = useState(false); )} - - + ); }