public async Task <PerformMoneyTransferResponseDto> PerformTransfer(PerformMoneyTransferRequestDto dto)
        {
            try
            {
                var transferId = Guid.NewGuid().ToString();
                var command    = new RequestMoneyTransferCommand(
                    transferId,
                    dto.SourceAccountId,
                    dto.DestinationAccountId,
                    dto.Amount,
                    dto.Description
                    );
                await _messageSession.Send(command).ConfigureAwait(false);

                return(new PerformMoneyTransferResponseDto
                {
                    Response = "OK"
                });
            }
            catch (Exception ex)
            {
                return(new PerformMoneyTransferResponseDto
                {
                    Response = "ERROR: " + ex.Message + " -- " + ex.StackTrace
                });
            }
        }
Esempio n. 2
0
        public async Task <IActionResult> PerformMoneyTransfer([FromBody] PerformMoneyTransferRequestDto dto)
        {
            PerformMoneyTransferResponseDto response = await _transactionApplicationService.PerformTransfer(dto);

            return(Ok(response));
        }