Billing: refund a payment; void invoices that aren't paid (none, or all refunded)
Void was refused while any payment was recorded, so a paid-then-refunded invoice could only be voided by deleting the payment and losing the record. A payment can now be marked refunded: kept with its receipt, no longer counted as paid, shown on the statement as money going back out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -168,6 +168,13 @@ router.delete('/payments/:id', wrap(async (req, res) => {
|
||||
res.json({ message: `Payment ${payment.receiptNumber} removed.` });
|
||||
}));
|
||||
|
||||
// The money went back to the church (2.0.2): kept on record, no longer counts as paid.
|
||||
router.post('/payments/:id/refund', wrap(async (req, res) => {
|
||||
const payment = await billing.refundPayment(req.params.id, { on: req.body?.on, note: req.body?.note });
|
||||
await audit(req, 'payment_refunded', payment.id, { receipt: payment.receiptNumber, amountCents: payment.amountCents, invoice: payment.invoice?.number || null, note: payment.refundNote });
|
||||
res.json({ message: `Payment ${payment.receiptNumber} marked as refunded.${payment.invoice ? ` ${payment.invoice.number} is owing again; you can void it now.` : ''}` });
|
||||
}));
|
||||
|
||||
router.post('/payments/:id/resend', emailLimiter, wrap(async (req, res) => {
|
||||
await billing.resendReceipt(req.params.id);
|
||||
await audit(req, 'receipt_resent', req.params.id);
|
||||
|
||||
Reference in New Issue
Block a user