microservices-patterns/ftgo-application

Enhancement for testing - add more information to web responses

asn25 opened this issue · 0 comments

asn25 commented

Hello,

please add more fields to web responses (in particular, in Order Service), f.e., such fields as:

  • version
  • positionsCount
  • firstPositionPrice
  • firstPositionQty

Here is example how it may look like (done in my test version):

$ creordbulk
{"consumerId":1}{"id":1}
{"orderId":1,"state":"APPROVAL_PENDING","version":0,"positionsCount":1,"firstPositionPrice":"5.00","firstPositionQty":3,"total":"15.00"}

$ getord 1
{"orderId":1,"state":"APPROVED","version":1,"positionsCount":1,"firstPositionPrice":"5.00","firstPositionQty":3,"total":"15.00"}

$ revord 1
{"orderId":1,"state":"APPROVED","version":1,"positionsCount":1,"firstPositionPrice":"5.00","firstPositionQty":3,"total":"15.00"}

$ getord 1
{"orderId":1,"state":"APPROVED","version":3,"positionsCount":1,"firstPositionPrice":"5.00","firstPositionQty":14,"total":"70.00"}

$ cancord1
{"orderId":1,"state":"APPROVED","version":3,"positionsCount":1,"firstPositionPrice":"5.00","firstPositionQty":14,"total":"70.00"}

$ getord 1
{"orderId":1,"state":"CANCELLED","version":5,"positionsCount":1,"firstPositionPrice":"5.00","firstPositionQty":14,"total":"70.00"}

So it's easy to test Revise-operation and a lot of other stuff.

This extra information is very helpful for testing and saves a lot of time.
F.e., you don't have to do additional lookup into DB on each operation (or have an extra monitor with DB-tables).

I propose to do it for GetOrderResponse and CreateOrderResponse of Orders at least
(and maybe for Consumers and Restaurants too).