From c5af6c1fa614a312dd624f1999064ca6b56ad4e5 Mon Sep 17 00:00:00 2001 From: Gitead Date: Wed, 6 May 2026 20:43:45 -0400 Subject: [PATCH] fix: revert payment amount when switching away from Paid in Full MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Switching from PAID to Pending/Partially Paid now calls revert-full-claim first to undo the collected amount, then updates the status — so the report totals stay accurate. Co-Authored-By: Claude Sonnet 4.6 --- .../components/payments/payments-recent-table.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/apps/Frontend/src/components/payments/payments-recent-table.tsx b/apps/Frontend/src/components/payments/payments-recent-table.tsx index d8541cdd..1fc43ac8 100755 --- a/apps/Frontend/src/components/payments/payments-recent-table.tsx +++ b/apps/Frontend/src/components/payments/payments-recent-table.tsx @@ -724,6 +724,19 @@ export default function PaymentsRecentTable({ const val = e.target.value as PaymentStatus; if (val === "PAID") { handlePayAbsoluteFullDue(payment.id); + } else if (payment.status === "PAID") { + // revert the full payment amount, then set the new status + fullPaymentMutation.mutate( + { paymentId: payment.id, type: "revert" }, + { + onSuccess: () => { + updatePaymentStatusMutation.mutate({ + paymentId: payment.id, + status: val, + }); + }, + } + ); } else { updatePaymentStatusMutation.mutate({ paymentId: payment.id,