Example #1
0
        private void TakeMoney(decimal amount)
        {
            var error = _atm.CanTakeMoney(amount);

            if (error != string.Empty)
            {
                NotifyClient(error);
                return;
            }

            var amountWithCommision = _atm.CalculateAmountWithCommission(amount);

            _paymentGateway.ChargePayment(amountWithCommision);
            _atm.TakeMoney(amount);
            _repository.Save(_atm);

            NotifyClient("You have taken " + amount.ToString("C2"));
        }