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

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

            _atm.TakeMoney(amount);
            _repository.Save(_atm);
            NotifyClient("You have taken " + amount.ToString("C2"));
        }
Ejemplo n.º 2
0
        private void TakeMoney(decimal amount)
        {
            var error = _atm.CanTakeMoney(amount);

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

            _atm.TakeMoney(amount);
            _atmRepository.Save(_atm);
            NotifyClient("You have taken " + amount.ToString("C2"));
        }
Ejemplo n.º 3
0
        private void TakeMoney(decimal amount)
        {
            string error = _atm.CanTakeMoney(amount);

            if (error != string.Empty)
            {
                NotifyClient(error);
            }
            decimal amountWithCommision = _atm.CalculateAmountWithCommision(amount);

            _paymentGateway.ChargePayment(amountWithCommision);
            _atm.TakeMoney(amount);
            _repository.Save(_atm);
            NotifyClient("You have taken " + amount.ToString("C2"));
        }
Ejemplo n.º 4
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"));
        }