Esempio n. 1
0
        private void TakeMoney(decimal amount)
        {
            string error = _atm.CanTakeMoney(amount);

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

            decimal amountWithCommission = _atm.CalculateAmountWithComission(amount);

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

            //HeadOffice headOffice = GetHeadOfficeInstance();
            //headOffice.Balance += amountWithCommission;
            //_officeRepository.Save(headOffice);

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