Data and states
How can “correction and payment keep own life cycles” be proven in the specific case?
A payment can arrive while a correction is being prepared. M-39 connects all versions of A-39; K-39 remains referenced with content hash in the manifest of each released version.
Starting point Store the command key and normalised input hash with the result.
Assumptions for the example case
Fictitious design for a house, a completed annual period and a contractually specified area key. The application documents released billings and correction versions; the legal examination of individual costs remains with property management. All quantities, thresholds and operational targets are illustrative assumptions. The signed amount due equals the allocated cost share minus advance payments already accounted for. A separate immutable payment ledger records only additional positive payments received later. Outstanding balance = current amount due minus the sum of these additional payments. A positive balance is the remaining amount due, zero means settled, and a negative balance is a credit equal to its absolute value. Corrections replace the amount due, retain all payments and post only the difference from the previous amount due. They remain permitted after settlement and for credit balances. Actual positive payments are accepted and deduplicated even when they exceed the remaining amount due or arrive after settlement. Advance payments are not counted again in the additional ledger. Refunds are outside this case; a credit documents a balance and does not receivable a payout.
Settlement and correction
Keep document version and payment account separate
A new statement replaces the amount due and retains all additional payments. Advance payments are already included in the amount due and are not deducted again.
State transitions and completion
| Starting point | Condition and effect | Subsequent state |
|---|---|---|
| Ready for review | Approve the document manifest and signed amount due atomically | Authorised |
| Authorised | Balance greater than zero | Remaining amount due |
| Authorised | Balance equal to zero, even without additional payment | Balanced |
| Authorised | Balance less than zero | Credit balances |
| Remaining amount due, settled or credit balance | Release new correction version; retain additional payments in full; recalculate balance | Remaining amount due, settled or credit balance |
| Each approved version | Append an actual positive payment to the ledger once; recalculate the balance | Remaining amount due, settled or credit balance |
Ready for review
- Condition and effect
- Approve the document manifest and signed amount due atomically
- Subsequent state
- Authorised
Authorised
- Condition and effect
- Balance greater than zero
- Subsequent state
- Remaining amount due
Authorised
- Condition and effect
- Balance equal to zero, even without additional payment
- Subsequent state
- Balanced
Authorised
- Condition and effect
- Balance less than zero
- Subsequent state
- Credit balances
Remaining amount due, settled or credit balance
- Condition and effect
- Release new correction version; retain additional payments in full; recalculate balance
- Subsequent state
- Remaining amount due, settled or credit balance
Each approved version
- Condition and effect
- Append an actual positive payment to the ledger once; recalculate the balance
- Subsequent state
- Remaining amount due, settled or credit balance
Debt, additional payments and correction
- An end-to-end payment ledger
- The signed amount due equals the allocated cost share minus advance payments already accounted for. A separate immutable payment ledger records only additional positive payments received later. Outstanding balance = current amount due minus the sum of these additional payments. A positive balance is the remaining amount due, zero means settled, and a negative balance is a credit equal to its absolute value. Corrections replace the amount due, retain all payments and post only the difference from the previous amount due. They remain permitted after settlement and for credit balances. Actual positive payments are accepted and deduplicated even when they exceed the remaining amount due or arrive after settlement. Advance payments are not counted again in the additional ledger. Refunds are outside this case; a credit documents a balance and does not receivable a payout.
- Concrete correction sequence
- With an amount due of 2,000 cents and additional payments of 1,000 cents, a correction to 2,100 cents leaves 1,100 cents due. With additional payments of 2,000 cents, an amount due of 2,100 cents leaves 100 cents due; a further correction to 1,500 cents creates a credit of 500 cents. The payment ledger stays unchanged in both cases.
Corrections and payments retain separate lifecycles.
Version the amounts due; preserve additional payments with stable references in one continuous ledger.
A payment can arrive while a correction is being prepared.
Approval writes the receivable and document manifest atomically; a crash before commit writes neither. A payment of one cent settles an outstanding amount of one cent; importing it again must not change the balance.
- Alternative considered
- Overwriting the old amount destroys the historical balance.
- Trade-off
- Differences between versions must be explained separately.
- Reassess
- Partial periods or several currencies require an extended posting contract.
Try it yourself
Calculate the balance at amount due 2,000 cents and additional payments 1,000 cents after correction to amount due 2,100 cents. In addition, charge amount due −500 cents without additional payment and amount due 0 without payment. Explain the treatment of advance payments.
A hint for your attempt
Track the released billing up to the documented result; note the common commit point.
Compare with a possible solution
- Correction with payment
- 2,100 − 1,000 = 1,100 cents remaining amount due. The correction replaces the debt and retains the payment; it does not make a new total receivable of 2,100 cents in addition.
- Balances and zero balance
- −500 − 0 produces a credit of 500 cents. 0 − 0 is settled without a payment import. Advance payments are already deducted from the amount due and are not counted again in the additional ledger.
Apply to your project
Which corresponding decision do you need in your project for an documented final state?