Biskot API is micro service responsible for managing the cart of an e-commerce website.
Before attempting to crunch the code, we strongly recommend you to carefully read each of the sections below:
- Implement the endpoints defined in the biskot.yaml api model. To better understand the model, we suggest you open the
yaml
file in a fancy UI available here.
To give you an idea of what is the expected result from each endpoint looks like, below some examples:
response http code: 200
response http code: 200
response body:
{ "id": 1, "items": [ { "product_id": 1, "product_label": "Déodorant Spray 200ml Ice Dive ADIDAS", "quantity": 2, "unit_price": 2.00, "line_price": 2.00 } ], "totalPrice": 4.00 } >```
request body:
{ "product_id": 1, "quantity": 2 }response http code: 200
- Added quantity of a product should not exceed the stock availability
- Total price of the cart should not exceed 100 euros
- A cart cannot contain more than 3 different products
- Carts could be persisted in memory using an embedded db or a collection of you choice inside InMemoryCartRepository
- Biskot has a dependency with an external service allowing you to get products information. The interactions with this external service should be implemented in ProductGateway
- As long as you respect the exercise goal, you have complete freedom to apply as many coding practices or external libraries as you see fit.
- The Java contract classes as well as the api interface can be generated using the openapi-generator-maven-plugin configured in
pom.xml
file - A mock server has already been configured in ProductMockServer from which products can be retrieved calling: GET http://localhost:9001/products/{productId} (productId ranges from 1 to 4)
- The project is structured using hexagonal architecture, so please be aware to implement all layers (you will find
// TODO: to be implemented
comments when expect you to provide an implementation).
When you feel confident with your implementation, please push your work in a source code management of your choice and share it with us.
Happy Coding. Good luck!