With the introduction of pending payments being created upon invoice approval (see
MODINVOICE-140), adjustments need to be made to accommodate this.
In order to ensure consistency we need to update several running totals upon pending payment transaction within a database transaction. This ensures that either all of the records are updated, or none of them are.
In order to avoid partially approved invoices, we need to apply all awaiting payments for an invoice at once. The approach for this is documented on the wiki (see below). When applying the pending payments we need to make sure that the running totals in related encumbrances, budget and ledger are also updated.
- rename the invoice_transaction_summaries.numEncumbrances field to the invoice_transaction_summaries.numPendingPayments
- upon POST /finance-storage/transactions w/ transaction.type = Pending payment:
- apply all or nothing logic based on the invoice_transaction_summaries.numPendingPayments with following calculations - wiki
- update logic of POST /finance-storage/transactions w/ transaction.type = Payment/Credit according to wiki
- All or nothing processing for pending payments creation added
- Payment/Credit creation logic updated
- invoice_transaction_summary schema and example are updated
- Unit tests updated