ORDER-108 - Create order

Create a new commercial order from an optional single source (OPERATION, QUOTE, ORDER, or CART).

⚠️ As of now, OPERATION and QUOTE are supported as sources.

Feature flag

  • Requires OPERATIONS to be enabled for OPERATION source path.

      **User scoping**<br>
      - Only `ACCOUNT` users are allowed.<br><br>
    
      **Store scoping**<br>
      - Effective store is `dj-store` header if provided; otherwise the tenant default store.<br>
      - Caller must be attached to the effective store; otherwise 403.<br><br>
    
      **Operation visibility (when `sourceType = OPERATION`)**<br>
      - Only `ACTIVE` Operations whose `now` is within `[startDate, endDate]` are eligible.<br>
      - `PUBLIC` are visible to all accounts on the store.<br>
      - `PRIVATE` requires an explicit association with the caller's account.<br><br>

Quote visibility (when sourceType = QUOTE)

  • The QUOTE must be valid (not expired/cancelled), belong to the caller's account, be in the effective store, and its status must be WAITING_FOR_CUSTOMER at call time.

Line selection

  • OPERATIONisFull = true (FULL): all eligible Operation lines are added during creation; if none eligible → 422.
  • OPERATIONisFull = false (PARTIAL): the order is created empty but linked to the Operation; lines are then added via ORDER-150 with Operation constraints enforced.
  • QUOTE — only isFull = true is supported: all quote lines are attempted; stock availability is the only product check; out-of-stock lines are ignored; if none remains → 422 / F-E-039.
    If isFull=false is provided for QUOTE → 422 / F-E-040 (Invalid field combination: order must be initialized from a full quote and not a partial one).

Post-creation state (when sourceType = QUOTE)

  • The order is created with status = DRAFT_ORDER_ON_HOLD and is not editable (lines are locked; calls like ORDER-150 must be rejected).
  • Payments: using PAY-101 is allowed; on successful payment the order transitions to CREATED (same as the standard payment workflow).
  • Manual validation (ORDER-212): must not be used if any payment is associated to the order; it is allowed only when no payment is associated, to validate the order without a payment (transition to CREATED).

Language
Credentials
Bearer
JWT
Click Try It! to start a request and see the response here!