public async Task <PerformTransferResponseDto> PerformTransfer(PerformTransferRequestDto performTransferRequestDto) { try { var transactionId = Guid.NewGuid().ToString(); var performTransfer = new StartTransfer( transactionId, performTransferRequestDto.FromBankAccountNumber, performTransferRequestDto.ToBankAccountNumber, performTransferRequestDto.Amount ); await _messageSession.Send(performTransfer).ConfigureAwait(false); return(new PerformTransferResponseDto { Response = "OK" }); } catch (Exception ex) { return(new PerformTransferResponseDto { Response = "ERROR: " + ex.Message + " -- " + ex.StackTrace }); } }
public async Task <IActionResult> PerformTransfer([FromBody] PerformTransferRequestDto performTransferRequestDto) { try { PerformTransferResponseDto response = await _transactionApplicationService.PerformTransfer(performTransferRequestDto); return(StatusCode(StatusCodes.Status201Created, response)); } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message)); } }