feat(fulfillment): 增加签名 Webhook 事务 Outbox
- 新增直播履约状态事务 Outbox 与签名投递 worker - 增加 order_site 状态回传、重试和低频对账兜底 - 补充 Outbox、签名校验与集成接口测试
This commit is contained in:
+13
-3
@@ -100,14 +100,25 @@ ORDER_SITE_LOOKUP_ENABLED=true
|
||||
|
||||
## order_site 客户领取集成
|
||||
|
||||
跨项目异步状态统一采用“事务 Outbox + 签名 Webhook”:
|
||||
|
||||
- 业务状态与待发送事件在同一个数据库事务内写入 `integration_outbox`;
|
||||
- 独立 worker 使用 `FOR UPDATE SKIP LOCKED` 领取事件并指数退避重试;
|
||||
- 请求携带 `X-Integration-Key`、`X-Integration-Event-Id`、
|
||||
`X-Integration-Timestamp`、`X-Integration-Signature`;
|
||||
- 签名值为 `sha256=HMAC-SHA256(timestamp + "." + rawBody)`;
|
||||
- 接收方通过 `integration_inbox.event_id` 幂等,失败时整笔事务回滚;
|
||||
- 15 分钟低频对账只作为 dead/漏单兜底,不再由列表请求或人工刷新承担主同步。
|
||||
|
||||
`order_site` 客户页通过服务端接口调用 live-hub,不允许客户浏览器直接访问
|
||||
live-hub 管理 API。内部接口统一位于:
|
||||
live-hub 管理 API。同步客户会话接口位于:
|
||||
|
||||
```text
|
||||
/api/integration/platform-fulfillment/customer-sessions/*
|
||||
```
|
||||
|
||||
接口使用 `X-Integration-Key` 鉴权,密钥来自
|
||||
请求响应接口使用 `X-Integration-Key` 鉴权,异步事件在密钥之外还必须通过
|
||||
时间窗与 HMAC 验签,密钥来自
|
||||
`PLATFORM_FULFILLMENT_INTEGRATION_KEY`。返回给 `order_site` 的客户会话只包含
|
||||
二维码、二维码有效期、绑定阶段、平台识别角色和状态提示,不包含账号、CK、
|
||||
积分、租约或限兑信息。
|
||||
@@ -124,7 +135,6 @@ live-hub 创建新的绑定任务。
|
||||
|
||||
## 暂不实现
|
||||
|
||||
- `order_site` 状态回写接口
|
||||
- 自动充值鱼翅
|
||||
- 自动兑换
|
||||
- 多数量拆分
|
||||
|
||||
Reference in New Issue
Block a user