Solution to the Receipt Processor challenge.
Body: A JSON-formatted Receipt.
Response:
-
200: A JSON-formatted body in the form of:
{ "id": "062e96a5-3dcf-4a42-b565-06ea3bc3d2e9" }where
idcan be later used inGET /receipts/{id}/points. -
400: If the receipt did not pass validation, or is otherwise malformed.
Body: None
Response:
-
200: A JSON-formatted body in the form of:
{ "points": 23 }where
pointsis the points awarded to the processed receipt, according to a set of predefined rules. -
404: If the
iddid not come from a prior/receipts/processrequest.
go mod tidy
go run main.goOr using Docker:
docker build -t receipt-processor:latest .
docker run -p 8080:8080 -it receipt-processor:latest