This project is a API for calculation packs to fulfil the order.
Rules for calculation:
Items ordered | Correct number of packs | Incorrect number of packs |
---|---|---|
1 | 1 x 250 | 1 x 500 |
250 | 1 x 250 | 1 x 500 |
251 | 1 x 500 | 2 x 250 |
501 | 1 x 500, 1 x 250 | 1 x 1000 OR 3 x 250 |
12001 | 2 x 5000, 1 x 2000, 1 x 250 | 3 x 5000 |
by default PACK_SIZES: "5000,2000,1000,500,250" to change the PACK_SIZES, you can change the environment variable PACK_SIZES in docker-compose.yml
docker-compose up
Then go to http://localhost
docker-compose down
go test -v ./...