コード例 #1
0
        public void ShouldUpdateBalanceForValidTransaction()
        {
            var account = new Account();

            account.Balance = 100;
            MakePaymentRequest request = new MakePaymentRequest();

            request.Amount = 50;
            request.DebtorAccountNumber = "12345679";
            AccountOperations.DeductBalanceAndUpdateAccount("dataStore", account, request);
            Assert.Equal(account.Balance, 50);
        }
コード例 #2
0
        public MakePaymentResult MakePayment(MakePaymentRequest request)
        {
            var dataStoreType = ConfigurationManager.AppSettings["DataStoreType"];
            var account       = DataStore.GetAccount(dataStoreType, request);

            var result = new MakePaymentResult();

            result.Success = PaymentOperations.ExecutePayment(request.PaymentScheme, account, request);
            if (result.Success)
            {
                AccountOperations.DeductBalanceAndUpdateAccount(dataStoreType, account, request);
            }

            return(result);
        }