Skip to content

david-youn/receipt-processor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

David Youn - Receipt Process Challenge

challenge link: https://github.com/fetch-rewards/receipt-processor-challenge


Instructions to Run

  1. After downloading, run go run main.go.
    note: you may need to install google/uuid by running: go get github.com/google/uuid
              you may also need to install gorilla/mux by running: go get github.com/gorilla/mux

  2. This will start running the server in localhost port :8080

  3. Below I've provided two different ways to test below:

    • using Postman
    • using Rest Client plugin in VSCode

1. Using Postman

This method is to use Postman to help test the API.

POST

  1. Create a POST request with the path: localhost:8080/receipts/process
  2. In the request body, choose JSON and add details of the receipt you would like to process.
    EXAMPLE
    Screenshot 2024-11-21 at 8 03 32 PM
  3. This should return a body containing an id (a uuid to be specific). Make sure you copy this value.

GET

  1. Create a GET request with the path: localhost:8080/receipts/{id}/points
    note: replace {id} with the id value copied in step 3 above.
  2. This should return a body containing the number of points corresponding to the receipt with the id you wrote in the request.
    EXAMPLE
    Screenshot 2024-11-21 at 8 08 51 PM

2. Using Rest Client plugin in VSCode

This VSCode plugin will make it so you can test in VSCode with the file examples.rest provided. Screenshot 2024-11-21 at 8 13 51 PM

POST

  1. Above the POST request, there is a small, clickable text with the words send request. Clicking it will generate another window with the results of running the request.
  2. This should return a body containing an id value. Make sure to copy this.
    EXAMPLE
    Screenshot 2024-11-21 at 8 17 22 PM

GET

  1. On line 58 of the examples.rest file, there should be a GET request that looks like GET http://localhost:8080/receipts/{id}/points.
  2. Replace {id} value with the id value copied in step 2 above.
  3. Above the GET request, there is a small, clickable text with the words send request. Clicking it will generate another window with the results of running the request.
  4. This should return a body containing the number of points corresponding to the receipt with the id you wrote in the request.
    EXAMPLE
    Screenshot 2024-11-21 at 8 24 12 PM

Additional Notes:

  • I've also printed the values to the console to show the point breakdowns.
    Screenshot 2024-11-21 at 8 30 08 PM

Unrelated Notes:

In case you make it this far:

Thanks for taking a look! Hope to hear back, David Youn

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages