fix(billing): add an edit path for recorded payments #246
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/MAPPS-235-payment-edit-path"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
PaymentRow was delete-only and the modal always POSTed, so correcting a mistaken amount or method meant deleting the payment and re-entering it from scratch.
PaymentRow now carries an Edit action that reopens the payment modal seeded from the row. RecordPaymentModal accepts an optional payment_id plus seed values: when the id is set it PUTs to /payments/{id} (titled "Edit Payment", submit "Save Changes"); otherwise it POSTs to /payments as before. RemotePayment now also deserializes company_id and notes so the edit form can be fully seeded.
On the server side (the shared billing module mirrored from mokosh-server) this adds PUT /payments/{payment_id} -> update_payment alongside the existing delete, an UpdatePaymentRequest model, and a service method that rewrites the payment row and reconciles the affected invoice(s). Balances are recomputed from the live payment sum so a changed amount, a moved invoice link, or an unapply all settle correctly, and a payment still cannot be applied to a void/written-off invoice.
#MAPPS-235
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
PaymentRow was delete-only and the modal always POSTed, so correcting a mistaken amount or method meant deleting the payment and re-entering it from scratch. PaymentRow now carries an Edit action that reopens the payment modal seeded from the row. RecordPaymentModal accepts an optional payment_id plus seed values: when the id is set it PUTs to /payments/{id} (titled "Edit Payment", submit "Save Changes"); otherwise it POSTs to /payments as before. RemotePayment now also deserializes company_id and notes so the edit form can be fully seeded. On the server side (the shared billing module mirrored from mokosh-server) this adds PUT /payments/{payment_id} -> update_payment alongside the existing delete, an UpdatePaymentRequest model, and a service method that rewrites the payment row and reconciles the affected invoice(s). Balances are recomputed from the live payment sum so a changed amount, a moved invoice link, or an unapply all settle correctly, and a payment still cannot be applied to a void/written-off invoice. #MAPPS-235 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>6966f9bfadfd464e4568fd464e4568d875d088d5