A simple receipt processor that validates receipts, calculates points, and provides an API to retrieve points for processed receipts.
- Validates receipts based on retailer name, purchase date, purchase time, and items.
- Calculates points using the provided rules.
- Exposes two endpoints:
POST /receipts/process: Processes a receipt and returns an ID.GET /receipts/{id}/points: Returns points for a receipt ID.
The full API specification is available in the api.yml file. See examples directory for reference payloads.
-
Process Receipt
- URL:
/receipts/process - Method:
POST - Request Body: JSON object representing a receipt.
- Response: Returns a unique receipt ID.
- URL:
-
Get Points
- URL:
/receipts/{id}/points - Method:
GET - Response: Returns the points awarded for the given receipt ID.
- URL:
git clone https://github.com/meghna-cse/receipt-processor.git
cd receipt-processor- Build the Docker Image
docker build -t receipt_processor .- Run the Docker Container
docker run -p 8080:8080 receipt_processorThe API endpoints can be accessed on http://localhost:8080 or the port you're running the container on.
Used the Postman collection tests/ReceiptProcessor.postman_collection.json to test API endpoints.