Esempio n. 1
0
        public async Task Transfer(TransferCommand command)
        {
            if (!this.IsOpen())
            {
                throw new UnableToTransferFromAClosedAccountException();
            }

            if (this.State.Balance < command.Amount)
            {
                throw new InsufficientFundsException();
            }

            await this.WriteAsync(new TransferredEvent(command.ToAccountId, command.Amount)
            {
                RelationEvent = command.GetRelationKey()
            });
        }