Core — Ledger Use Cases

Derived from FSD Use Cases (v0 — expand when Doc05 Excel exists)

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

Doc IDCPG-UC-CPG-Core_UC_Ledger
VersionPhiên bản1.0
StatusTrạng tháiDraft
OwnerCPG BA / Architecture
AudienceĐối tượngBA, QA, Product, Frontend, Backend
ClassificationPhân loạiInternal
Effective dateNgày hiệu lực01/12/2026
Related docs Core Ledger TC · CPG-Core_FSD_Ledger

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

Catalog

UC ID Name Linked TC count Categories
UC-DEP-01 Deposit TX finalized (Synchronizer); VA exists 1 Function
UC-SWP-01 VA has balance 1 Function
UC-PAY-01 Hot/invoice funded 1 Function
UC-RSK-01 Merchant available ≥ amount 1 Function
UC-STL-01 Available/locked funds 1 Function
UC-REF-01 Available ≥ refund 1 Function
UC-IDM-01 Prior successful deposit for tx_hash 1 Function
UC-OVR-01 Account balance B 1 Function
UC-REV-01 Existing transaction 1 Function
UC-ADR-01 New customer/VA 1 Function
UC-KYT-01 Merchant funds pending; KYT decision exists 1 Function
UC-FRZ-01 Mismatch or incident detected 1 Function
UC-HSH-01 Hash mode configured 1 Function
UC-DR-01 Recoverable backup/PIT exists 1 Function
UC-CLS-01 Period closed 1 Function
UC-PRF-01 Prod-equivalent environment 1 Function

Use cases

UC-DEP-01 — Deposit TX finalized (Synchronizer); VA exists

  • Actor: sync-service
  • Goal: Deposit TX finalized (Synchronizer); VA exists
  • Source: Derived from FSD CPG-Core_FSD_Ledger

Linked test cases

  • LED-001 — Deposit TX finalized (Synchronizer); VA exists (Function)

Representative main flow

POST deposit_detected with reference=tx_hash

Expected outcome

VA balance += amount; one log NEW_TRANSACTION

Failure

Duplicate → idempotent hit; insufficient world N/A (world source)

UC-SWP-01 — VA has balance

  • Actor: ops / sync
  • Goal: VA has balance
  • Source: Derived from FSD CPG-Core_FSD_Ledger

Linked test cases

  • LED-001 — VA has balance (Function)

Representative main flow

sweep_initiate then on-chain sweep then sweep_complete

Expected outcome

Funds on hot wallet account

Failure

Insufficient VA → reject; stuck in transit if complete missing

UC-PAY-01 — Hot/invoice funded

  • Actor: transaction-service
  • Goal: Hot/invoice funded
  • Source: Derived from FSD CPG-Core_FSD_Ledger

Linked test cases

  • LED-001 — Hot/invoice funded (Function)

Representative main flow

payment_allocate then confirm_funds

Expected outcome

Merchant available += net; fees accrued

Failure

Over-allocate → FR2 reject

UC-RSK-01 — Merchant available ≥ amount

  • Actor: risk/ops
  • Goal: Merchant available ≥ amount
  • Source: Derived from FSD CPG-Core_FSD_Ledger

Linked test cases

  • LED-001 — Merchant available ≥ amount (Function)

Representative main flow

risk_hold

Expected outcome

Funds in risk_hold

Failure

Insufficient available → reject

UC-STL-01 — Available/locked funds

  • Actor: settlement client
  • Goal: Available/locked funds
  • Source: Derived from FSD CPG-Core_FSD_Ledger

Linked test cases

  • LED-001 — Available/locked funds (Function)

Representative main flow

lock → batch_init → batch_complete

Expected outcome

Settled + fee accounts updated

Failure

Wrong client (FR8) → authz deny

UC-REF-01 — Available ≥ refund

  • Actor: transaction/ops
  • Goal: Available ≥ refund
  • Source: Derived from FSD CPG-Core_FSD_Ledger

Linked test cases

  • LED-001 — Available ≥ refund (Function)

Representative main flow

refund_lock → refund_execute

Expected outcome

Beneficiary credited; fee if any

Failure

Insufficient → reject

UC-IDM-01 — Prior successful deposit for tx_hash

  • Actor: sync-service
  • Goal: Prior successful deposit for tx_hash
  • Source: Derived from FSD CPG-Core_FSD_Ledger

Linked test cases

  • LED-001 — Prior successful deposit for tx_hash (Function)

Representative main flow

Replay identical create

Expected outcome

Same transaction id; no second credit

Failure

-

UC-OVR-01 — Account balance B

  • Actor: any writer
  • Goal: Account balance B
  • Source: Derived from FSD CPG-Core_FSD_Ledger

Linked test cases

  • LED-001 — Account balance B (Function)

Representative main flow

Debit B+1 via template

Expected outcome

Request fails; balances unchanged

Failure

-

UC-REV-01 — Existing transaction

  • Actor: authorized ops
  • Goal: Existing transaction
  • Source: Derived from FSD CPG-Core_FSD_Ledger

Linked test cases

  • LED-001 — Existing transaction (Function)

Representative main flow

Revert by id

Expected outcome

Reversing tx; volumes restored

Failure

Already reverted → conflict

UC-ADR-01 — New customer/VA

  • Actor: account-service
  • Goal: New customer/VA
  • Source: Derived from FSD CPG-Core_FSD_Ledger

Linked test cases

  • LED-001 — New customer/VA (Function)

Representative main flow

Allocate next sequential index; derive address; UNIQUE insert; bind metadata to treasury:virtual:{chain}:{va}

Expected outcome

Address unique; no collision

Failure

Duplicate address → abort issue

UC-KYT-01 — Merchant funds pending; KYT decision exists

  • Actor: transaction/risk service
  • Goal: Merchant funds pending; KYT decision exists
  • Source: Derived from FSD CPG-Core_FSD_Ledger

Linked test cases

  • LED-001 — Merchant funds pending; KYT decision exists (Function)

Representative main flow

Call confirm with PASS reference

Expected outcome

Funds become available with decision metadata

Failure

Missing/REVIEW/FAIL → reject or hold pre-availability

UC-FRZ-01 — Mismatch or incident detected

  • Actor: reconciliation/security
  • Goal: Mismatch or incident detected
  • Source: Derived from FSD CPG-Core_FSD_Ledger

Linked test cases

  • LED-001 — Mismatch or incident detected (Function)

Representative main flow

Create scoped freeze; attempt affected template

Expected outcome

Write rejected until approved clear

Failure

Bypass/direct Formance access prohibited

UC-HSH-01 — Hash mode configured

  • Actor: platform/security
  • Goal: Hash mode configured
  • Source: Derived from FSD CPG-Core_FSD_Ledger

Linked test cases

  • LED-001 — Hash mode configured (Function)

Representative main flow

Recompute integrity; generate/verify checkpoint if required

Expected outcome

Volumes/logs/checkpoint agree

Failure

Mismatch → freeze and incident

UC-DR-01 — Recoverable backup/PIT exists

  • Actor: platform ops
  • Goal: Recoverable backup/PIT exists
  • Source: Derived from FSD CPG-Core_FSD_Ledger

Linked test cases

  • LED-001 — Recoverable backup/PIT exists (Function)

Representative main flow

Restore; replay queues; verify invariants and checkpoints

Expected outcome

Service reopens within RTO and declared RPO

Failure

Mismatch → remain closed

UC-CLS-01 — Period closed

  • Actor: finance/ops
  • Goal: Period closed
  • Source: Derived from FSD CPG-Core_FSD_Ledger

Linked test cases

  • LED-001 — Period closed (Function)

Representative main flow

Attempt ordinary backdated write, then approved retrospective adjustment

Expected outcome

Ordinary write blocked; adjustment append-only and linked

Failure

Missing approvals → reject

UC-PRF-01 — Prod-equivalent environment

  • Actor: load-test engineering
  • Goal: Prod-equivalent environment
  • Source: Derived from FSD CPG-Core_FSD_Ledger

Linked test cases

  • LED-001 — Prod-equivalent environment (Function)

Representative main flow

Run TC-03/08 in both hash modes and overload

Expected outcome

Capacity/topology decision supported by evidence

Failure

Lost event or invariant mismatch → fail

E. ReferencesE. Tham chiếu