完成单机TEST统一入口与可靠投递回归收尾
This commit is contained in:
@@ -29,7 +29,7 @@ function settlementKey(context, operation) {
|
||||
function write(context, method, path, body, operation, token = context.token, overseas = false) {
|
||||
const headers = { 'Idempotency-Key': key(context, operation) }
|
||||
return overseas
|
||||
? context.requestOverseas(method, path, body, headers, token)
|
||||
? context.request(method, path, body, token, headers)
|
||||
: context.request(method, path, body, token, headers)
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ async function loadActiveSupplierAndWarehouse(context, fixture) {
|
||||
|
||||
async function publishDirectPaid(context, fixture, supplier, warehouse) {
|
||||
const body = buildDirectPaidBody(context.marker, fixture, supplier, warehouse)
|
||||
const createdResponse = await write(context, 'POST', OVERSEAS_FEES, body, 'overseas-create', context.overseasToken, true)
|
||||
const createdResponse = await write(context, 'POST', OVERSEAS_FEES, body, 'overseas-create', context.token, true)
|
||||
const created = context.apiSuccess(MODULE, '创建无入仓码海外仓 DIRECT_PAID 来源', createdResponse,
|
||||
diagnostic(createdResponse), OPTIONS)
|
||||
const targetId = sourceId(created?.sourceFeeId ? created : { feeSourceId: created?.sourceFeeId })
|
||||
@@ -116,21 +116,19 @@ async function publishDirectPaid(context, fixture, supplier, warehouse) {
|
||||
`sourceFeeId=${targetId || 'missing'}, settlementMode=${created?.settlementMode || 'missing'}`, OPTIONS)
|
||||
if (!targetId) return null
|
||||
|
||||
const replayResponse = await write(context, 'POST', OVERSEAS_FEES, body, 'overseas-create', context.overseasToken, true)
|
||||
const replayResponse = await write(context, 'POST', OVERSEAS_FEES, body, 'overseas-create', context.token, true)
|
||||
const replay = data(replayResponse)
|
||||
context.assert(MODULE, '海外费用创建同键同参重放同一来源', replayResponse,
|
||||
ok(replayResponse) && sourceId(replay?.sourceFeeId ? replay : { feeSourceId: replay?.sourceFeeId }) === targetId,
|
||||
`first=${targetId}, replay=${id(replay?.sourceFeeId) || 'missing'}`, OPTIONS)
|
||||
const conflictResponse = await write(context, 'POST', OVERSEAS_FEES,
|
||||
{ ...body, amount: body.amount + 1 }, 'overseas-create', context.overseasToken, true)
|
||||
{ ...body, amount: body.amount + 1 }, 'overseas-create', context.token, true)
|
||||
context.assert(MODULE, '海外费用创建同键异参冲突', conflictResponse, rejected(conflictResponse),
|
||||
diagnostic(conflictResponse), OPTIONS)
|
||||
|
||||
const submittedResponse = await context.requestOverseas('POST', `${OVERSEAS_FEES}/${targetId}/submit`,
|
||||
{ idempotencyKey: key(context, 'overseas-submit') })
|
||||
const submittedResponse = await context.request('POST', `${OVERSEAS_FEES}/${targetId}/submit`, { idempotencyKey: key(context, 'overseas-submit') })
|
||||
context.apiSuccess(MODULE, '提交 DIRECT_PAID 来源审核', submittedResponse, diagnostic(submittedResponse), OPTIONS)
|
||||
const reviewedResponse = await context.requestOverseas('POST', `${OVERSEAS_FEES}/${targetId}/review`,
|
||||
{ decision: 'APPROVE', reason: context.marker, idempotencyKey: key(context, 'overseas-review') })
|
||||
const reviewedResponse = await context.request('POST', `${OVERSEAS_FEES}/${targetId}/review`, { decision: 'APPROVE', reason: context.marker, idempotencyKey: key(context, 'overseas-review') })
|
||||
context.apiSuccess(MODULE, '审核发布 DIRECT_PAID 来源', reviewedResponse, diagnostic(reviewedResponse), OPTIONS)
|
||||
return { sourceFeeId: targetId, body }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user