Product Order
Product order schemas for retail and e-commerce order management. Supports complete order lifecycle from placement through fulfillment and delivery.
Schema: ProductOrderSchema
Source: src/core/business-mgt/product-order.schema.ts
ProductOrderItem​
Individual items within a product order.
Schema: ProductOrderItemSchema
Attributes​
| Attribute | Type | Required | Default | Description |
|---|---|---|---|---|
id | string | — | — | Unique identifier for this order item |
productOrderId | string | Yes | — | References parent ProductOrder |
productId | string | Yes | — | References Product from catalog |
itemName | string | Yes | — | Product name captured at order time |
sku | string | No | — | Product SKU for fulfillment |
quantity | number | Yes | — | Number of units ordered |
unitPrice | number | Yes | — | Price per unit at order time |
totalPrice | number | Yes | — | Total price for this line item |
selectedVariant | string | No | — | Selected variant (size, color, etc.) |
warrantyInfo | string | No | — | Warranty terms captured at purchase |
status | enum | No | PENDING | Current fulfillment status. One of PENDING, CONFIRMED, PROCESSING, SHIPPED, DELIVERED, COMPLETED, or CANCELLED. |
notes | string | No | — | Internal notes for staff |
ProductOrder​
Complete product order with items, customer, and shipping.
Attributes​
| Attribute | Type | Required | Default | Description |
|---|---|---|---|---|
id | string | — | — | Unique identifier for the order |
orderNumber | string | No | — | Human-readable order number |
status | enum | No | PENDING | Current order status. One of PENDING, CONFIRMED, PROCESSING, SHIPPED, DELIVERED, COMPLETED, or CANCELLED. |
items | array<ProductOrderItem> | Yes | — | Products in this order (min 1) |
customerId | string | Yes | — | References Customer |
customer | OrderCustomer | No | — | Populated customer information |
pricing | OrderPricing | Yes | — | Complete pricing breakdown |
paymentStatus | enum | No | PENDING | Payment processing status. One of PENDING, PAID, FAILED, or REFUNDED. |
paymentMethod | string | No | — | Payment method used |
paymentReference | string | No | — | External payment reference |
billingAddress | OrderAddress | No | — | Billing address |
orderDate | number | Yes | — | Unix timestamp when placed |
requestedDeliveryDate | number | No | — | Requested delivery date |
shippedDate | number | No | — | Unix timestamp when shipped |
shippingAddress | OrderAddress | No | — | Delivery address |
deliveredDate | number | No | — | Unix timestamp when delivered |
shippingMethod | string | No | — | Shipping service level |
trackingNumber | string | No | — | Carrier tracking number |
shippingCarrier | string | No | — | Shipping carrier name |
externalOrderId | string | No | — | External system order ID |
source | string | No | direct | Order source channel |
cancelReason | string | null | No | — | Reason for cancellation |
notes | string | null | No | — | Internal operational notes |
serviceConversationConfigId | string | null | No | — | AI service conversation config ID |
createdAt | number | — | — | Unix timestamp when created |
updatedAt | number | — | — | Unix timestamp when last updated |
OrderInventoryUpdate​
Schema for inventory adjustments triggered by order fulfillment.
Attributes​
| Attribute | Type | Required | Description |
|---|---|---|---|
orderId | string | Yes | References ProductOrder that triggered the update |
inventoryAdjustments | array | Yes | Array of inventory deductions |
Inventory Adjustment Object​
| Attribute | Type | Description |
|---|---|---|
productId | string | References Product to adjust |
quantityUsed | number | Quantity to deduct from stock |
reason | literal | Always order_fulfillment |
Example​
{
"id": "order_abc123",
"orderNumber": "ORD-2024-001",
"status": "SHIPPED",
"items": [
{
"id": "item_001",
"productOrderId": "order_abc123",
"productId": "prod_headphones",
"itemName": "Wireless Bluetooth Headphones",
"sku": "WBH-001-BLK",
"quantity": 1,
"unitPrice": 149.99,
"totalPrice": 149.99,
"selectedVariant": "Black",
"status": "SHIPPED"
}
],
"customerId": "cust_abc123",
"pricing": {
"subtotal": 149.99,
"tax": 12.00,
"shippingAmount": 9.99,
"discount": 0,
"total": 171.98,
"currency": "USD"
},
"paymentStatus": "PAID",
"paymentMethod": "credit_card",
"orderDate": 1709856000000,
"shippedDate": 1709942400000,
"shippingMethod": "Standard",
"trackingNumber": "1Z999AA10123456784",
"shippingCarrier": "UPS",
"source": "web",
"createdAt": 1709856000000,
"updatedAt": 1709942400000
}
Create / Update Schemas​
| Schema | Description | Omits |
|---|---|---|
CreateProductOrderSchema | For creating orders | id, orderNumber, createdAt, updatedAt, deliveredDate, shippedDate, customer, cancelReason, serviceConversationConfigId |
UpdateProductOrderSchema | For partial updates | All fields optional except id |
UpdateProductOrderStatusSchema | For quick status updates | Only id, status, shippedDate, deliveredDate, trackingNumber |