fix(M09-REGRESSION): 完成商品逐单对账与权限收口
This commit is contained in:
@@ -4228,6 +4228,30 @@ async function assertProductOrderPaymentInventory(pool, context) {
|
||||
callbackId: 'm09d2-first-refund-callback', amountCents: 1400
|
||||
}
|
||||
);
|
||||
const completedReconciliation = await service.reconcileForManagement(
|
||||
adminActor, firstOrder.id
|
||||
);
|
||||
assert.equal(completedReconciliation.consistent, true);
|
||||
assert.equal(completedReconciliation.amounts.netRevenueCents, 0);
|
||||
assert.equal(completedReconciliation.inventory.saleBalance, 2);
|
||||
assert.ok(completedReconciliation.inventory.ledger.some(
|
||||
(entry) => entry.operation === 'LOCK'
|
||||
));
|
||||
assert.ok(completedReconciliation.inventory.ledger.some(
|
||||
(entry) => entry.operation === 'DEDUCT'
|
||||
));
|
||||
assert.ok(completedReconciliation.checks.every((check) => check.passed));
|
||||
|
||||
const platformActor = {
|
||||
...adminActor,
|
||||
access: { roles: ['STAFF'], capabilities: ['platform.manage'], storeIds: [] }
|
||||
};
|
||||
assert.equal((await service.reconcileForManagement(
|
||||
platformActor, firstOrder.id
|
||||
)).consistent, true);
|
||||
assert.ok((await inventory.listStocks(
|
||||
platformActor, { storeId, page: 1, pageSize: 20 }
|
||||
)).total >= 1);
|
||||
|
||||
const restockOrder = await service.create(customerActor, {
|
||||
...firstInput, requestId: 'm09d2-order-restock', note: 'restock order',
|
||||
@@ -4526,6 +4550,14 @@ async function assertProductStorageLifecycle(pool, context) {
|
||||
assert.equal(retrieved.movements.reduce(
|
||||
(sum, movement) => sum + Number(movement.quantity), 0
|
||||
), 3);
|
||||
const storageReconciliation = await orders.reconcileForManagement(
|
||||
adminActor, sourceOrder.id
|
||||
);
|
||||
assert.equal(storageReconciliation.consistent, true);
|
||||
assert.equal(storageReconciliation.storages.length, 1);
|
||||
assert.equal(storageReconciliation.storages[0].recordTotalQuantity, 3);
|
||||
assert.equal(storageReconciliation.storages[0].recordRemainingQuantity, 0);
|
||||
assert.ok(storageReconciliation.checks.every((check) => check.passed));
|
||||
|
||||
await assert.rejects(
|
||||
() => storages.listForManagement({
|
||||
|
||||
Reference in New Issue
Block a user