Given an auction system, there are several ways to apply a discount to the transaction's final amount, e.g.
- Special discount for a given seller
- discount for a given buyer
- Discount for a specific buyer and item combo
etc...
Given how confusing and complex the business logic could be for discounts, there is a proposal to move all discount logic into one object called "discount" and create one table/class with all the possible discounts with the columns/properties: name, discount amount, discount rules, and discount type. Discount objects would map to things like buyer or item through an intermediate target mapping object.
This all feels a bit complicated and maybe we should have different discount amounts set to objects attached to the different underlying objects, e.g. in the seller object, as a collection of discount situations to a buyer, etc..
Which is the better approach, creating one discount object to rule them all or implementing in each scenario separately, letting the auction logic look for discount values/collections in each object it processes?