This commit is contained in:
seb
2026-10-21 11:59:41 +02:00
parent eb1e9e2eb9
commit bb880e3c84
2 changed files with 20 additions and 4 deletions

View File

@@ -289,6 +289,10 @@ export default function create(provider) {
ensureTax,
});
// 8b. Create the shipping (carrier) atomically with the shipment. Must run before the
// summary state ('delivered'/'returned') 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 });
const validState = input.state && ['new', 'delivered', 'returned'].includes(String(input.state).trim().toLowerCase())
@@ -303,9 +307,6 @@ export default function create(provider) {
state: validState,
});
// 10. Create the shipping (carrier) atomically with the shipment
await createShipping(googleAuthId, { ...input.shipping, manifestId }, innerTx);
return loadShipment(runner, q, companyId, manifestId);
};