This is an old revision of the document!
The restrictive discount feature in the Boutique Web Application
The Boutique store sells clothing online: the catalogue of this boutique can
be viewed on a website, and clients can place their orders online. A client adds products from the catalogue to a virtual shopping cart in a dedicated page, which displays each product added with its price. Besides, this page contains a checkout form asking for a desired payment method.
Now, consider that we need to add the discount restrictive feature, which potentially adds a different discount for each product when it is added to the shopping cart. The discounts are applied when the client does checkout. Each discount is only valid for a period of time; however, the discount feature must respect the discount that was active when the product was added to the shopping cart. The restrictive discount feature limits the number of discounts are really applied (say three): they are the discounts that generate the best benefits for the client.
The implementation follows: Toggle between the code and example