CPG-CRM FSD Setting Rule
FSD — Admin CRM
A. Document controlA. Kiểm soát tài liệu
| Doc ID | CPG-FSD-CPG-CRM_FSD_Setting_Rule |
|---|---|
| VersionPhiên bản | 1.0 |
| StatusTrạng thái | Draft |
| Owner | CPG BA / Architecture |
| AudienceĐối tượng | Frontend, Backend, FlyPay Support, QA, Product |
| ClassificationPhân loại | Internal |
| Effective dateNgày hiệu lực | 01/12/2026 |
| Related docs | Admin CRM Index · BR/NFR Catalog |
B. Version historyB. Lịch sử phiên bản
| Version | Date | Author | ChangesThay đổi |
|---|---|---|---|
| 1.0 | 01/12/2026 | Khoa Trinh | Version 1.0 |
C. Table of contentsC. Mục lục
- 1. Module Scope
- 2. User Roles
- 3. Functional Requirements
- 3.1 Features
- 3.2 Use Cases
- 4. User Interface
- 4.1 Rules Management Tab
- 4.2 Edit Rule Modal
- 4.3 Wallet Whitelist Tab
- 4.4 Add Wallet Address Modal
- 5. Data Requirements
- 5.1 Data Dictionary
- 5.2 Data Models
- 6. API Routes
- 6.1 Fraud Rules APIs
- 6.2 Fraud Rule Categories APIs
- 6.3 Risk Threshold APIs
- 6.4 Wallet Whitelist APIs
- 6.5 Audit APIs
D. ContentD. Nội dung
1. Module Scope
Module name: Rules Based Fraud Setting
Purpose
- Allow Risk/Compliance admins to define, maintain, and monitor fraud detection rules used for transaction risk assessment (KYT).
- Provide risk-score visualization (matrix + category breakdown).
- Maintain a Wallet Whitelist to bypass selected fraud rules for trusted wallets, with validity windows and audit trail.
In-scope
- Rules Management tab
- View KPIs: Total Active Rules, Max Risk Score, Enabled Rules, Categories
- Risk Score Matrix (Low/Medium/High/Critical)
- Category Breakdown (counts + total points)
- Search + filter by Category/Status
- Rules list table (Rule ID, Name, Category, Condition, Risk Points, Status)
- Edit rule modal (update fields + enable/disable)
- Wallet Whitelist tab
- View whitelist KPIs (Whitelisted wallets, Added this month)
- Search wallet addresses
- Add wallet address modal (address, blockchain, valid from/to, reason)
- Edit/Delete wallet entries
2. User Roles
Role Name | Description |
|---|---|
System Administrator | Overall system owner responsible for platform configuration and security |
Risk Manager | Oversees fraud detection policies and risk scoring strategy |
Compliance Officer | Ensures compliance with regulatory and internal risk policies |
Technical Admin | Maintains technical accuracy of rule conditions and system integrity |
Merchant Support | Handles merchant or customer inquiries related to blocked transactions |
3. Functional Requirements
3.1 Features
3.1.1 Dashboard KPIs & Summary Cards
- Display:
- Total Active Rules (count of rules where status=ENABLED)
- Max Risk Score (maximum achievable score under current enabled rules; or max single rule points depending on definition—recommend “sum of enabled rule points per category” configurable)
- Enabled Rules (enabled/total)
- Categories (count of categories with ≥1 rule)
3.1.2 Risk Score Matrix
- Configurable thresholds:
- Low Risk: 0–14
- Medium Risk: 15–24
- High Risk: 25–39
- Critical Risk: >=40
- Thresholds should be stored as configuration (auditable).
3.1.3 Category Breakdown
- Show each category with:
- number of rules in category
- total points (sum of risk_points for enabled rules in category)
- Example categories shown: Velocity, Amount, Location, Behavior, Device, Pattern, Technical
3.1.4 Rules List + Search/Filter
- Filters:
- Search by rule ID/name/condition text
- Category filter (All Categories)
- Status filter (All Status: Enabled/Disabled)
- Table columns:
- Rule ID, Rule Name (with subtitle description), Category, Condition, Risk Points (+ risk severity label), Status, Actions (Edit)
3.1.5 Edit Fraud Detection Rule (Modal)
- Editable fields (based on modal):
- Rule Name
- Description
- Category (dropdown)
- Risk Points (integer)
- Condition (string expression)
- Enable Rule (toggle)
- Rule ID is read-only.
- Save Changes validates:
- Required: name, category, risk_points, condition
- risk_points within allowed bounds (e.g., 0–100)
- condition syntax basic validation (non-empty; optional: parser validation)
3.1.6 Rule Enable/Disable Behavior
- Toggle in edit modal controls status:
- Enabled -> used by evaluation engine
- Disabled -> excluded from evaluation engine and KPI counts
3.1.7 Wallet Whitelist Overview + Search
- Displays KPI:
- Whitelisted wallets count (active entries by time window)
- Added this month count
- Search by wallet address or ID (if whitelist_id exists)
- Table columns (from UI):
- Wallet Address, Blockchain, Reason, Added Datetime, Added By, Actions (Edit/Delete)
3.1.8 Add Wallet Address to Whitelist (Modal)
- Fields:
- Wallet Address (required)
- Blockchain (required)
- Valid From / Valid To (optional but recommended; if omitted, treated as “effective immediately” / “no expiration”)
- Reason (dropdown + optionally allow free text)
- Validation:
- Wallet address format per chain (basic regex; deeper checksum optional)
- valid_to >= valid_from if both provided
- Prevent duplicates:
- Same (wallet_address, blockchain) overlapping validity window should be blocked or require explicit replace
3.1.9 Whitelist Bypass Rules (Behavior)
- When a wallet is whitelisted and within validity window:
- It can bypass selected fraud detection rules.
- Two modes (recommend configurable):
- Bypass all rules (simple)
- Bypass selected rules/categories (store mapping)
- UI text says “bypass selected fraud detection rules” -> implement mode (2) in data model even if UI doesn’t expose selection yet.
3.1.10 Edit/Delete Whitelist Entry
- Edit: update reason and validity window; wallet address and blockchain should be immutable (or require delete+add)
- Delete: soft-delete recommended (auditable)
3.1.11 Audit Logging (Mandatory)
- Log all changes:
- rule updates, enable/disable
- whitelist add/edit/delete
- threshold config changes (risk matrix)
- Store actor, timestamp, before/after snapshot, and correlation ID.
3.2 Use Cases
Detailed use-case catalog for this module is maintained under 08_UC:Catalog use case chi tiết của module này được quản lý tại 08_UC:
4. User Interface
4.1 Rules Management Tab

- Header: “Rules Based Fraud Detection”
- Tabs:
- Rules Management (default)
- Wallet Whitelist
- KPI cards row: Total Active Rules / Max Risk Score / Enabled Rules / Categories
- Risk Score Matrix: 4 severity tiles with point ranges
- Category Breakdown: category tiles showing rule counts + total points
- Filters: Search input + Category dropdown + Status dropdown
- Rules table:
- Row shows rule id (FR-001…), name + description
- Category badge + icon
- Condition displayed as code chip
- Risk points pill with severity label
- Status pill (Enabled/Disabled)
- Action: Edit (pencil)
4.2 Edit Rule Modal

- Title: “Edit Fraud Detection Rule”
- Fields: Rule ID (read-only), Rule Name, Description, Category dropdown, Risk Points, Condition, Enable Rule toggle
- Buttons: Cancel / Save Changes
4.3 Wallet Whitelist Tab

- KPI cards: Whitelisted wallets, Added this month
- Search input: by wallet address or ID
- Button: “+ Add Wallet Address”
- Table: address (clickable), blockchain, reason, added datetime, added by, actions (edit/delete)
4.4 Add Wallet Address Modal

- Fields: Wallet Address, Blockchain dropdown, Valid From, Valid To, Reason dropdown
- Note block explaining whitelist behavior
- Buttons: Cancel / Add Wallet Address
5. Data Requirements
5.1 Data Dictionary
Field | Type | Description |
|---|---|---|
id | UUID | Primary key |
rule_code | VARCHAR(32) | Human-readable rule ID (e.g. FR-001) |
name | VARCHAR(255) | Fraud rule name |
description | TEXT | Detailed explanation of the rule |
category_code | VARCHAR(64) | Rule category (Velocity, Amount, Location, etc.) |
condition_expression | TEXT | Logical condition evaluated by the rule engine |
risk_points | INT | Risk score added when rule is triggered |
severity_code | VARCHAR(32) | Derived severity (LOW, MEDIUM, HIGH, CRITICAL) |
status | ENUM | ENABLED, DISABLED |
version | INT | Optimistic locking version |
created_at | TIMESTAMP | Record creation time |
created_by | UUID | User who created the rule |
updated_at | TIMESTAMP | Last update time |
updated_by | UUID | User who last updated the rule |
Field | Type | Description |
|---|---|---|
id | UUID | Primary key |
category_code | VARCHAR(64) | Unique category identifier |
name | VARCHAR(128) | Display name |
description | TEXT | Category description |
icon | VARCHAR(64) | UI icon reference |
sort_order | INT | Display order |
status | ENUM | ACTIVE, INACTIVE |
created_at | TIMESTAMP | Creation timestamp |
created_by | UUID | Created by user |
updated_at | TIMESTAMP | Last updated timestamp |
updated_by | UUID | Updated by user |
Field | Type | Description |
|---|---|---|
id | UUID | Primary key |
threshold_code | VARCHAR(32) | LOW, MEDIUM, HIGH, CRITICAL |
min_points | INT | Minimum inclusive score |
max_points | INT | Maximum inclusive score (NULL = unlimited) |
color_token | VARCHAR(32) | UI color reference |
is_active | BOOLEAN | Whether threshold is active |
effective_from | TIMESTAMP | Effective start datetime |
effective_to | TIMESTAMP | Effective end datetime |
created_at | TIMESTAMP | Creation timestamp |
created_by | UUID | Created by user |
Field | Type | Description |
|---|---|---|
id | UUID | Primary key |
whitelist_code | VARCHAR(32) | Optional human-readable code |
wallet_address | VARCHAR(128) | Blockchain wallet address |
blockchain_code | VARCHAR(32) | Blockchain (BSC, ETH, Polygon, etc.) |
valid_from | TIMESTAMP | Validity start |
valid_to | TIMESTAMP | Validity end |
reason_code | VARCHAR(64) | Predefined reason |
reason_text | TEXT | Detailed reason |
status | ENUM | ACTIVE, EXPIRED, REVOKED |
added_at | TIMESTAMP | Date added |
added_by | UUID | User who added |
updated_at | TIMESTAMP | Last updated |
updated_by | UUID | Updated by user |
revoked_at | TIMESTAMP | Revocation time |
revoked_by | UUID | User who revoked |
Field | Type | Description |
|---|---|---|
id | UUID | Primary key |
wallet_whitelist_id | UUID | Reference to wallet whitelist |
bypass_type | ENUM | ALL, CATEGORY, RULE |
category_code | VARCHAR(64) | Category bypassed (if applicable) |
fraud_rule_id | UUID | Specific rule bypassed (if applicable) |
created_at | TIMESTAMP | Creation time |
created_by | UUID | Created by user |
Field | Type | Description |
|---|---|---|
id | UUID | Primary key |
entity_type | ENUM | FRAUD_RULE, CATEGORY, THRESHOLD, WHITELIST |
entity_id | UUID | Target entity |
action | ENUM | CREATE, UPDATE, ENABLE, DISABLE, DELETE, REVOKE |
before_json | JSON | Data before change |
after_json | JSON | Data after change |
actor_user_id | UUID | Acting user |
actor_role | VARCHAR(64) | Role at execution time |
request_id | VARCHAR(64) | Correlation ID |
created_at | TIMESTAMP | Audit timestamp |
5.2 Data Models
- fraud_rule_categories (1) - (N) fraud_rules
- wallet_whitelists (1) - (N) wallet_whitelist_bypass
Enum Name | Allowed Values | Description |
|---|---|---|
fraud_rule.status | ENABLED, DISABLED | Rule availability |
category.status | ACTIVE, INACTIVE | Category availability |
whitelist.status | ACTIVE, EXPIRED, REVOKED | Whitelist lifecycle |
bypass_type | ALL, CATEGORY, RULE | Bypass scope |
risk_severity | LOW, MEDIUM, HIGH, CRITICAL | Derived from thresholds |
6. API Routes
Base path: /api/v1
6.1 Fraud Rules APIs
Method | Route | Purpose | Notes |
|---|---|---|---|
GET | /risk/fraud-rules | List fraud rules | Search, filter, pagination |
GET | /risk/fraud-rules/{id} | Get rule detail | By ID or rule code |
POST | /risk/fraud-rules | Create rule | Admin only |
PUT | /risk/fraud-rules/{id} | Update rule | Update condition, points |
PATCH | /risk/fraud-rules/{id}/status | Enable / Disable rule | Status toggle |
GET | /risk/fraud-rules/summary | Rules overview KPIs | Counts & totals |
6.2 Fraud Rule Categories APIs
Method | Route | Purpose | Notes |
|---|---|---|---|
GET | /risk/fraud-rule-categories | List categories | For filters & dropdowns |
POST | /risk/fraud-rule-categories | Create category | Admin only |
PUT | /risk/fraud-rule-categories/{id} | Update category | Admin only |
PATCH | /risk/fraud-rule-categories/{id}/status | Activate / Deactivate | Admin only |
6.3 Risk Threshold APIs
Method | Route | Purpose | Notes |
|---|---|---|---|
GET | /risk/risk-thresholds | Get risk matrix | Severity ranges |
PUT | /risk/risk-thresholds | Update thresholds | Versioned & auditable |
6.4 Wallet Whitelist APIs
Method | Route | Purpose | Notes |
|---|---|---|---|
GET | /risk/wallet-whitelist | List wallets | Search, blockchain filter |
GET | /risk/wallet-whitelist/{id} | Whitelist detail | Includes bypass config |
POST | /risk/wallet-whitelist | Add wallet | Address & date validation |
PUT | /risk/wallet-whitelist/{id} | Update wallet | Edit validity/reason |
DELETE | /risk/wallet-whitelist/{id} | Revoke wallet | Soft delete |
PUT | /risk/wallet-whitelist/{id}/bypass | Configure bypass | Optional advanced |
6.5 Audit APIs
Method | Route | Purpose | Notes |
|---|---|---|---|
GET | /audit-logs/risk | List audit logs | Filter by entity/user |
GET | /audit-logs/risk/{id} | Audit log detail | Before/after snapshot |