Did you find a way to solve this?
Transfers with event sourcing
Hey,
I'm looking for a implementation advice for event sourcing.
I use the Spatie laravel-event-projector package to model some accounts, so that I can retrace all the changes that appear. Adding, subtracting and all actions that only affect one account are no problem and can be easily implemented the way it is shown in the documentation.
I'm just wondering what the best way to implement a transfer between two accounts would look like. One way would be to dispatch a transfer event that would then trigger a add and subtract event on the corresponding account. But that seems kind of dirty. I don't think that a event is supposed to trigger other events and the information that it was a transfer gets somehow lost on each account, because they appear just as deposit or withdrawal.
As this concept is not new I'm pretty sure that is a solved problem. I just can't find any information or example that goes beyond one account transactions. So I'm open for any opinion or advice.
Please or to participate in this conversation.