fix: revert payment amount when switching away from Paid in Full
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user