CRM · Customer loyalty — cards & stamps

Shows the customer’s loyalty cards per campaign with their stamp counts, and lets staff manually add stamps or exchange a completed card.

AreaCRM
Routescrm.users.edit
Centre modulesloyalty-cards
Staff levelsroot · admin · manager · crmmanager · crmoperator · weboperator
Modelscampaign · loyalty-card · ticket
UI labelticket.loyalty-card
Coverage3 use cases · 2 happy · 3 failure

How it works

createStamps is guarded by validateStampNumber(amount, campaign), which refuses an amount larger than the campaign’s stamp quota. createStampsModalCampaigns narrows the picker to campaigns that can still take stamps. exchangeStamps consumes a completed card. Unredeemed stamps are surfaced separately (loyalty-cards.unredeemed-stamps).

Use cases

Why someone opens this (3)

  • Compensating a customer whose stamp was not registered at the till.
  • Redeeming a completed card for its reward at the desk.
  • Explaining to a customer how many stamps they still need.

Path map

flowchart LR
    F(["Customer loyalty — cards and stamps"]):::feat
    F --> H1["Stamps granted manually"]:::ok
    F --> H2["Completed card exchanged"]:::ok
    F -.-> X1["Too many stamps requested"]:::bad
    F -.-> X2["Card generation fails"]:::bad
    F -.-> X3["Exchange fails"]:::bad
    classDef feat fill:#157068,stroke:#157068,color:#ffffff,font-weight:bold
    classDef ok fill:#e3f1ea,stroke:#0d6b42,color:#0d4a2e
    classDef bad fill:#f7e6e2,stroke:#9a2d1c,color:#6e1f13

Happy paths

Stamps granted manually

  1. Operator opens the loyalty-cards step and selects a campaign.
  2. Opens the create-stamps modal and enters an amount within the campaign’s quota.
  3. validateStampNumber passes and the stamps are created.
  4. loyalty-cards.generate-success-message confirms and the card’s count updates.

Completed card exchanged

  1. Operator opens the exchange-stamps modal for a full card.
  2. Confirms; the stamps are consumed and the card moves to its exchanged state.

Failure paths

QA checklist

Tick these off while regression-testing this feature. The boxes are plain Markdown, so progress is visible in git diffs.

  • ✅ Stamps granted manually
  • ✅ Completed card exchanged
  • ⛔ Too many stamps requested
  • ⛔ Card generation fails
  • ⛔ Exchange fails

Implementation


Generated from doc/feature-inventory.json · id crm-customer-loyalty-cards · commit 276788ca6