Having the following shopping cart process and implementation from previous exercises:
- The customer may add a product to the shopping cart only after opening it.
- When selecting and adding a product to the basket customer needs to provide the quantity chosen. The product price is calculated by the system based on the current price list.
- The customer may remove a product with a given price from the cart.
- The customer can confirm the shopping cart and start the order fulfilment process.
- The customer may also cancel the shopping cart and reject all selected products.
- After shopping cart confirmation or cancellation, the product can no longer be added or removed from the cart.
How will the solution change when we add requirements:
- We can add up to 10 products marked as "Super discount!".
- The customer can only have one open cart at a time.
There are two variations:
- Immutable, with functional command handlers composition and entities as anemic data model: Immutable/OptimisticConcurrencyTests.
- Classical, mutable aggregates (rich domain model): Mutable/OptimisticConcurrencyTests.
- Mixed approach, mutable aggregates (rich domain model), returning events from methods, using immutable DTOs: Mixed/OptimisticConcurrencyTests.
Select your preferred approach (or all) to solve this use case using EventStoreDB. Fill appropriate EventStoreClientExtensions
Note: If needed update entities, events or test setup structure