If you are reviewing this submission, then you can do so in two ways
- Look at the changes in this pull request
- Browse the code on Github
→ Please see AUTHOR_COMMENTS.md for tradeoffs made and so on.
- Clone this repository on your machine.
- Use your IDE of choice to complete the assignment.
- When you are finished with the solution and have pushed it to the repo, you can submit the assignment here.
- There is no time limit for this task
We value simplicity as an architectural virtue and as a development practice. Solutions should reflect the difficulty of the assigned task, and shouldn’t be overly complex. We prefer simple, well tested solutions over clever solutions.
- ✅ Include unit tests
- ✅ Test both any client and logic
- ✅ Update the README.md with any relevant information and/or tradeoffs you would like to highlight
- ❌ Submit a web, desktop, command line or any other kind of app
- ❌ Add unnecessary layers of abstraction
- ❌ Add unnecessary patterns/ architectural features that aren’t called for
Create a shopping cart package that facilitates 2 basic capabilities.
-
Add a product to the cart
- Specifying the product name and quantity
- Use the product name to discover the price from the Product API specified below
- Cart state (totals, etc.) must be available
-
Calculate the state:
- Cart subtotal (sum of price for all items)
- Tax payable (charged at 12.5% on the subtotal)
- Total payable (subtotal + tax)
- Totals should be rounded up where required
Base URL: https://equalexperts.github.io/
View Product: GET /backend-take-home-test-data/{product}.json
Available products
cheerios
cornflakes
frosties
shreddies
weetabix
The below is a sample with the correct values you can use to confirm your calculations
- Add 1 × cornflakes @ 2.52 each
- Add another 1 x cornflakes @2.52 each
- Add 1 × weetabix @ 9.98 each
- Cart contains 2 x cornflakes
- Cart contains 1 x weetabix
- Subtotal = 15.02
- Tax = 1.88
- Total = 16.90