A server that contains the prices and does all the calculations A client that consume the server data and view the products
in here we adapted a very simple API that is as follows
the server expect the request to one of the following:
- calculate the total cost
{ 'request' : 'cash', 'data': requests_dict {dict} }
- note the
request_dict
is expected to be{ 'fruit' : amount {int}, 'fruit' : amount {int}, . . . }
- note the
- get the prices AKA menu
{ 'request' : 'prices', 'data': None }
the server responses is also so simple as follows:
- in case of cash request
{ 'request': 'cash', 'data': total_cash {float} }
- in case of prices request
{ 'request' : 'prices', 'data' : fruits_dict {dict} }
- note that
fruits_dict
will be as follows{ 'fruit' : price {float} . . }
- note that