Assuming you have Elixir already installed, run mix deps.get && mix compile
in the project folder.
- Run
iex -S mix
and alias the store module so it's easier to use the functions:
alias NovicapChallenge.Store
- Load products with json file. They should be stored in
./products
. Calling without arguments loads the defaultproducts.json
file.
Store.load_products()
- Scan products.
Store.scan("VOUCHER")
- Add rules. Current rules are:
NovicapChallenge.Rules.DoubleVoucherRule
andNovicapChallenge.Rules.ShirtRule
.
Store.add_rule(NovicapChallenge.Rules.DoubleVoucherRule)
Store.add_rule(NovicapChallenge.Rules.ShirtRule)
- Check the total.
Store.total
run mix test