test(lastleg): derive merchant relabel scope from profile receipt
This commit is contained in:
@@ -58,8 +58,11 @@ async function loadProducerResources(context) {
|
||||
}
|
||||
if (e.method === 'POST' && path === '/api/merchant/v1/last-leg/relabel-applications' && actors.has(e.actor)) {
|
||||
const a = data.application
|
||||
must(a && id(a.customerId) === actors.get(e.actor) && id(a.overseasWarehouseId) === id(e.body?.operationWarehouseId), 'Relabel producer scope mismatch')
|
||||
add('relabel', a.relabelNo, a.customerId, a.overseasWarehouseId, e)
|
||||
const customerId = actors.get(e.actor)
|
||||
must(a && (a.customerId === undefined || id(a.customerId) === customerId)
|
||||
&& id(a.overseasWarehouseId) === id(e.body?.operationWarehouseId), 'Relabel producer scope mismatch')
|
||||
// Merchant summaries omit customerId; the authenticated profile receipt supplies its scope.
|
||||
add('relabel', a.relabelNo, customerId, a.overseasWarehouseId, e)
|
||||
}
|
||||
if (e.method === 'POST' && path === '/api/merchant/v1/last-leg/return-orders' && actors.has(e.actor)
|
||||
&& String(e.body?.remark).includes(context.marker)) add('return', data.order?.returnNo, actors.get(e.actor), data.order?.overseasWarehouseId, e)
|
||||
|
||||
Reference in New Issue
Block a user