This commit is contained in:
seb
2026-10-26 19:22:04 +01:00
parent 563945394b
commit bab5c151d0
33 changed files with 2660 additions and 7 deletions

View File

@@ -6,6 +6,7 @@ import makeRunner from '../runner.js';
import shippingCreate from '../shipping/create.js';
import { loadShipment, queriesFor } from './helpers.js';
import { syncOrderSummary } from '../order/syncSummary.js';
import { syncRetoureSummary } from '../retoure/syncSummary.js';
import { syncShipmentSummary } from './syncSummary.js';
function requireId(val, name) {
@@ -293,8 +294,12 @@ export default function create(provider) {
// summary state ('delivered') is written, as that would block shipping creation.
await createShipping(googleAuthId, { ...input.shipping, manifestId }, innerTx);
// 9. Synchronize order summary row and shipment summary row
await syncOrderSummary(runner, { companyId, manifestId: orderId });
// 9. Synchronize order/retoure summary row and shipment summary row
if (order.type === 'retoure') {
await syncRetoureSummary(runner, { companyId, manifestId: orderId });
} else {
await syncOrderSummary(runner, { companyId, manifestId: orderId });
}
const validState = input.state && ['new', 'delivered'].includes(String(input.state).trim().toLowerCase())
? String(input.state).trim().toLowerCase()
: 'new';