- Products
- Sales
- Contracts
- Commissions
- Payments
- Product priced (product_id:, price?:)
- Product sold (product_id:, actor_id:, quantity?:, amount?:)
Do we know the sale amount or just the quantity?
- Contract signed (company_id:, actor_id:, effective_on:, percentage:)
Both sales person and the platform can be an actor - is that ok?
- Commission created (company_id:, actor_id:, amount:, contract_id?:)
- subscribed to
ContractSigned
- subscribed to
ProductSold
- subscribed to
ProductPriced
(if the product sold event wouldn't have the amount) - calculates and creates the commission
Question: how to get the latest/current contract? Can we use a read model for that?
- subscribed to
ContractSigned
- subscribed to
CommissionCreated
- if the new contract overrides the contract that the commission was created for...
- creates the commission with negative amount (to cancel the original commission)
to be able to calculate the commission we need:
- contracts
- prices
- sells
to be able to show reports, maybe generate recurring payments
- commissions