We are about to build an invoice system for our customer, the system will consume an event sourced participant application.
The invoice system will process events, such as:
* ParticipantStartedCourse
* ParticipantCompletedCourse
* ParticipantAbortedCourse
* ParticipantWasPresent
* ...
Each participant course instance is also attached to a price node with contains a lot of billing rules.
Was thinking of using a couple of aggregates that I pretty much only append new event to as they arrive from the participant system. Doing all the annoying calculations in the projection.
And when the invoice admin locks an invoice, I take a snapshot from the projection and persist it it an invoice aggregate.
Advantages of doing this, would be that. If we later realize something was calculated incorrectly, we could just take a new snapshot the newly calculated invoice projection. And make a differential invoice with all the corrections.
What would be advantages be with doing the calculations in the aggregate instead?