Complete orderv1.0.0 · JSON Schema
Marks an existing Order as Completed when its current status is New.
1. Mark an Order as Completed
An admin or fulfillment workflow completes a New order via Ordering API using an idempotent x-request-id header.
Payload details
orderId: UUID of the order passed in the route (/api/v1/orders/{orderId}/complete).x-request-id: Required UUID idempotency key header (HttpHeaders.RequestId).- Request body: None.
Using this example
Returns 200 OK with the updated Order JSON payload (status: "Completed") and dispatches OrderStatusChangedToCompleteIntegrationEvent.
using BookWorm.Chassis.Utilities.Configurations;using BookWorm.Constants.Aspire;using Refit;
public interface IOrderApiClient{ [Patch("/api/v1/orders/{orderId}/complete")] Task<OrderResponse> CompleteOrderAsync( Guid orderId, [Header("x-request-id")] Guid requestId, CancellationToken cancellationToken = default );}
// DI registration following BookWorm.Chassis Refit patternbuilder.Services .AddRefitGeneratedClient<IOrderApiClient>(settings, Services.Ordering) .ConfigureHttpClient(client => client.BaseAddress = new($"https+http://{Services.Ordering}")) .ConfigurePrimaryHttpMessageHandler(() => new SocketsHttpHandler { PooledConnectionLifetime = TimeSpan.FromMinutes(5) } );
// Typed invocationvar completed = await orderApiClient.CompleteOrderAsync( Guid.Parse("01960a1b-3c4d-7e00-8a9b-0c1d2e3f4a99"), Guid.CreateVersion7(), cancellationToken);import ordersApiClient from "@workspace/api-client/ordering/orders";import useCompleteOrder from "@workspace/api-hooks/ordering/orders/useCompleteOrder";
const orderId = "01960a1b-3c4d-7e00-8a9b-0c1d2e3f4a99";
// 1. Direct @workspace/api-client (Axios) call (sets x-request-id automatically)const completedOrder = await ordersApiClient.complete(orderId);
// 2. React / TanStack Query hook (@workspace/api-hooks)const { mutate: completeOrder, isPending } = useCompleteOrder({ onSuccess: (order) => { console.log(`Order ${order.id} transitioned to ${order.status}`); },});
completeOrder(orderId);1{
2 "$schema": "https://json-schema.org/draft/2020-12/schema",
3 "title": "CompleteOrderRequest",
4 "description": "Path and header parameters for completing an Order. The operation has no request body.",
5 "type": "object",
6 "required": ["orderId", "x-request-id"],
7 "properties": {
8 "orderId": {
9 "type": "string",
10 "description": "Unique identifier of the Order to complete."
11 },
12 "x-request-id": {
13 "type": "string",
14 "description": "Idempotency key for the completion request."
15 }
16 }
17}
18