Tool that calculates the applicable discount given a list of discount bundle, a list of product and the products in the cart
- Python ^3.7
- Poetry
- Click
First of all if you don't have done yet install poetry.
pip install --user poetry
Clone the repo
git clone git@github.com:debiff/discountCalculator.git
Use Poetry to install all the dependencies of the project in a fresh virtual environment.
cd discountCalculator
poetry install
Activate the virtualenv and install the package:
poetry shell
pip install --editable .
To compute the discount run
discount_calculator --cart ABC
Options:
- --cart(required): The products in the cart comma separated.
- --bundle(optional): Location of JSON file containing the bundles
- --products(optional): Location of JSON file containing the products
To run the test suite execute from root
python -m unittest discover tests/