Let's say there is a database that persists transaction data , e.g transaction items list of sale invoices , in raw format. Something like this
InvoceId | Item | Price |
---|---|---|
1 | Product-1 | 2.8592 |
1 | Product-2 | 10.7559 |
1 | Product-3 | 5.25 |
Data is exposed to other backend and frontend services by an API , let's call it API-A. All the UI components need to display rounded-off data with sum in the bottom.
Simplified version of the architecture looks like this:
The question is, should API-A take care of rounding-off and summation of data ? Such as, accepting some query string parameters to support rounding-off and summation. Or should each consumer in this architecture take care of rounding and summation separately ? and why?