feat(procurement): implement sample fulfillment and settled fee workflow

This commit is contained in:
2026-10-10 02:19:38 +08:00
parent 040f3bbd93
commit a973be2103
104 changed files with 9823 additions and 714 deletions
@@ -55,6 +55,7 @@ function fixture() {
}
if (method === 'GET' && path.startsWith('/api/platform/v1/last-leg/finance-fee-sources?')) return response([])
if (method === 'POST' && path === '/api/platform/v1/last-leg/finance-fee-sources') {
if (body.businessType === 'OVERSEAS_PROCUREMENT') return response(null, 'A0409')
const key = headers['Idempotency-Key']
const hash = JSON.stringify(body)
const existing = commands.get(`CREATE:${key}`)
@@ -134,13 +135,13 @@ test('module uses only injected real HTTP clients and never fabricates database/
]) assert.ok(source.includes(token), token)
})
test('five fee types traverse Lastleg lifecycle and reach Finance through real HTTP', async () => {
test('four generic fee types publish while procurement bypass is rejected', async () => {
const context = fixture()
await run(context)
const registry = context.createdResources.phase4OverseasFinanceCrossRegion
assert.equal(registry.sources.length, 5)
assert.equal(registry.sources.length, 4)
assert.deepEqual(new Set(registry.sources.map((item) => item.businessType)), new Set([
'OVERSEAS_INBOUND', 'OVERSEAS_PROCUREMENT', 'US_TRUCK', 'LOCAL_LOOSEBOARD', 'WAREHOUSE_SERVICE',
'OVERSEAS_INBOUND', 'US_TRUCK', 'LOCAL_LOOSEBOARD', 'WAREHOUSE_SERVICE',
]))
const warehouseCreate = context.calls.find((call) => call.method === 'POST'
&& call.path === '/api/platform/v1/last-leg/finance-fee-sources'
@@ -163,15 +164,16 @@ test('five fee types traverse Lastleg lifecycle and reach Finance through real H
const creates = context.calls.filter((call) => call.method === 'POST'
&& call.path === '/api/platform/v1/last-leg/finance-fee-sources')
assert.equal(creates.length, 12)
assert.equal(creates.length, 11)
assert.ok(context.steps.find((step) => step.name === '费用创建同键异载荷冲突')?.passed)
assert.ok(context.steps.find((step) => step.name === '海外费用列表不会泄露其他客户来源')?.passed)
assert.ok(context.steps.find((step) => step.name === '其他客户不能关联本客户业务创建费用')?.passed)
assert.equal(context.steps.filter((step) => step.name.endsWith('费用经业务Outbox直接投递进入 Finance')).length, 5)
assert.equal(context.steps.filter((step) => step.name.endsWith('费用经业务Outbox直接投递进入 Finance')).length, 4)
assert.ok(context.steps.filter((step) => step.name.endsWith('费用经业务Outbox直接投递进入 Finance')).every((step) => step.passed))
assert.ok(context.steps.find((step) => step.name === '统一Gateway不公开内部事件运维接口')?.passed)
assert.deepEqual(context.steps.filter((step) => !step.passed), [])
assert.ok(context.steps.find(step => step.name === '采购费用禁止绕过履约实扣创建通用来源')?.passed)
assert.equal(context.scenarios[0].deploymentBlocked, false)
assert.equal(context.scenarios[0].success, true)
})