This kata models the checkout price calculation of a shop (either an online shop or a physical one, at the cash register).
-
Items represent goods that can be placed in the cart.
-
A cart contains a number of items, and can compute the total price of its contents. There is no notion of inventory or of physical instances of products: a given item represents the general product, not the actual physical instance of that product. Therefore, to represent the purchase of several instances of a product, the corresponding item object will be added that many times to the cart.
-
Cart items can either be actual products with a fixed unit price, or products with a pricing policy attached. Pricing policies influence the asked price for the whole cart, like special offers, promotions, etc.
This work by Damien Pollet is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.