Code Monkey home page Code Monkey logo

biskot-interview-api's Introduction

Biskot

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:

Exercise goal

  • 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:

action: POST /carts

response http code: 200

action: GET /carts/{cartId}

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
}
>```

action: PUT /carts/{cartId}/items

request body:

{
   "product_id": 1,
   "quantity": 2
 }

response http code: 200

Cart business rules

  • 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

Additional details and considerations

  • 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.

Tips

  • 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).

Submission

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!

biskot-interview-api's People

Contributors

ahajri avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.