Skip to content

machester4/voucher-calculator

Repository files navigation

Voucher Calculator

Maximize total spent of a voucher according to a list of items.

Key FeaturesDependenciesHow To UseDocumentation

Key Features

  • Maximize total spent of a voucher with N items.
  • The items are represented by a list of tuples (item, price).
  • The algorithm is greedy inspired by the Knapsack problem.

Dependencies

How To Use

Running the project

Before running the project please ensure that all the dependencies are installed in your system. Then follow the next:

  1. Run pubsub emulator. Click here

  2. Create topic.

    • Topic: voucher-metric
    • Subscription: voucher-metric-sub
  3. Run the project itself.

    make web
    
  4. Test it.

    curl -X POST -H "Content-Type: application/json" -d '{"item_ids": ["MLU605321798", "MLU473655928", "MLU468171212", "MLU473464533", "MLU608054906"], "amount": 500}' http://localhost:8080/calculator/coupon
    

Running the tests

In order to run the project tests you need to execute the following command:

make test

TODO:

  • Refactor transport layer
  • Integration tests
  • Circuit breaker
  • Logging
  • Monitoring
  • Error handling
  • Documentation

Documentation

  • Architecture

    • Highlights

      • Decentralized microservice architecture
      • Project architecture based in onion architecture
      • CI / CD pipelines with GitHub Actions
      • K8s deployment
  • Related projects


About

Maximize total spent of a MercadoLibre voucher

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages