1.4 KiB
1.4 KiB
Implementer — F-019 Promotions v1
Summary
Implemented server-side promo codes with percent/fixed-amount rules, validity/usage validation, cart promo-code application, and recalculated discounts during cart reads.
Files changed
project/migrations/014_promotions.jsproject/src/modules/promotions/**project/src/modules/cart/**project/src/app/build-app.tsproject/src/app/tests/promotions.itest.ts
Acceptance evidence
- AC1 valid promo:
promotions.itest.tsappliesSAVE10; cart returns server-calculated discount and reduced total. - AC2 expired/exhausted promo:
promotions.itest.tsverifies HTTP 422 for expired and usage-limit exhausted codes. - AC3 client-supplied discount ignored: promo and cart schemas strip unknown discount fields; cart stores only selected promo code, not discount amount.
verify.sh: passed.
Commands run
cd project && npm run lint— passedcd project && npm run typecheck— passedcd project && npm run build— passedcd project && npm test— passedcd project && TEST_DATABASE_URL='postgres://mdv:mdv_dev_only@localhost:5432/mdv_test' npm run test:integration -- promotions.itest migrations.itest— passed; 11 files, 44 tests./scripts/verify.sh— passed
Notes
- No stacking in v1: one
promo_codeper cart. - Usage count is validated for exhaustion; consumption/increment can be tied to checkout/order completion in a later feature.