コード例 #1
0
        public MakePaymentResult MakePayment(MakePaymentRequest request)
        {
            Account    debtorAccount = _accountAccess.GetAccount(request.DebtorAccountNumber);
            IValidator validator     = _validationFactory.GetValidator(request.PaymentScheme);
            bool       valid         = validator.ValidatePayment(debtorAccount, request.Amount);

            if (valid)
            {
                debtorAccount.Balance -= request.Amount;
                _accountAccess.UpdateAccount(debtorAccount);
            }

            return(new MakePaymentResult {
                Success = valid
            });
        }