Development #7129
Updated by Kyle Chong 3 months ago
Refer to: docs/planning/modules/M05_Discount_Engine.md Implement the reusable discount calculation engine rather than embedding discount calculations directly in the Cart UI. Scope: * Calculate percentage discounts. * Calculate fixed-amount discounts. * Support line and receipt discount calculations. * Support configured calculation sequence. * Support multiple applicable discounts where allowed. * Prevent combinations that are not allowed. * Support mutually exclusive discount rules where required. * Apply consistent rounding. * Return structured discount results to M03. * Keep the engine independent from UI and transport logic. Expected concept: Cart/Line → Discount Engine → Discount Result → Cart Recalculation Done when: M03 can pass cart/line data into (M05) (docs/planning/modules/M05_Discount_Engine.md). At payment, save the engine applied rule code/name/type, rule JSON, calculated amount and receive approver/override information. Done when changing a consistent, auditable discount result. promotion later cannot alter an old receipt explanation.