Example #1
0
        public void Execute(int accountNumber, Amount amount)
        {
            BeginTransaction();

            if (_cashDispenserAppService.IsSufficientCashAvailable(amount))
            {
                throw new Exception("Not enough money in the banknote dispenser.");
            }

            _withdrawalService.Execute(accountNumber, amount);

            if (!_cashDispenserAppService.DispenseCash(amount))
            {
                throw new Exception();
            }

            Commit();
        }