HOCO B2B
Team tasksAnis

SRV-44 — Earning rules engine, stacking, campaigns, Happy Days

Rule-driven points per line, campaigns, stacking and calculation order, with a trace of every calculation.

FieldDetails
Task codeSRV-44
PhaseP4 — V2 evolutions
Product scopeV2
StatusPlanned
StartMon 22 Feb 2027
DueWed 24 Feb 2027
ResponsibleAnis — Full-stack developer
Co-responsible—
Effort3 person-day(s) planned · 8 from scratch · size M
Area · appServer · server
Depends onSRV-30, SRV-43
UnblocksSRV-45
Milestones—

Summary

Rule-driven points per line, campaigns, stacking and calculation order, with a trace of every calculation.

Description

Change request 04 (client loyalty document and letter of 6 Nov 2026), not yet accepted or priced by HOCO. Replaces the single earning rate of SRV-30 with LoyaltyRule and LoyaltyCampaign: barème by product, brand, category, quantity or amount; order-value and selected-product bonuses; occasions, Happy Days in Algiers time and first-N new-product campaigns; stacking and the calculation order of BR-91; LoyaltyCalculation for line-level reversals and explanations; the simulator. Out of scope: levels (SRV-45), cashback (SRV-46).

Subtasks

#SubtaskOwner
1LoyaltyRule and LoyaltyCampaign with admin.loyalty.rules.* and admin.loyalty.campaigns.*Anis
2Line-by-line calculation, barème resolution, rounding, LoyaltyCalculationAnis
3Stacking modes and calculation orderAnis
4Campaign schedule job and first-N beneficiariesAnis
5Reversal per line, modification, regularisation (BR-94)Anis
6admin.loyalty.simulateAnis

Deliverables

  • apps/server/src/modules/loyalty/{rules,campaigns,calculation}.service.ts
  • Prisma migration for rules, campaigns and calculations

Acceptance criteria

  • 300 points on the chargers and TWS example before bonus (LOY-08)
  • 100 base, ×2, Bronze +10 % gives 220 (LOY-11)
  • No multiplier outside a campaign window (LOY-10)
  • A partial return removes only the returned lines' points (LOY-02)
  • The 51st reseller of a 50-place campaign gets no multiplier (LOY-13)

Requirements covered

RequirementTitleRelease
LOY-01Points earned per order line, credited after delivery or payment (setting), bonusesV2
LOY-02Points expiry, adjustments, reversal and regularisation on cancellation or returnV2
LOY-08Earning rules: barème by product, category, brand, quantity or amount, set in the back-officeV2
LOY-09Order-value bonuses and bonuses on selected productsV2
LOY-10Occasion campaigns and Happy Days with Algiers time windowsV2
LOY-11Campaign stacking and the calculation orderV2
LOY-13New-product campaign for the first N buyersV2

API surface

Endpoint groupOperations
Promotions & loyalty41
Loyalty (V2)23

Test measures

  • Table tests of the calculation
  • Fake-clock tests around Algiers midnight
  • Concurrency test on the last first-N place

Risks

  • Barème and stacking not decided (D-45, D-53): every value is data

KPI

  • Delivered by Wed 24 Feb 2027 within 3 person-day(s).
  • Every acceptance criterion above demonstrated before hand-off; linked requirements' acceptance criteria pass.
  • Zero open critical defects, permission gaps or data-integrity regressions at sign-off.

Generated from content/plan/tasks.json by scripts/generate-team-tasks.mjs. Dates are computed by the scheduler (Sunday–Thursday weeks, holidays excluded) — change the plan, not this page.

On this page