Files
one-pipe-system/openspec/changes/add-historical-approval-resend/specs/refund-management/spec.md
luo d9d07422a9
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 5m44s
fix: update some files
2026-08-18 17:36:41 +08:00

57 lines
2.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## ADDED Requirements
### Requirement: Refund Historical Approval Resend API
The refund service SHALL expose a historical approval resend operation through `POST /api/admin/refunds/{id}/trigger-approval`.
#### Scenario: Resend approval for a historical refund
- **GIVEN** 一个需要补发审批的历史退款申请 `id`
- **WHEN** 前端调用 `POST /api/admin/refunds/{id}/trigger-approval`
- **THEN** 请求 MUST 在路径参数中携带该退款申请 `id`
- **AND** 成功响应 MUST 被解析为完整的 `Refund` 记录,并保留 `approval_provider``approval_instance_id``approval_status``approval_status_name` 字段
### Requirement: Refund Historical Approval Resend Entry
The refund list page SHALL provide a `补发审批` action only for refund records whose `status` is pending approval and whose `approval_status` is empty, and SHALL gate it by permission.
#### Scenario: Show resend action for an eligible refund
- **GIVEN** 平台账号拥有 `refund:trigger_approval` 权限
- **AND** 退款申请的 `status` 为待审批1
- **AND** 退款申请的 `approval_status` 为空(`null``undefined`
- **WHEN** 页面渲染退款列表
- **THEN** 页面 MUST 为该记录显示“补发审批”操作
#### Scenario: Hide resend action when refund status is not pending
- **GIVEN** 退款申请的 `status` 不为待审批1
- **WHEN** 页面渲染该记录
- **THEN** 页面 MUST NOT 显示“补发审批”操作
#### Scenario: Hide resend action when approval status is present
- **GIVEN** 退款申请的 `approval_status` 不为空
- **WHEN** 页面渲染该记录
- **THEN** 页面 MUST NOT 显示“补发审批”操作
#### Scenario: Hide resend action without permission
- **GIVEN** 当前账号不拥有 `refund:trigger_approval` 权限
- **WHEN** 页面渲染退款记录
- **THEN** 页面 MUST NOT 显示“补发审批”操作
#### Scenario: Resend approval succeeds
- **GIVEN** 用户对符合条件的退款申请点击“补发审批”
- **WHEN** 接口返回 `code=0`
- **THEN** 页面 MUST 显示成功提示并刷新列表
- **AND** 刷新后的记录 MUST 展示接口返回的最新审批状态
#### Scenario: Resend approval fails
- **GIVEN** 接口返回非零 `code` 或请求失败
- **WHEN** 用户触发“补发审批”
- **THEN** 页面 MUST 展示后端返回的错误信息
- **AND** 页面 MUST NOT 将记录标记为已补发审批