Fix order complete: update fulfillment state alongside order state

Square requires all fulfillments to be COMPLETED before the order can be
marked COMPLETED — include fulfillment state in the same updateOrder call.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
chris 2026-06-05 20:08:54 -04:00
parent ef38c42e17
commit ca8773d3c3

View File

@ -27,6 +27,10 @@ export async function POST(
locationId: order.locationId!,
state: 'COMPLETED',
version: order.version,
fulfillments: (order.fulfillments ?? []).map((f) => ({
uid: f.uid,
state: 'COMPLETED',
})),
},
idempotencyKey: `complete-${orderId}`,
})