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); }
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); }