public TransactionAddMqResponse Add(TransactionAddMqRequest transactionAddMqRequest) { var transactionId = _transactionRepository.Add(transactionAddMqRequest.ToParameters()); var transactionCreateMqResponse = new TransactionAddMqResponse() { Id = transactionId }; return(transactionCreateMqResponse); }
public static TransactionAddMqRequest ToMqModel(this TransactionAddRequest transactionAddRequest) { var transactionAddMqRequest = new TransactionAddMqRequest() { ClientId = transactionAddRequest.ClientId, Amount = transactionAddRequest.Amount, Currency = (CurrencyMqModel)(int)transactionAddRequest.Currency, }; return(transactionAddMqRequest); }
public static TransactionAddParameters ToParameters(this TransactionAddMqRequest transactionCreateMessageRequest) { var transactionAddParameters = new TransactionAddParameters() { ClientId = transactionCreateMessageRequest.ClientId, DepartmentAddress = transactionCreateMessageRequest.DepartmentAddress, Amount = transactionCreateMessageRequest.Amount, Currency = (Currency)(int)transactionCreateMessageRequest.Currency, }; return(transactionAddParameters); }
public async Task <TransactionAddResponse> AddAsync(TransactionAddRequest transactionAddRequest) { TransactionAddMqRequest transactionAddMqRequest = transactionAddRequest.ToMqModel(); transactionAddMqRequest.DepartmentAddress = _httpContextAccessor.HttpContext.Connection.RemoteIpAddress.MapToIPv4().ToString(); using var bus = CreateBus(); TransactionAddMqResponse transactionAddMqResponse = await bus.RequestAsync <TransactionAddMqRequest, TransactionAddMqResponse>(transactionAddMqRequest); return(transactionAddMqResponse.ToModel()); }