示例#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"));
        }
示例#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"));
        }
        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"));
        }
示例#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"));
        }