PlaceOrder
Implements PlaceOrder
Unified Method.
Source
import { defineApi, getCartId } from "@vsf-enterprise/unified-api-sapcc";
import { getNormalizers } from "@vsf-enterprise/unified-api-sapcc/udl";
declare module "@vsf-enterprise/unified-api-sapcc" {
interface PlaceOrderExtendedArgs {
/**
* Response configuration. List of fields returned in the response body.
*/
fields?: "BASIC" | "DEFAULT" | "FULL" | string | string[];
}
}
export const placeOrder = defineApi.placeOrder(async (context) => {
const cartId = getCartId(context);
const { data: order } = await context.api.placeOrder({ cartId });
const { normalizeOrder } = getNormalizers(context);
return normalizeOrder(order);
});