CPG-MP FSD Ticket
FSD — Merchant Portal
A. Document controlA. Kiểm soát tài liệu
| Doc ID | CPG-FSD-CPG-MP_FSD_Ticket |
|---|---|
| VersionPhiên bản | 1.0 |
| StatusTrạng thái | Draft |
| Owner | CPG BA / Architecture |
| AudienceĐối tượng | Frontend, Backend, QA, Product |
| ClassificationPhân loại | Internal |
| Effective dateNgày hiệu lực | 01/12/2026 |
| Related docs | Merchant Portal 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 — MP-facing thin FSD for Round A SPEC |
C. Table of contentsC. Mục lục
- 1. Module Scope
- 2. User Roles
- 3. Functional Requirements
- 3.1 Ticket List
- F1. View Ticket List
- 3.2 Filters
- F2. Filter Ticket List
- 3.3 Create Ticket
- F3. Create Ticket Modal
- 3.4 Ticket Detail
- F4. Ticket Detail
- 3.5 Public Comments
- F5. Public Comments
- 3.6 Status
- F6. Status Lifecycle (MP)
- 4. Data Requirements
- 5. Enums
- 6. API Routes
- 7. Audit Log Requirements
- 8. Error Handling
- Use CasesUse Cases
D. ContentD. Nội dung
1. Module Scope
The Ticket Module on Merchant Portal lets merchants create and track support tickets for their own tenant, exchange public comments with FlyPay support, and update status where merchant RBAC allows.
In scope:
- Ticket list with status tabs (Open / In Progress / Resolved including closed)
- Filters and search for merchant-owned tickets
- Create ticket (subject, description, category, priority, attachments)
- Ticket detail (tenant-scoped)
- Public comments and comment attachments
- Status transitions permitted for merchant actors (for example Mark Resolved)
Out of scope:
- CRM assign / reassign
- Start Working (CRM list action)
- Internal comments (not visible to merchant)
- @mention of CRM staff from merchant portal
- Creating
is_internal_support_requesttickets - Ticket category administration
- CRM-wide ticket queues across merchants
2. User Roles
Permissions are enforced via merchant RBAC keys such as ticket:view|create|edit|resolve and comment:view|edit. Matrix cells that are product-open stay marked for SPEC Q items.
| Role | Permissions |
|---|---|
| Merchant Admin | View, create, comment, resolve (full MP ticket surface) |
| Merchant Finance | View list/detail; create/comment/resolve per RBAC catalog |
| Merchant Operator | View and create; comment/resolve per RBAC |
| Merchant Support | View and public comment; resolve if granted |
| Merchant Developer | Read-oriented; create/comment if granted |
| Merchant Viewer | Read-only list and detail |
3. Functional Requirements
3.1 Ticket List
F1. View Ticket List
Description:
Paginated or card list of tickets belonging to the current merchant. Tabs act as status presets.
Page Header
| UI Element | Description |
|---|---|
| Breadcrumb | Home / Tickets |
| Page Title | Support / Tickets |
| Create Ticket | Opens Create Ticket modal (if ticket:create) |
Tabs
| Tab | Status filter |
|---|---|
| Open | open |
| In Progress | in_progress |
| Resolved | resolved and closed |
Card / row fields
| Field | Description |
|---|---|
| Ticket code | Display code (for example TKT-…); copyable |
| Subject | Title |
| Priority badge | low / medium / high / critical |
| Category | Category name |
| Description snippet | Truncated body |
| Status | Badge |
Rules
| Rule ID | Rule |
|---|---|
| TKT-LIST-01 | Only tickets of the current merchant are displayed |
| TKT-LIST-02 | Internal support requests created by CRM are not listed for merchant |
| TKT-LIST-03 | Tabs filter by status as defined above |
| TKT-LIST-04 | Empty tab shows empty state (not an error) |
| TKT-LIST-05 | Priority and status use shared color badges |
| TKT-LIST-06 | View opens ticket detail when ticket:view |
3.2 Filters
F2. Filter Ticket List
Description:
Optional filters combined with the active tab (AND).
| Filter | Type |
|---|---|
| Subject / ticket code | Text |
| Status | Dropdown (respects or overrides tab per product decision — document in SPEC Q) |
| Category | Dropdown |
| Priority | Dropdown |
| Search | Applies filters |
Rules
| Rule ID | Rule |
|---|---|
| TKT-FILTER-01 | Filters combine with AND |
| TKT-FILTER-02 | Empty filters return all tickets for the active tab scope |
| TKT-FILTER-03 | Search triggers backend query |
3.3 Create Ticket
F3. Create Ticket Modal
Description:
Merchant creates a support ticket for their tenant.
Fields
| Field | Required | Type | Description |
|---|---|---|---|
| Subject | Yes | Text | Short title |
| Description | Yes | Textarea | Problem detail |
| Category | Yes | Dropdown | From ticket categories |
| Priority | Yes | Dropdown | Default medium |
| Attachments | No | File multi | Bounded count/size per product |
Rules
| Rule ID | Rule |
|---|---|
| TKT-CREATE-01 | New ticket status is open |
| TKT-CREATE-02 | Merchant cannot set is_internal_support_request |
| TKT-CREATE-03 | Merchant id is taken from authenticated tenant context |
| TKT-CREATE-04 | Requires ticket:create |
| TKT-CREATE-05 | Hot-wallet activation tickets may deep-link from Account HW activate flow |
3.4 Ticket Detail
F4. Ticket Detail
Description:
Read ticket metadata and description; navigate to Comments; optional status actions.
Rules
| Rule ID | Rule |
|---|---|
| TKT-DETAIL-01 | Detail is tenant-scoped; cross-merchant id returns not found / forbidden |
| TKT-DETAIL-02 | Assignee and CRM-only fields may be read-only or hidden on MP |
| TKT-DETAIL-03 | No CRM Assign panel on MP |
3.5 Public Comments
F5. Public Comments
Description:
Timeline of public comments only; composer posts visibility=public.
Rules
| Rule ID | Rule |
|---|---|
| TKT-COMMENT-01 | Merchant cannot create or list internal comments |
| TKT-COMMENT-02 | Comment requires non-empty content and/or allowed attachment |
| TKT-COMMENT-03 | Requires comment:view / comment:edit as applicable |
3.6 Status
F6. Status Lifecycle (MP)
Canonical statuses: open, in_progress, resolved, closed.
Merchant-visible transitions (example): Mark Resolved from in_progress when ticket:resolve (or equivalent). Full transition matrix is owned by ticket-service domain rules; MP must not invent CRM-only transitions (Start Working assign).
Rules
| Rule ID | Rule |
|---|---|
| TKT-STATUS-01 | Display uses lowercase domain values (map API UPPER if present) |
| TKT-STATUS-02 | Closed tickets appear under Resolved tab with closed badge or equivalent |
| TKT-STATUS-03 | Unauthorized transition returns stable API error envelope |
4. Data Requirements
Primary entities: tickets, ticket_comments, ticket_attachments, ticket_comment_attachments, categories (read). See CRM Ticket FSD §5 for shared schema; MP consumers must not rely on internal-only fields in UI.
5. Enums
| Field | Values |
|---|---|
| status | open, in_progress, resolved, closed |
| priority | low, medium, high, critical |
| comment visibility (MP) | public only |
Note: CRM FSD historically listed priority urgent; MP/FE use critical. Round A SPECs standardize on critical and record the FSD gap.
6. API Routes
Same ticket-service surface as CRM; actor JWT merchant_portal applies tenant scope and forbids internal visibility.
| Method | Route | MP notes |
|---|---|---|
| GET | /api/v1/ticket/tickets |
Scoped; excludes internal support requests |
| POST | /api/v1/ticket/tickets |
No internal flag |
| GET | /api/v1/ticket/tickets/{ticket_id} |
Tenant check |
| PATCH | /api/v1/ticket/tickets/{ticket_id} |
Limited fields per RBAC |
| GET/POST | /api/v1/ticket/tickets/{ticket_id}/comments |
Public only |
| GET | /api/v1/ticket/ticket-categories |
List for create form |
7. Audit Log Requirements
Ticket create, status change, and public comment create/edit should be auditable with actor, ticket id, and correlation id. Do not log attachment binary content or secrets.
8. Error Handling
Use stable JSON error envelope (error.code, error.message, error.details, error.request_id). Map validation to VALIDATION_ERROR / 400; tenant miss to NOT_FOUND or FORBIDDEN; auth to UNAUTHORIZED.
Use CasesUse Cases
No dedicated 08_UC page is published for this FSD yet. See the Use Cases index:Chưa có trang 08_UC riêng cho FSD này. Xem mục lục Use Cases: