feat(fulfillment): 增加事务 Outbox 同步履约状态

- 用事务 Outbox 和签名 Webhook 替换直接状态回调
- 增加 Outbox 投递 worker、重试与低频对账兜底
- 缓存客户领取页绑定状态并补充签名与迁移测试
This commit is contained in:
yml
2026-11-18 11:00:28 +08:00
parent 54b9f3251d
commit 9b2fcf1d1f
23 changed files with 1324 additions and 130 deletions
@@ -0,0 +1,15 @@
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import test from 'node:test'
test('Outbox migration keeps header event id and payload eventId identical', () => {
const sql = readFileSync(
new URL('../../db/migrations/172_platform_fulfillment_outbox.sql', import.meta.url),
'utf8',
)
assert.match(sql, /'eventId', event_id::text/)
assert.doesNotMatch(sql, /'eventId', gen_random_uuid\(\)::text/)
assert.match(sql, /CREATE TABLE IF NOT EXISTS integration_outbox/)
assert.match(sql, /CREATE TABLE IF NOT EXISTS integration_inbox/)
})