iconsulting/docs
hailin df754ce8b8 feat(payment): P0 — 支付闭环,Agent 可创建真实订单并生成支付二维码
## 后端改动

### 新增 PaymentClientService
- 新建 `infrastructure/payment/payment-client.service.ts`
  - HTTP 客户端封装,调用 payment-service API(端口 3002)
  - 方法: createOrder, createPayment, checkPaymentStatus, getOrderStatus, getUserOrders
  - 基于 native fetch,模式与 KnowledgeClientService 一致
- 新建 `infrastructure/payment/payment.module.ts`
- AgentsModule 导入 PaymentModule

### 重写 generate_payment 工具
- 删除所有 MOCK 数据(fake orderId, placeholder QR URL)
- 实际调用 payment-service: createOrder → createPayment → 返回真实 QR URL
- 返回 orderId, paymentId, qrCodeUrl, paymentUrl, expiresAt

### 新增 check_payment_status 工具
- 查询订单支付状态(调用 payment-service GET /orders/:id/status)
- 返回 status, statusLabel(中文映射), paidAt
- 在 coordinator-tools.ts 和 concurrency map 中注册(只读 safe=true)

### 新增 query_order_history 工具
- 查询用户历史订单列表(调用 payment-service GET /orders)
- 返回 orders 数组含 orderId, serviceType, amount, status, createdAt
- 在 coordinator-tools.ts 和 concurrency map 中注册(只读 safe=true)

## 前端改动

### QR 码渲染
- 安装 qrcode.react 4.2.0
- ToolCallResult 组件使用 QRCodeSVG 渲染真实二维码
- 支持 qrCodeUrl(二维码)和 paymentUrl(跳转链接)两种支付方式
- 显示订单号、金额、过期时间

### 支付状态卡片
- check_payment_status 结果渲染为彩色状态卡片
- 已支付=绿色, 待支付=黄色, 已取消=红色, 已退款=橙色

### 订单历史列表
- query_order_history 结果渲染为订单列表卡片
- 每行显示: 类别、日期、金额、状态标签

### WebSocket 工具事件处理
- tool_result 事件收集到 pendingToolResults(chatStore 新增状态)
- stream_end 时将 toolResults 注入消息 metadata.toolCalls
- stream_start 时清空 pendingToolResults

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 01:17:14 -08:00
..
architecture feat(agents): implement multi-agent collaboration architecture 2026-02-06 04:26:39 -08:00
AGENT_EVALUATION_REPORT.md feat(agent): upgrade to Level 3 with real RAG, Memory and Evolution integration 2026-01-22 23:45:58 -08:00
AGENT_THREE_LAYER_ARCHITECTURE.md feat(agent): implement 3-layer architecture for better response quality 2026-01-23 07:51:19 -08:00
AGENT_TOOLS.md docs: add comprehensive agent tools documentation 2026-01-23 00:49:10 -08:00
ARCHITECTURE.md docs: reorganize documentation and add architecture document 2026-01-22 23:05:41 -08:00
DEVELOPMENT_GUIDE.md docs: reorganize documentation and add architecture document 2026-01-22 23:05:41 -08:00
LEVEL3_UPGRADE_PLAN.md feat(agent): upgrade to Level 3 with real RAG, Memory and Evolution integration 2026-01-22 23:45:58 -08:00
implementation-plan-p0-p1-p2.md feat(payment): P0 — 支付闭环,Agent 可创建真实订单并生成支付二维码 2026-02-07 01:17:14 -08:00