Authoritative data and states
What results arise from the two possible orders of usage ingestion and period finalisation?
The interfaces require an authoritative state. Each usage event takes effect at most once. R-161 contains exactly the usage included at finalisation, priced using T-2. Late events do not overwrite a finalised invoice, and an unknown payment outcome is not treated as a definite rejection. The table separates current states from the evidence that established them.
Starting point Compare the event identifier and the 100 units together.
Assumptions for the example case
Original fictional example design: one monthly contract in EUR, positive integer usage units, a fixed tariff version per period, one invoice and one payment order, and separate correction records. Figures and quality targets are illustrative test assumptions. Tax law, multiple currencies, prorated tariff changes and debt collection are outside the scope.
Data relationships and permitted transitions
Finalised usage snapshot and separate correction
V-161 and T-2 define P-10; R-161 holds the finalised snapshot; late N-161 links to a separate correction record.
Entities and relationships
| Entity | Authoritative data | Responsibility |
|---|---|---|
| Contract V-161 | Customers, tariff T-2, entitlement rule | The tariff version applies to the fixed period. |
| Usage event N-161 | Event identification, time of event, units | Assigned to one period exactly once. |
| Period P-10 | Half-open time window and finalisation watermark | Separates accepted usage from later corrections. |
| Invoice R-161 | 1,000 cents base price plus 200 cents usage, in EUR | Immutable once finalised. |
| Payment order Z-161 | Invoice, 1200 cents, result | An unknown outcome remains open. |
| Service entitlement | Contract, state, reason and validity period | Follows an explicit rule, rather than reacting directly to every transport message. |
Contract V-161
- Authoritative data
- Customers, tariff T-2, entitlement rule
- Responsibility
- The tariff version applies to the fixed period.
Usage event N-161
- Authoritative data
- Event identification, time of event, units
- Responsibility
- Assigned to one period exactly once.
Period P-10
- Authoritative data
- Half-open time window and finalisation watermark
- Responsibility
- Separates accepted usage from later corrections.
Invoice R-161
- Authoritative data
- 1,000 cents base price plus 200 cents usage, in EUR
- Responsibility
- Immutable once finalised.
Payment order Z-161
- Authoritative data
- Invoice, 1200 cents, result
- Responsibility
- An unknown outcome remains open.
Service entitlement
- Authoritative data
- Contract, state, reason and validity period
- Responsibility
- Follows an explicit rule, rather than reacting directly to every transport message.
Permitted state transitions
| Starting point | Target | Condition |
|---|---|---|
| periode_offen | abschluss_läuft | The ingestion boundary is recorded atomically. |
| abschluss_läuft | abgerechnet | R-161 is generated from exactly the usage included at finalisation. |
| abgerechnet | zahlung_offen | Z-161 has been durably created. |
| zahlung_offen | bezahlt | Matching payment evidence is available. |
| zahlung_offen | zahlung_abgelehnt | A definite rejection is evidenced. |
| zahlung_abgelehnt | anspruch_eingeschränkt | Agreed grace period ends; customer service sees the reason. |
| bezahlt or anspruch_eingeschränkt | terminal_für_periode | Late usage produces a correction record; the next period is a separate entity. |
periode_offen
- Target
- abschluss_läuft
- Condition
- The ingestion boundary is recorded atomically.
abschluss_läuft
- Target
- abgerechnet
- Condition
- R-161 is generated from exactly the usage included at finalisation.
abgerechnet
- Target
- zahlung_offen
- Condition
- Z-161 has been durably created.
zahlung_offen
- Target
- bezahlt
- Condition
- Matching payment evidence is available.
zahlung_offen
- Target
- zahlung_abgelehnt
- Condition
- A definite rejection is evidenced.
zahlung_abgelehnt
- Target
- anspruch_eingeschränkt
- Condition
- Agreed grace period ends; customer service sees the reason.
bezahlt or anspruch_eingeschränkt
- Target
- terminal_für_periode
- Condition
- Late usage produces a correction record; the next period is a separate entity.
Set an atomic finalisation boundary
Fix an unambiguous ingestion watermark.
Usage arrives during invoice generation.
Either ordering bills the usage through the invoice or a separate correction record.
- Alternative considered
- A running sum query can include an inconsistent subset of usage.
- Trade-off
- Late usage requires follow-up processing.
- Reassess
- A different billing cutoff is agreed.
Terms in this step
- Set an atomic finalisation boundary
- Either ordering bills the usage through the invoice or a separate correction record.
Try it yourself
Execute N-161 ingestion and period finalisation in both commit orders. State the invoice amount and any correction.
A hint for your attempt
Use the specific entities and conditions from this step. The two solution parts distinguish the decision from its evidenced outcome.
Compare with a possible solution
- First part of the solution
- Ingestion wins: R-161 totals 1,200 cents with no additional 200-cent correction.
- Second part of the solution
- Finalisation wins: R-161 stays at 1,000 cents; review produces a separate 200-cent correction record. The 100 units are billed once overall.
Apply to your project
Which corresponding assumption in your project would you check first when a different billing cutoff is agreed?