CPG-CRM FSD Setting Service

FSD — Admin CRM

A. Document controlA. Kiểm soát tài liệu

Doc IDCPG-FSD-CPG-CRM_FSD_Setting_Service
VersionPhiên bản1.0
StatusTrạng tháiDraft
OwnerCPG BA / Architecture
AudienceĐối tượngFrontend, Backend, FlyPay Support, QA, Product
ClassificationPhân loạiInternal
Effective dateNgày hiệu lực01/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

D. ContentD. Nội dung

1. Module Scope

The Services Settings module enables system administrators to configure, manage, and maintain payment services offered by the platform, including Crypto Payment services (QR Payment, Checkout Link, API Payment) and Fiat Payment services.

This module allows:

  • Defining supported blockchains per service
  • Configuring transaction fees and fixed fees per blockchain
  • Managing tier-based service limits and pricing
  • Enabling or disabling services
  • Defining service capabilities (features)
  • Supporting multiple service types under a unified configuration model

This module is system-level, impacts merchant onboarding, transactions, settlement, and billing, and is restricted to privileged internal users.

2. User Roles

Role

Permissions

Super Admin

Full access to create, edit, activate/deactivate services and tiers

System Admin

Manage services, fees, tiers, and features

Finance Admin

View and validate fee structures

Compliance Admin

View service configurations (read-only)

Support Admin

View service configuration (read-only)

3. Functional Requirements

3.1 Features

3.1.1 Service Listing

  • Display all available services in card-based layout
  • Services grouped by:
    • Payment Type: Crypto / Fiat
    • Tier (e.g. Basic)
  • Each service card displays:
    • Service Name
    • Service Description
    • Service Type (Crypto / Fiat)
    • Status (Active / Inactive)
    • Tier
    • Supported Blockchains
    • Fee summary per blockchain
    • Tier configuration summary
    • Feature tags
  • Toggle to switch between Crypto Payment and Fiat Payment
  • Filter services by Tier
  • Edit icon to open Edit Service modal
  • Toggle switch to enable/disable service

3.1.2 Add / Edit Service

Administrators can create or modify a service via a modal or page form.

Service Basic Information

  • Service Name (required)
  • Description
  • Service Type (Crypto / Fiat – system defined)
  • Tier (Basic, Pro, Enterprise, etc.)
  • Service Status (Active / Inactive)

Blockchain Selection

  • Select supported blockchains:
    • Tron
    • Ethereum
    • Binance Smart Chain
    • Polygon
  • Blockchain selection dynamically controls fee configuration sections

3.1.3 Chain-Specific Fee Configuration

For each selected blockchain:

  • Transaction Fee (%)
  • Fixed Fee (USD)
  • Validation rules:
    • Percentage ≥ 0
    • Fixed Fee ≥ 0
  • Fees are applied per transaction at runtime

3.1.4 Tier Configuration

Each service is associated with a Tier defining limits and pricing:

  • Max Accounts
  • Monthly Fee
  • Settlement Period (e.g. T+2)
  • Chargeback Fee (% + fixed)
  • Settlement Fee (% + fixed)
  • Rate Limiting:
    • Requests per second
    • Requests per minute
    • Requests per hour

3.1.5 Service Features Management

  • Free-text feature list (comma-separated)
  • Features rendered as tags in service card
  • Used for:
    • UI display
    • Marketing
    • Capability declaration

Examples:

  • Instant generation
  • Webhooks
  • Multiple currencies
  • REST API
  • Mobile optimized

3.1.6 Service Activation / Deactivation

Definitions

  • Used by merchant: Service has at least one merchant assignment and/or any on-chain deployment footprint exists (e.g., contract created, wallet/addresses provisioned, webhook keys issued, or any transaction/settlement records tied to this service).
  • Deployed on-chain: Any irreversible or externally effective action has occurred that links the service config to blockchain operations.

Activation Rules

  1. If service is NOT used by any merchant (NOT deployed on-chain)
    • Admin can activate/deactivate immediately via the Service Status toggle.
    • The system changes instantly.
  2. If service IS used by merchant (deployed on-chain)
    • Admin cannot activate/deactivate directly.
    • Toggling status triggers a Proposal flow:
      • System creates a Service Status Change Proposal with:
        • service_id
        • current_status -> requested_status
        • reason (required)
        • impact summary (auto-generated)
        • deployment/on-chain footprint indicators (read-only)
        • requested_by, requested_at
    • The proposal must be approved before status changes take effect.

Approval Workflow (High-level)

  • Proposal statuses:
    • DRAFT (optional)
    • SUBMITTED
    • UNDER_REVIEW
    • APPROVED
    • REJECTED
    • CANCELLED
    • APPLIED (after execution)
  • Approvers:
    • Super Admin (required)

Execution Behavior (After Approval)

  • Deactivate (Approved)
    • Service becomes Inactive for:
      • New merchant enablement / new assignments
      • New credential issuance / new on-chain deployments
    • Existing merchants:
      • Either graceful-disable (stop new transactions but allow settlement completion)
      • Or hard-disable (block all new operations)
    • The chosen policy should be captured in the Proposal ("Deactivation Mode").
  • Activate (Approved)
    • Service becomes Active and available again for eligible merchants, respecting tier and risk rules.

Audit & Logging

  • Every proposal and final applied change must log:
    • who requested, who approved, who applied
    • timestamps
    • reason and notes
    • affected merchants count (snapshot)
    • on-chain/deployment footprint summary

UI Requirements

  • If used/deployed:
    • Status toggle is replaced by:
      • "Request Activation" / "Request Deactivation"
      • Opens Proposal modal/form
  • If not used:
    • Normal toggle (instant)

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 Service Management Page

  • Header: "Service Management"
  • Toggle: Crypto Payment | Fiat Payment
  • Filter: Tier dropdown
  • Grid of service cards
  • Each card includes:
    • Service icon
    • Name & description
    • Blockchain badges
    • Fee summary per chain
    • Tier details
    • Feature tags
    • Status toggle
    • Edit action

4.2 Add / Edit Service Modal

Sections:

  1. Service Information
  2. Blockchain Selection
  3. Chain-Specific Fees (dynamic)
  4. Tier Configuration (read-only or editable depending on design)
  5. Features input
  6. Action buttons:
    • Cancel
    • Save / Update Service

5. Data Requirements

5.1 Data Dictionary

services

Field

Type

Description

id

UUID

Primary key

code

string

Unique service code (e.g., QR_PAYMENT)

name

string

Service name shown in UI

type

enum(CRYPTO,FIAT)

Service category tab

description

string

Service description

features

string[]

Feature tags (comma-separated in UI, stored as array/JSON)

status

enum(ACTIVE,INACTIVE)

Current effective status

status_change_mode

enum(DIRECT,PROPOSAL_REQUIRED)

Derived flag: direct toggle vs proposal required

is_deployed

boolean

True if service has on-chain footprint / deployed config exists

deployed_at

datetime

First time deployed (if any)

last_deployed_at

datetime

Last deployment change timestamp

created_at

datetime

Created time

created_by

UUID

User who created

updated_at

datetime

Updated time

updated_by

UUID

User who updated

version

int

Optimistic locking / config version

note

string

Optional internal note

service_blockchains

Field

Type

Description

id

UUID

Primary key

service_id

UUID

FK -> services.id

blockchain

enum(TRON,ETHEREUM,BSC,POLYGON,...)

Chain identifier

is_enabled

boolean

Chain enabled for this service

tx_fee_percent

decimal(6,3)

Transaction fee percentage for that chain

fixed_fee_amount

decimal(18,2)

Fixed fee amount for that chain

fixed_fee_currency

string

Currency code (e.g., USD, USDT)

min_fee_amount

decimal(18,2)

Optional minimum fee

max_fee_amount

decimal(18,2)

Optional maximum fee

created_at

datetime

Created time

updated_at

datetime

Updated time

service_tier_configs (snapshot tier terms into service card)

Field

Type

Description

id

UUID

Primary key

service_id

UUID

FK -> services.id

merchant_tier_id

UUID

FK -> Merchant Tier

monthly_fee

decimal(18,2)

Monthly fee applied for merchants in tier

settlement_period

string

e.g., T+2

chargeback_fee_percent

decimal(6,3)

Chargeback percent

chargeback_fee_fixed

decimal(18,2)

Chargeback fixed fee

settlement_fee_percent

decimal(6,3)

Settlement percent

settlement_fee_fixed

decimal(18,2)

Settlement fixed fee

rate_limit_per_second

int

RPS limit

rate_limit_per_minute

int

RPM limit

rate_limit_per_hour

int

RPH limit

created_at

datetime

Created

updated_at

datetime

Updated

merchant_services

Field

Type

Description

id

UUID

Primary key

merchant_id

UUID

FK -> Merchant

service_id

UUID

FK -> services.id

status

enum(ENABLED,DISABLED)

Merchant-level status

enabled_at

datetime

When enabled

disabled_at

datetime

When disabled

last_used_at

datetime

Last activity timestamp (optional)

created_at

datetime

Created

updated_at

datetime

Updated

service_deployments (on-chain footprint + deployment records)

Field

Type

Description

id

UUID

Primary key

service_id

UUID

FK -> services.id

blockchain

enum

Chain of deployment

deployment_type

enum(CONTRACT,WALLET,CONFIG,WEBHOOK,API_KEY)

What was provisioned

deployment_ref

string

External reference (contract address, wallet id, key id, etc.)

deployment_status

enum(PENDING,SUCCESS,FAILED)

Deployment result

deployed_by

UUID

User/system actor

deployed_at

datetime

When deployment executed

metadata

json

Extra data (tx hash, explorer link, params snapshot)

proposals

See CPG-CRM/FSD_Setting_Proposal: 5.1 Data Dictionary

proposal_approvals

See CPG-CRM/FSD_Setting_Proposal, 5.1 Data Dictionary

audit_logs_proposals

Field

Type

Description

id

UUID

Primary key

service_id

UUID

FK -> services.id

proposal_id

UUID

FK -> proposals.id (nullable)

action

enum(STATUS_CHANGE_REQUESTED,STATUS_CHANGED,DEPLOYED,ROLLED_BACK)

Audit action

from_value

string

Previous state

to_value

string

New state

actor_id

UUID

Who did it (user/system)

actor_type

enum(USER,SYSTEM)

Actor type

created_at

datetime

Timestamp

metadata

json

Extra detail (counts, tx hashes, etc.)

tiers

See CPG-CRM/FSD_Setting_General: 5.1 Data Dictionary

5.2 Data Models

Entity Relationships (ER)

  • services (1)- (N) service_blockchains
  • services (1)- (N) service_tier_configs (optional)
  • services (1)- (N) service_deployments
  • services (1)- (N) merchant_services
  • services (1)- (N) proposals
  • proposals (1)- (N) proposal_approvals
  • services (1)- (N) audit_logs_proposals
  • proposals (0..1)- (N) audit_logs_proposals (log may reference proposal)

Enums (Consolidated)

  • service_type: CRYPTO, FIAT
  • service_status: ACTIVE, INACTIVE
  • deployment_status: PENDING, SUCCESS, FAILED
  • proposal_status: DRAFT, SUBMITTED, UNDER_REVIEW, APPROVED, REJECTED, CANCELLED, APPLIED
  • request_type: ACTIVATE, DEACTIVATE
  • deactivation_mode: GRACEFUL, HARD
  • Permission type (if reused): READ, WRITE, APPROVE, SENSITIVE

6. API Routes

Base path: /api /v1

6.1 Services API

Method

Route

Purpose

Notes

GET

/api/services

List services

Supports filters: type, status, tier, search

GET

/api/services/{id}

Get service detail

Includes chains + fees + deployment flags

POST

/api/services

Create service

Creates base + chain configs

PUT

/api/services/{id}

Update service configuration

If deployed: may require proposal depending on fields (policy-driven)

PATCH

/api/services/{id}/status

Direct activate/deactivate

Reject if is_deployed=true -> return 409/422 with message “Proposal required”

GET

/api/services/{id}/impact-summary

Compute impact

Returns counts: merchants using, deployments, last used, etc.

6.2 Service Blockchain Fees API

Method

Route

Purpose

Notes

GET

/api/services/{id}/blockchains

List enabled chains + fees

PUT

/api/services/{id}/blockchains

Replace chain fee config

If deployed: policy may require proposal/change-control

PATCH

/api/services/{id}/blockchains/{chain}

Update one chain fee

Validates percent ranges, currency

POST

/api/services/{id}/blockchains/{chain}/enable

Enable a chain

If deployed: may require proposal

POST

/api/services/{id}/blockchains/{chain}/disable

Disable a chain

If used by merchants on that chain, likely proposal required

6.3 Merchant-Service Assignment API

Method

Route

Purpose

Notes

GET

/api/services/{id}/merchants

Merchants using service

Pagination

POST

/api/merchants/{merchantId}/services/{serviceId}

Assign/enable service for merchant

Creates merchant_services

PATCH

/api/merchants/{merchantId}/services/{serviceId}

Update merchant service status

ENABLED/DISABLED

6.4 Deployments API (On-chain footprint)

Method

Route

Purpose

Notes

GET

/api/services/{id}/deployments

List deployment records

Shows chain, ref, status

POST

/api/services/{id}/deployments

Trigger deployment/provisioning

Likely async; creates PENDING then updates

GET

/api/services/{id}/deployments/{deploymentId}

Deployment detail

Includes tx hash in metadata

6.5 Service Status Proposal API (Core requirement)

Method

Route

Purpose

Notes

GET

/api/service-status-proposals

List proposals

Filters: status, serviceId, dateRange, requestedBy

GET

/api/service-status-proposals/{id}

Proposal detail

Includes approvers + snapshot

POST

/api/service-status-proposals

Create proposal

Requires service_id, request_type, reason, requested_status, deactivation_mode (if deactivate)

PATCH

/api/service-status-proposals/{id}

Update draft proposal

Only if status=DRAFT

POST

/api/service-status-proposals/{id}/submit

Submit proposal

Moves to SUBMITTED

POST

/api/service-status-proposals/{id}/cancel

Cancel proposal

Allowed if not APPROVED/APPLIED

POST

/api/service-status-proposals/{id}/review

Mark under review

Reviewer role required

POST

/api/service-status-proposals/{id}/approve

Approve proposal

Records approver decision; may require multiple approvers

POST

/api/service-status-proposals/{id}/reject

Reject proposal

Requires rejected_reason

POST

/api/service-status-proposals/{id}/apply

Apply approved change

System executes: update services.status, logs audit, sets proposal to APPLIED

6.6 Audit API

Method

Route

Purpose

Notes

GET

/api/services/{id}/audit-logs

Service audit timeline

Includes proposal linkage

GET

/api/service-status-proposals/{id}/audit-logs

Proposal-specific logs

Optional convenience

Tier APIs

See CPG-CRM/FSD_Setting_General: 6. API Routes

E. ReferencesE. Tham chiếu