fix(open91): 履约未就绪时保持轮询等待

This commit is contained in:
yml2213
2026-11-03 13:27:53 +08:00
parent b842d00fc3
commit f336311ef8
3 changed files with 52 additions and 29 deletions
@@ -8,6 +8,7 @@ import {
verifyOpen91Signature,
} from './crypto.js'
import { buildOpen91CardItem, formatOpen91ExpireTime, resolveOpen91QueryState } from './response.js'
import { shouldWaitForOpen91Fulfillment } from './order-create-service.js'
test('signOpen91Payload signs only request body fields', () => {
const config = {
@@ -114,6 +115,12 @@ test('resolveOpen91QueryState returns success only when every task is ready', ()
)
})
test('内部订单已落库但履约任务未生成时,91 下单响应必须进入轮询', () => {
assert.equal(shouldWaitForOpen91Fulfillment([]), true)
assert.equal(shouldWaitForOpen91Fulfillment(undefined), true)
assert.equal(shouldWaitForOpen91Fulfillment([{ id: 1 }]), false)
})
test('buildOpen91CardItem mirrors claim link into jumpLink and leaves password empty', () => {
assert.deepEqual(
buildOpen91CardItem({