コード例 #1
0
        public MakePaymentResult MakePayment(MakePaymentRequest request)
        {
            var validationResult = _validator.Validate(request);

            if (validationResult.Errors.Any())
            {
                return new MakePaymentResult {
                           Success = false
                }
            }
            ;

            var account = _accountDataStore.GetAccount(request.DebtorAccountNumber);
            var result  = GetPaymentScheme(request).Process(account, request.Amount);

            if (result.Success)
            {
                _balanceService.DeductBalance(account, request.Amount);
            }

            return(result);
        }