The Vue Storefront Essentials Course is now available! Learn More
PlaceOrder

PlaceOrder

Implements PlaceOrder Unified Method.

Source

import { defineApi, getCartId, getNormalizerContext } from "@vsf-enterprise/unified-api-sapcc";
import { getNormalizers } from "@vue-storefront/unified-data-model";

export const placeOrder = defineApi.placeOrder(async (context) => {
  const cartId = getCartId(context);
  const order = await context.api.placeOrder({ cartId });
  const { normalizeOrder } = getNormalizers(context);

  return normalizeOrder(order, getNormalizerContext(context));
});