예제 #1
0
        private void TakeMoney(decimal amount)
        {
            var error = _atm.CanTake(amount);

            if (error != string.Empty)
            {
                MessageBox.Show(error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            var amountWithComission = _atm.CalculateWithComission(amount);

            _paymentGateway.ChargePayment(amountWithComission);
            _atm.TakeMoney(amount);
            _atmRepository.Save(_atm);
            NotifyClient($"You have taken {amount.ToString("C2")}");
        }