public async Task <IActionResult> Post([FromBody] AccountTransfer accountTransfer) { if (accountTransfer == null) { return(BadRequest()); } await _accountService.Transfer(accountTransfer); return(Ok(accountTransfer)); }
public void Transfer(AccountTransfer accountTrasfer) { var createTransferCommand = new CreateTransferCommand( accountTrasfer.AccountSource, accountTrasfer.AccountTarget, accountTrasfer.TransferAmount ); _bus.Send(createTransferCommand); }
public void Transfer(AccountTransfer accountTransfer) { var createTransferCommand = new CreateTransferCommand( accountTransfer.FromAccount, accountTransfer.ToAccount, accountTransfer.TransferAmount ); _bus.SendCommand <CreateTransferCommand>(createTransferCommand); }
public void Transfer(AccountTransfer accountTransfer) { var createTransferCommand = new CreateTransferCommand( from: accountTransfer.FromAccount, to: accountTransfer.ToAccount, amount: accountTransfer.TransferAmount ); _bus.SendCommand(createTransferCommand); }
public void TransferFunds(AccountTransfer accountTransfer) { var createTranferCommand = new CreateTransferCommand( accountTransfer.FromAccount, accountTransfer.ToAccount, accountTransfer.TransferAmount ); this.bus.SendCommand(createTranferCommand); }
public void Transfer(AccountTransfer accountTransfer) { var createTransferCommand = new CreateTransferCommand( accountTransfer.AccountFrom, accountTransfer.AccountTo, accountTransfer.TransferAmount ); _bus.SendCommand(createTransferCommand); }
public void Transfer(AccountTransfer accountRequest) { var createTransferCommand = new CreateTransferCommand( from: accountRequest.FromAccount, to: accountRequest.ToAccount, ammount: accountRequest.TransferAmmount ); _eventBus.SendCommand(createTransferCommand); }
public void Transfer(AccountTransfer accountTransfer) { var createTransferCommand = new CreateTransferCommand( accountTransfer.FromAccount , accountTransfer.ToAccount , accountTransfer.TransferAmount ); //publish to rabbitMQ _bus.SendCommand(createTransferCommand); }
public void TransferFunds(AccountTransfer accountTransfer) { var createTransferCommand = new CreateTransferCommand( accountTransfer.AccountSource, accountTransfer.AccountTarget, accountTransfer.TransferAmount ); //So beautiful _bus.SendCommand(createTransferCommand); }
public ActionResult <AccountTransfer> Transfer([FromBody] AccountTransfer accountTransfer) { try { return(_dataStore.Transfer(accountTransfer)); } catch (InsufficientFundsException) { return(BadRequest()); } }
public void Transfer(AccountTransfer accountTransfer) { var command = new CreateTransferCommand { From = accountTransfer.AccountSource, To = accountTransfer.AccountDestination, Amount = accountTransfer.TransferAmount }; _bus.SendCommand(command); }
public void Transfer(AccountTransfer accountTransfer) { //Passa o DTO da camada de aplicação para um comando var createTransferCommand = new CreateTransferCommand( accountTransfer.FromAccount, accountTransfer.ToAccount, accountTransfer.TransferAccount); //Envia um comando _bus.SendCommand(createTransferCommand); }
public void Transfer(AccountTransfer accoutTransfer) { var createTransferCommands = new CreateTransferCommand( accoutTransfer.FromAccount, accoutTransfer.ToAccount, accoutTransfer.TransferAmmount ); // using the bus!!!! _bus.SendCommand(createTransferCommands); }
public void Transfer(AccountTransfer accountTransfer) { var createTransferCommand = new CreateTransferCommand( accountTransfer.FromAccount, accountTransfer.ToAccount, accountTransfer.TransferAmount ); //send to cqrs to raise handler _bus.SendCommand(createTransferCommand); }
public void Transfer(AccountTransfer accountTransfer) { var createTrasnferCommand = new CreateTransferCommand( accountTransfer.FromAccount, accountTransfer.ToAccount, accountTransfer.TransferAmount ); //send a msg through a bus _bus.SendCommand(createTrasnferCommand); }
public void Transfer(AccountTransfer accountTransfer) { var createTransferCommand = new CreateTransferCommand( accountTransfer.FromAccount, accountTransfer.ToAccount, accountTransfer.TransferAmount ); //There is MY CreateTransferCommand and now we use the Bus to send the command to our TransferCommandHandler. _bus.SendCommand(createTransferCommand); }
public void Transfer(AccountTransfer accountTransfer) { CreateTransferCommand createTransfer = new CreateTransferCommand ( accountTransfer.FromAccount, accountTransfer.ToAccount, accountTransfer.TransferAmount ); bus.SendCommand(createTransfer); }
public async Task Transfer(AccountTransfer accountTransfer) { var createTransferCommand = new CreateTransferCommand(accountTransfer.FromAccount, accountTransfer.ToAccount, accountTransfer.TransferAmount); bool successfull = await _eventBus.SendCommand(createTransferCommand); if (!successfull) { //Log error } }
public void Transfer(AccountTransfer accountTransfer) { // 2nd BackingTransferToBus Hits here next var createTransferCommand = new CreateTransferCommand( accountTransfer.FromAccount, accountTransfer.ToAccount, accountTransfer.TransferAmount ); _bus.SendCommand(createTransferCommand); }
public async Task <bool> Transfer(AccountTransfer accountTransfer) { var processTransfer = await _accountRepository.ProcessTransferAsync(accountTransfer.FromAccount, accountTransfer.ToAccount, accountTransfer.TransferAmount); if (processTransfer) { var createTransferCommand = new CreateTransferCommand(accountTransfer.FromAccount, accountTransfer.ToAccount, accountTransfer.TransferAmount); await _bus.SendCommand(createTransferCommand); } return(processTransfer); }
public void Transfer(AccountTransfer accountTransfer) { //create a command var createTransferCommand = new CreateTransferCommand( accountTransfer.FromAccount, accountTransfer.ToAccount, accountTransfer.TransferAmount ); //send the command on the bus to command handler _bus.SendCommand(createTransferCommand); }
public void Test_That_Successful_Transfer_Calls_Transfer_Once() { var at = new AccountTransfer() { Amount = 19.99m }; _mock.Setup(m => m.Transfer(at)).Returns(at); var result = _controller.Transfer(at); _mock.Verify(m => m.Transfer(at), Times.Once); }
public void Test_That_Throwing_Transfer_Returns_Bad_Request() { var at = new AccountTransfer() { Amount = 19.99m }; _mock.Setup(m => m.Transfer(at)).Throws(new InsufficientFundsException()); var result = _controller.Transfer(at); Assert.IsType <BadRequestResult>(result.Result); }
public async Task <bool> SaveAccountTransferAsync(AccountTransfer transfer) { var result = true; var transactions = AccountTransfer.ToTransactions(transfer); foreach (var transaction in transactions) { result = result && await SaveTransactionAsync(transaction); } return(result); }
public IActionResult WithdrawAccount(Int32 account, [FromBody] AccountTransfer transferDetails) { try { AccountsManager.Withdraw(account, transferDetails.Funds); } catch (NotEnoughFundsException) { return(BadRequest("Not enough funds to perform the transfer")); } return(Ok()); }
public async Task <ActionResult <AccountTransfer> > Post([FromBody] AccountTransfer accountTransfer) { var result = await _accountService.Transfer(accountTransfer); if (result) { return(Ok(accountTransfer)); } else { return(BadRequest("Error while executing transfer.")); } }
public IActionResult TransfetToAccount([FromBody] AccountTransferRequest accountTransferRequest) { var accountTransfer = new AccountTransfer { FromAccount = accountTransferRequest.FromAccount, ToAccount = accountTransferRequest.ToAccount, TransferAmount = accountTransferRequest.TransferAmount }; _accountService.Transfer(accountTransfer); return(Ok(accountTransfer)); }
public async Task <ActionResult <IEnumerable <Account> > > Transfer([FromBody] AccountTransfer accountTransfer) { try { var accounts = await _accountService.Transfer(accountTransfer); return(Ok(accounts)); } catch (Exception e) { return(StatusCode(503, e.Message)); } }
public Task <AccountTransferDetails> GetTransferPaymentDetails(AccountTransfer transfer) { var parameters = new DynamicParameters(); parameters.Add("@receiverAccountId", transfer.ReceiverAccountId, DbType.Int64); parameters.Add("@periodEnd", transfer.PeriodEnd, DbType.String); parameters.Add("@apprenticeshipId", transfer.ApprenticeshipId, DbType.Int64); return(_db.Value.Database.Connection.QuerySingleOrDefaultAsync <AccountTransferDetails>( sql: "[employer_financial].[GetTransferPaymentDetails]", param: parameters, transaction: _db.Value.Database.CurrentTransaction.UnderlyingTransaction, commandType: CommandType.StoredProcedure)); }
public AccountTransfer Transfer(AccountTransfer transfer) { // get customer details var fromAccount = GetAccount(transfer.FromAccount); var toAccount = GetAccount(transfer.ToAccount); if (!fromAccount.IsActive) { throw new AccountException("From account inactive"); } if (!toAccount.IsActive) { throw new AccountException("To account inactive"); } var fromCustomer = GetCustomer(fromAccount.CustomerID); var toCustomer = GetCustomer(toAccount.CustomerID); // does from account have enough funds for the transaction? if (fromAccount.Balance - transfer.Amount < -fromAccount.OverdraftLimit) { throw new InsufficientFundsException("From account has insufficient funds for transfer"); } // create two transactions based on the transfer: var fromTransaction = new AccountTransaction { AccountNumber = transfer.FromAccount, Amount = transfer.Amount, Description = $"{transfer.Description}. Transfer to {toCustomer.Name}", TransactionType = TransactionType.Transfer }; var toTransaction = new AccountTransaction { AccountNumber = transfer.ToAccount, Amount = transfer.Amount, Description = $"{transfer.Description}. Transfer from {fromCustomer.Name}", TransactionType = TransactionType.Transfer }; Debit(fromTransaction); Credit(toTransaction); return(transfer); }