A cap that works on any coupon: Decorator
transcript
A coupon takes 10 percent off, up to 80 rupees. Where does the cap live?
Ten percent of 1140 is 114. The cap is 80. So the discount is 80, not 114.
A cap field on every rule means each rule repeats the check. A new rule forgets it. A wrapper holds any coupon, so the cap works for all.
The engine asks the capped coupon. The capped coupon asks percent off. Neither one knows about the listeners. Percent off answers 114. The cap returns the smaller one, 80.
A minimum-cart wrapper has the same shape. It is a coupon, and it holds one. So a wrapper can hold another wrapper. Test the order you ship, because order can matter. That's the whole point of the shape.
If it adds to any rule, rather than replacing one, it's a decorator. Same interface, and it holds one. That's why it stacks.
Full breakdown in the lecture.