public async Task HandleAsync(WalletAmountToppedUpEvent message)
        {
            var orderProcessManager = await _processManagerRepository.FindAsync(message.OrderId);

            orderProcessManager.When(message);

            await _processManagerRepository.Save(orderProcessManager);
        }
Beispiel #2
0
        public void When(WalletAmountToppedUpEvent message)
        {
            switch (State)
            {
            case SellOrderProcessManagerState.StocksTakedOffFromWallet:
                State = SellOrderProcessManagerState.WalletToppedUp;
                ProcessCommand(new FinishBuyOrderCommand(AggregateId));
                break;

            // idempotence - same message sent twice
            case SellOrderProcessManagerState.StocksAddedToCompany:
                break;

            default:
                throw new StocqresException("Invalid state for this message");
            }
        }
Beispiel #3
0
 private void Apply(WalletAmountToppedUpEvent @event)
 {
     Amount += @event.Amount;
 }