Giter Club home page Giter Club logo

api-requirements's Introduction

api-requirements

Description

We want you to implement a REST API endpoint that given a list of products, applies some discounts to them and can be filtered. You are free to choose whatever language and tools you are most comfortable with, but, we value you to use laravel since our main platform is also on laravel / php. We will value your ability to apply the following rules on the corresponding layers following Domain Driven Design. Please add instructions on how to run it and publish it on your fork.

Deliverable

Fork the project, work on the solution and send us back a link to your forked GitHub project to examine your answer to this test.

Conditions

The prices are integers for example, 100.00โ‚ฌ would be 10000.

  1. You can store the products as you see fit (json file, in memory, rdbms of choice)
  2. Products in the "insurance" category have a 30% discount.
  3. The product with sku = 000003 has a 15% discount.
  4. Provide a single endpoint. GET /products.
  5. Can be filtered by category as a query string parameter.
  6. (optional) Can be filtered by price as a query string parameter, this filter applies before discounts are applied.
  7. Returns a list of Products with the given discounts applied when necessary Product model.
  8. price.currency is always EUR.
  9. When a product does not have a discount, price.final and price.original should be the same number and discount_percentage should be null.
  10. When a product has a discount, price.original is the original price, price.final is the amount with the discount applied and discount_percentage represents the applied discount with the % sign.

Example product with a discount of 30% applied:
{ "sku": "000001", "name": "Full coverage insurance", "category": "insurance", "price": { "original": 89000, "final": 62300, "discount_percentage": "30%", "currency": "EUR" } }

Example product without a discount:

  `{
    "sku": "000002",
    "name": "Compact Car X3",
    "category": "vehicle",
    "price": {
        "original": 89000,
        "final": 89000,
        "discount_percentage": null,
        "currency": "EUR"
    }
  }`

Dataset.

The following dataset is the only dataset you need to be able to serve on the API:

{ "products": [ { "sku": "000001", "name": "Full coverage insurance", "category": "insurance", "price": 89000 }, { "sku": "000002", "name": "Compact Car X3", "category": "vehicle", "price": 99000 }, { "sku": "000003", "name": "SUV Vehicle, high end", "category": "vehicle", "price": 150000 }, { "sku": "000004", "name": "Basic coverage", "category": "insurance", "price": 20000 }, { "sku": "000005", "name": "Convertible X2, Electric", "category": "vehicle", "price": 250000 } ] }

api-requirements's People

Contributors

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