Pluton / Visual Lab
Subtle - Hardcore

[Blocker] Build 52: Fix item-level promo discount bug

Published on May 14, 2026

# Berburu Bug Diskon: Memastikan Promo Tepat Sasaran di POS DRW Skincare! Aku baru --- ### Raw Commit Data ## GitHub Update **Repository:** [MKWcorp/POS-DRW-Skincare](https://github.com/MKWcorp/POS-DRW-Skincare) **Author:** MKWcorp **Date:** 5/14/2026, 8:02:15 AM **Commit:** [`70aad00`](https://github.com/MKWcorp/POS-DRW-Skincare/commit/70aad000647f9b9c5eb2bcd876259f59dce17b0c) ### Commit Message Build 52: Fix item-level promo discount bug CRITICAL FIX: Promo discount now applies only to target items, not entire cart Problem: - When applying promo with targetItems (e.g., 50% off Serum Retinol) - Discount was calculated on TOTAL cart subtotal - Example: Cart Serum 105k + Other 50k = 155k total - Bug: Discount = 50% × 155k = 77.5k (WRONG) - Expected: Discount = 50% × 105k = 52.5k (CORRECT) Solution: - NEW PromoCartItem class: tracks productId + subtotalAmount per item - NEW eligibleSubtotal calculation: filters cart by targetProductIds - Discount now applies to eligibleSubtotal (eligible items only) - min_purchase check still uses total subtotal (intentional) Files changed: - promo_calculator.dart: PromoCartItem class + eligibleSubtotal logic - checkout_screen.dart: Extract promoCartItems with item-level prices - promo_picker_card.dart: Pass cartItems to 2 PromoCalculator calls - promo_preview_dialog.dart: Add cartItems parameter - promo_preview_repository.dart: Server-side validation (NEW) - AGENTS.md: Pro Tip #27 + Build 52 changelog Additional updates: - Order filter by promo campaigns (order_filter_sheet.dart) - Promo display in order cards (order_item_card.dart) - Receipt promo summary (receipt_payment_summary.dart) Result: - Accurate item-level discount calculation - eligibleSubtotal tracked in PromoCalculation for audit - 0 analyzer errors --- _This story was imported from historical commits._