Platform Architecture Overview¶
Document Control:
* Publisher: Flavius Narokobi
* System Version: Odoo 17.0 Enterprise Loyalty Release v2.7.0
* Infrastructure: Google Cloud Platform (odoo-production-vm, zone asia-east1-b)
* Last Updated: October 4, 2026
* Status: Production Certified
1. High-Level Modular Architecture¶
The CPL Real Rewards Loyalty Platform is built upon Odoo 17.0 running in isolated Docker containers behind an enterprise Nginx reverse proxy. Custom loyalty functions, POS ingestion pipelines, and security mechanisms are partitioned into dedicated modular addons:
graph TD
UI["cpl_real_rewards_ui<br/>(Decluttered 5-Tab Navbar, Ribbons, Wizards)"]
Loyalty["real_rewards_loyalty<br/>(Points Engine, Ledgers, Demographics)"]
Importer["real_rewards_importer<br/>(POS Ingestion, Quarantine Routing)"]
Security["real_rewards_security<br/>(Dual Control, RBAC, TOTP, SSO)"]
Mailer["real_rewards_api_mailer<br/>(Transactional Customer Notifications)"]
UI --> Loyalty
UI --> Importer
UI --> Security
Loyalty --> Importer
Module Responsibilities:¶
cpl_real_rewards_ui:- Manages top-level application branding and the 5-Tab Navigation Layout (
Dashboard,Members,Redemptions,Governance & Queues,Reporting,Configuration). - Houses form ribbons (e.g. red Card Blocked ribbon), status badges, and action wizards (Card Swap, Quarantined Card Claim).
real_rewards_loyalty:- Maintains the immutable ledger table
real_rewards_loyalty_ledger. - Enforces the integer truncation rule: $\lfloor\text{Spend}\rfloor = \text{Points}$ (K45.95 $\rightarrow$ 45 Points).
- Manages primary retail shop attributions (CP Waigani Central, HHL Waterfront, etc.).
real_rewards_importer:- Parses POS transaction feeds and batch CSV files.
- Matches incoming card scans against the 138,459 Golden Records.
- Auto-routes unknown card numbers into
real_rewards_quarantine_queuewith Zero Pollution of member contacts. real_rewards_security:- Enforces segregation of duties between Branch Makers and Head Office Checkers.
- Administers 2FA TOTP authentication and Microsoft Entra ID SSO integration.
2. Golden Record Data Model & Schema Relationships¶
To prevent duplicate member profiles when physical cards are lost or swapped, the data model anchors member identities to an immutable member record in res.partner:
erDiagram
RES_PARTNER ||--o{ REAL_REWARDS_LOYALTY_LEDGER : "has transactions"
RES_PARTNER ||--o{ REAL_REWARDS_CARD_REPLACEMENT_LOG : "card swap history"
RES_PARTNER ||--o{ REAL_REWARDS_PROFILE_CHANGE_REQUEST : "maker-checker changes"
REAL_REWARDS_QUARANTINE_QUEUE ||--o| RES_PARTNER : "claimed to member"
STOCK_LOCATION ||--o{ REAL_REWARDS_LOYALTY_LEDGER : "store attribution"
RES_PARTNER {
int id PK
string member_uuid "Permanent RFC-4122 v4 Global Identity Anchor"
string name "Customer Full Legal Name"
string rrp_card_number "Active Physical Card (Mutable Token)"
int loyalty_points_available "Live Till Balance"
boolean is_real_reward_customer "Loyalty Member Flag"
boolean is_card_blocked "Fraud Lockout Flag"
boolean is_unclaimed_record "Legacy Flag (0 active)"
}
REAL_REWARDS_LOYALTY_LEDGER {
int id PK
int partner_id FK
int points_amount "Integer points (+ / -)"
string transaction_type "PS, PB, RD"
string order_reference "POS Order Ref"
datetime transaction_date
int shop_id FK
}
REAL_REWARDS_QUARANTINE_QUEUE {
int id PK
string card_number "Unknown / Unregistered Card"
string order_id "POS Receipt Reference"
int uncaptured_points "Accrued Points"
numeric subtotal "Kina Spend"
string state "quarantined / claimed"
int partner_id FK "Claimed Target Profile"
}
3. The Member UUID (RFC-4122 v4) Primary Identity Architecture & Business Importance¶
Why Physical Cards Fail as Identity Keys¶
In traditional retail loyalty platforms (such as legacy Pronto ERP), the printed card barcode was treated as the customer's account number. This design suffers from fatal operational flaws:
1. Cards are consumable physical media: Cards are lost, stolen, damaged, or upgraded. When a card is replaced, treating the card number as the primary key creates fragmented duplicate accounts, misplaces points balances, and confuses checkout till operators.
2. Security & Privacy Risks: Physical card numbers are easily visible, photographed, or guessed if sequential. Exposing internal sequence IDs (id=713571) or physical card numbers across mobile apps and third-party APIs creates security enumeration vulnerabilities.
The 4 Pillars of Member UUID Importance in CPL Real Rewards¶
graph TD
UUID["<b>Permanent Member UUID (RFC-4122 v4)</b><br/><i>e.g. be5fb2e3-3d75-4594-a4e5-549acc9d2e57</i><br/>(Immutable Primary Key — Never Changes)"]
P1["<b>1. Decoupled Identity</b><br/>Identity is permanent; plastic cards are consumable tokens."]
P2["<b>2. Zero-Loss Lineage</b><br/>All 15,553 past card swaps & future cards append to this UUID."]
P3["<b>3. Zero-Trust API Security</b><br/>Tamper-proof, non-sequential identifier for Mobile Apps & APIs."]
P4["<b>4. Database Invariant</b><br/>PostgreSQL unique constraint with auto-generation on creation."]
UUID --> P1
UUID --> P2
UUID --> P3
UUID --> P4
Pillar 1: Decoupling Identity from Physical Media¶
The customer's identity is anchored to an immutable RFC-4122 v4 UUID (res_partner.member_uuid, e.g. be5fb2e3-3d75-4594-a4e5-549acc9d2e57). The customer's legal name, phone number, email, demographic tier, and lifetime loyalty points balance are attached directly to this UUID. The physical card (rrp_card_number) is merely an active presentation token. If a member replaces their card 5 times over 10 years, their member_uuid and points balance remain 100% unified.
Pillar 2: Complete Historical Card Lineage Preservation¶
Every physical card ever issued to a member is recorded as a child record in real.rewards.card.replacement.log with a foreign key back to the member profile:
* If a customer presents their current active card, points accrue immediately.
* If a customer accidentally presents an old, retired card, the POS ingestion engine traverses the replacement lineage, maps the transaction to the member's master UUID, and credits the active balance. Zero points are lost, and zero orphan guest accounts are spawned.
Pillar 3: Zero-Trust Security & Modern Omnichannel Integration¶
Mobile applications, web customer care portals, e-commerce checkouts, and external airline/telecom loyalty partners interact exclusively via the member_uuid. Because RFC-4122 v4 UUIDs are 128-bit cryptographically random strings (36 characters including hyphens), they cannot be guessed, spoofed, or scraped.
Pillar 4: Inviolable Database Invariant & Automatic Enforcement¶
- Schema Integrity: Protected by PostgreSQL unique constraint
res_partner_unique_member_uuidwith a high-performance B-tree index. - 100% Population: Verified across all 138,459 active loyalty members with zero null values.
- Automated Generation: In
res.partner, Odoo lifecycle methodscreate()andwrite()automatically generate a standard v4 UUID whenever a new member is registered or an existing partner is converted to Real Rewards.
4. The POS Ingestion & Quarantine Pipeline¶
Every transaction originating from checkout registers across City Pharmacy and Stop & Shop branches passes through the hardened ingestion pipeline:
sequenceDiagram
autonumber
actor Customer
participant Till as POS Checkout Till
participant Engine as Importer Engine
participant Registry as Golden Records (138,459)
participant Quarantine as Quarantine Queue (2,455)
participant Ledger as Loyalty Ledger (258,021)
Customer->>Till: Presents Card at Checkout
Till->>Engine: Send Transaction (Card, Spend, Items)
Engine->>Registry: Lookup rrp_card_number
alt Card Found in Golden Records
Registry-->>Engine: Match Confirmed (Partner ID)
alt is_card_blocked == True
Engine->>Quarantine: Isolate as Blocked Card Scan (0 Pts to Till)
else Active Card
Engine->>Ledger: Append Transaction Line (Integer Truncated Points)
Engine->>Registry: Increment loyalty_points_available
end
else Card NOT Found in Golden Records
Engine->>Quarantine: Create Quarantine Record (Unknown Card Scan)
Note over Quarantine: Till Balance = 0 Pts<br/>Points Safely Preserved in Quarantine
end
4. Zero Points Leakage & Governance Safeguards¶
- Integer Floor Point Accrual:
- In strict compliance with CPL loyalty rules, points never accrue as decimals. A purchase of K100.99 earns exactly 100 Points. Decimal precision errors are eliminated at the PostgreSQL database level.
- Till Balance Isolation for Quarantined Cards:
- Unregistered cards scanned at checkout have their spend and uncaptured points safely staged in
real_rewards_quarantine_queue. Because these cards have no partner profile, their live till balance is strictly0 Pts, preventing unauthorized voucher issuance. - Instant Fraud Lockout for Blocked Cards:
- The 5 identified compromised cards have
is_card_blocked = True. Theirloyalty_points_availableis locked at0, and any subsequent scan auto-diverts into the Quarantined Cards Queue.