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:
parent
ef38c42e17
commit
ca8773d3c3
@ -24,9 +24,13 @@ export async function POST(
|
|||||||
|
|
||||||
await client.ordersApi.updateOrder(orderId, {
|
await client.ordersApi.updateOrder(orderId, {
|
||||||
order: {
|
order: {
|
||||||
locationId: order.locationId!,
|
locationId: order.locationId!,
|
||||||
state: 'COMPLETED',
|
state: 'COMPLETED',
|
||||||
version: order.version,
|
version: order.version,
|
||||||
|
fulfillments: (order.fulfillments ?? []).map((f) => ({
|
||||||
|
uid: f.uid,
|
||||||
|
state: 'COMPLETED',
|
||||||
|
})),
|
||||||
},
|
},
|
||||||
idempotencyKey: `complete-${orderId}`,
|
idempotencyKey: `complete-${orderId}`,
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user