Loyalty System
Internal system that calculates, stores and reverses customer loyalty points in response to order events.
Overview
The Loyalty System turns orders into rewards. The Loyalty ServiceLoyalty ServiceServicev1.0.0Awards loyalty points when orders complete and reverses them when orders are cancelled. Owns the points ledger and custo...Publishesloyalty-points-earned, loyalty-points-reversedSubscribesorder-completed, order-cancelledOwnercustomer-platformMapRepoView docs consumes Order CompletedOrder CompletedEventv1.0.0Published when an order has been fulfilled and completed.
Ownerordering-platformSchemaMapView docs and Order CancelledOrder CancelledEventv1.0.0Published when an order has been cancelled.
Ownerordering-platformSchemaMapView docs from the Order Management SystemOrder Management SystemSystemv1.0.0Internal system that is the source of truth for orders. It creates orders, tracks their lifecycle, and publishes events ...Ownerordering-platformMapView docs, updates balances in the Loyalty DatabaseLoyalty DatabaseContainerv1.0.0
PostgreSQL database that holds the loyalty points ledger and each customer's points balance.Ownercustomer-platformMapView docs, and publishes points events for the rest of the business.
Resource Diagram
The services and messages that make up this system.
What’s inside
| Component | Type | Responsibility |
|---|---|---|
| Loyalty ServiceLoyalty ServiceServicev1.0.0 | Service | Awards and reverses loyalty points and maintains balances. |
| Loyalty DatabaseLoyalty DatabaseContainerv1.0.0 | Data store | Points ledger and customer balances. |
Messages this system sends
- Loyalty Points EarnedLoyalty Points EarnedEventv1.0.0Published when a customer earns loyalty points for a completed order. Ownercustomer-platformSchemaMapView docs — points were awarded for a completed order.
- Loyalty Points ReversedLoyalty Points ReversedEventv1.0.0Published when loyalty points are removed from a customer because the order that earned them was cancelled. Ownercustomer-platformSchemaMapView docs — points were removed after an order was cancelled.