fix(order): enforce versioned platform commands and submissions
This commit is contained in:
@@ -416,8 +416,10 @@ export async function executeCandidates({ candidates, limit, concurrency = 1, st
|
||||
entry.orderNo = draft.order.orderNo
|
||||
entry.declarationVerified = true
|
||||
if (['pending-review', 'wait-split'].includes(stage)) {
|
||||
if (!Number.isSafeInteger(draft.order.version) || draft.order.version < 0) throw Error('SUBMIT_VERSION_MISSING')
|
||||
entry.submitCommand = { body: { expectedVersion: draft.order.version }, headers: { 'Idempotency-Key': `${marker}-submit` } }
|
||||
entry.stage = 'submit'; await save()
|
||||
await api('POST', `${clientPath}/submit`, undefined, merchant, { 'Idempotency-Key': `${marker}-submit` })
|
||||
await api('POST', `${clientPath}/submit`, entry.submitCommand.body, merchant, entry.submitCommand.headers)
|
||||
}
|
||||
if (stage === 'pending-review') {
|
||||
const submitted = await api('GET', clientPath, undefined, merchant)
|
||||
|
||||
Reference in New Issue
Block a user