Can command pattern return a value? [Transaction]

119 Views Asked by At

I have been working on a small core banking project. I would like to ask a question.

Suppose that we have a transaction microservice. A transaction request has been sent to our service. After storing and doing this transaction, Is it right to return transaction informations?

Here is an example of process.

     INPUT
   • Account ID
   • Amount
   • Currency
   • Direction of transaction (IN, OUT)
   • Description

     OUTPUT
   • Account ID
   • Transaction ID
   • Amount
   • Currency
   • Direction of transaction
   • Description
   • Balance after transaction

     ERROR
   • Invalid currency
   • Invalid direction
   • Invalid amount (if negative amount for example)
   • Insufficient funds
   • Account missing
   • Description missing
1

There are 1 best solutions below

0
Levi Ramsey On

There's in general no reason that a command couldn't have a response/return value with more than just command succeeded/failed.