public bool Execute(TransferMoneyCommand command)
        {
            var balanceSpec         = new EnoughBalanceAmountSpecification();
            var minimumTransferSpec = new MinimumTransferAmountSpecification();

            var andSpec = balanceSpec.And(minimumTransferSpec);

            if (andSpec.IsSatisfiedBy(State))
            {
                var sentEvent = new MoneySentEvent(command.Transaction);
                var feeEvent  = new FeesDeductedEvent(new Money(0.25m));

                EmitAll(sentEvent, feeEvent);
            }

            return(true);
        }
Beispiel #2
0
 public void Apply(FeesDeductedEvent aggregateEvent)
 {
     Balance -= aggregateEvent.Amount;
 }