|
| 1 | +{ |
| 2 | + "$id": "gts.x.commerce.orders.order.v1.0~", |
| 3 | + "$schema": "http://json-schema.org/draft-07/schema#", |
| 4 | + "title": "Order", |
| 5 | + "description": "Base order schema definition for e-commerce orders", |
| 6 | + "type": "object", |
| 7 | + "properties": { |
| 8 | + "id": { |
| 9 | + "type": "string", |
| 10 | + "format": "uuid", |
| 11 | + "description": "Unique identifier for the order" |
| 12 | + }, |
| 13 | + "orderNumber": { |
| 14 | + "type": "string", |
| 15 | + "description": "Human-readable order number" |
| 16 | + }, |
| 17 | + "status": { |
| 18 | + "type": "string", |
| 19 | + "enum": [ |
| 20 | + "pending", |
| 21 | + "confirmed", |
| 22 | + "processing", |
| 23 | + "shipped", |
| 24 | + "delivered", |
| 25 | + "cancelled", |
| 26 | + "refunded", |
| 27 | + "returned" |
| 28 | + ], |
| 29 | + "default": "pending", |
| 30 | + "description": "Current status of the order" |
| 31 | + }, |
| 32 | + "customerId": { |
| 33 | + "type": "string", |
| 34 | + "format": "uuid", |
| 35 | + "description": "Reference to the customer who placed the order" |
| 36 | + }, |
| 37 | + "customerEmail": { |
| 38 | + "type": "string", |
| 39 | + "format": "email", |
| 40 | + "description": "Email address of the customer" |
| 41 | + }, |
| 42 | + "subtotal": { |
| 43 | + "type": "number", |
| 44 | + "minimum": 0, |
| 45 | + "description": "Subtotal amount before tax and shipping" |
| 46 | + }, |
| 47 | + "taxAmount": { |
| 48 | + "type": "number", |
| 49 | + "minimum": 0, |
| 50 | + "default": 0, |
| 51 | + "description": "Tax amount applied to the order" |
| 52 | + }, |
| 53 | + "discountAmount": { |
| 54 | + "type": "number", |
| 55 | + "minimum": 0, |
| 56 | + "default": 0, |
| 57 | + "description": "Discount amount applied to the order" |
| 58 | + }, |
| 59 | + "totalAmount": { |
| 60 | + "type": "number", |
| 61 | + "minimum": 0, |
| 62 | + "description": "Final total amount including all charges" |
| 63 | + }, |
| 64 | + "currency": { |
| 65 | + "type": "string", |
| 66 | + "default": "USD", |
| 67 | + "description": "Currency code for all monetary amounts" |
| 68 | + }, |
| 69 | + "items": { |
| 70 | + "type": "array", |
| 71 | + "items": { |
| 72 | + "$ref": "#/definitions/OrderItem" |
| 73 | + }, |
| 74 | + "description": "List of items in the order" |
| 75 | + }, |
| 76 | + "shippingAddress": { |
| 77 | + "$ref": "#/definitions/Address", |
| 78 | + "description": "Shipping address for the order" |
| 79 | + }, |
| 80 | + "billingAddress": { |
| 81 | + "$ref": "#/definitions/Address", |
| 82 | + "description": "Billing address for the order" |
| 83 | + }, |
| 84 | + "shippingMethod": { |
| 85 | + "type": "string", |
| 86 | + "description": "Shipping method selected for the order" |
| 87 | + }, |
| 88 | + "shippingCost": { |
| 89 | + "type": "number", |
| 90 | + "minimum": 0, |
| 91 | + "default": 0, |
| 92 | + "description": "Shipping cost for the order" |
| 93 | + }, |
| 94 | + "paymentMethod": { |
| 95 | + "type": "string", |
| 96 | + "enum": [ |
| 97 | + "credit_card", |
| 98 | + "debit_card", |
| 99 | + "paypal", |
| 100 | + "bank_transfer", |
| 101 | + "cash_on_delivery", |
| 102 | + "gift_card" |
| 103 | + ], |
| 104 | + "description": "Payment method used for the order" |
| 105 | + }, |
| 106 | + "paymentStatus": { |
| 107 | + "type": "string", |
| 108 | + "enum": [ |
| 109 | + "pending", |
| 110 | + "processing", |
| 111 | + "completed", |
| 112 | + "failed", |
| 113 | + "cancelled", |
| 114 | + "refunded" |
| 115 | + ], |
| 116 | + "default": "pending", |
| 117 | + "description": "Payment status of the order" |
| 118 | + }, |
| 119 | + "paymentReference": { |
| 120 | + "type": "string", |
| 121 | + "description": "Payment provider reference number" |
| 122 | + }, |
| 123 | + "notes": { |
| 124 | + "type": "string", |
| 125 | + "description": "Additional notes or comments for the order" |
| 126 | + }, |
| 127 | + "tags": { |
| 128 | + "type": "array", |
| 129 | + "items": { |
| 130 | + "type": "string" |
| 131 | + }, |
| 132 | + "description": "Tags for categorizing or flagging the order" |
| 133 | + }, |
| 134 | + "createdAt": { |
| 135 | + "type": "string", |
| 136 | + "format": "date-time", |
| 137 | + "description": "Timestamp when the order was created" |
| 138 | + }, |
| 139 | + "updatedAt": { |
| 140 | + "type": "string", |
| 141 | + "format": "date-time", |
| 142 | + "description": "Timestamp when the order was last updated" |
| 143 | + }, |
| 144 | + "shippedAt": { |
| 145 | + "type": "string", |
| 146 | + "format": "date-time", |
| 147 | + "description": "Timestamp when the order was shipped" |
| 148 | + }, |
| 149 | + "deliveredAt": { |
| 150 | + "type": "string", |
| 151 | + "format": "date-time", |
| 152 | + "description": "Timestamp when the order was delivered" |
| 153 | + } |
| 154 | + }, |
| 155 | + "definitions": { |
| 156 | + "OrderItem": { |
| 157 | + "type": "object", |
| 158 | + "properties": { |
| 159 | + "id": { |
| 160 | + "type": "string", |
| 161 | + "format": "uuid", |
| 162 | + "description": "Unique identifier for the order item" |
| 163 | + }, |
| 164 | + "productId": { |
| 165 | + "type": "string", |
| 166 | + "format": "uuid", |
| 167 | + "description": "Reference to the product" |
| 168 | + }, |
| 169 | + "productName": { |
| 170 | + "type": "string", |
| 171 | + "description": "Name of the product" |
| 172 | + }, |
| 173 | + "productSku": { |
| 174 | + "type": "string", |
| 175 | + "description": "Stock keeping unit of the product" |
| 176 | + }, |
| 177 | + "quantity": { |
| 178 | + "type": "integer", |
| 179 | + "minimum": 1, |
| 180 | + "description": "Quantity of the product ordered" |
| 181 | + }, |
| 182 | + "unitPrice": { |
| 183 | + "type": "number", |
| 184 | + "minimum": 0, |
| 185 | + "description": "Price per unit of the product" |
| 186 | + }, |
| 187 | + "totalPrice": { |
| 188 | + "type": "number", |
| 189 | + "minimum": 0, |
| 190 | + "description": "Total price for this line item" |
| 191 | + }, |
| 192 | + "discountAmount": { |
| 193 | + "type": "number", |
| 194 | + "minimum": 0, |
| 195 | + "default": 0, |
| 196 | + "description": "Discount applied to this item" |
| 197 | + }, |
| 198 | + "taxAmount": { |
| 199 | + "type": "number", |
| 200 | + "minimum": 0, |
| 201 | + "default": 0, |
| 202 | + "description": "Tax amount for this item" |
| 203 | + }, |
| 204 | + "metadata": { |
| 205 | + "type": "object", |
| 206 | + "additionalProperties": true, |
| 207 | + "description": "Additional metadata for the order item" |
| 208 | + } |
| 209 | + }, |
| 210 | + "required": ["productId", "productName", "quantity", "unitPrice", "totalPrice"] |
| 211 | + }, |
| 212 | + "Address": { |
| 213 | + "type": "object", |
| 214 | + "properties": { |
| 215 | + "id": { |
| 216 | + "type": "string", |
| 217 | + "format": "uuid", |
| 218 | + "description": "Unique identifier for the address" |
| 219 | + }, |
| 220 | + "firstName": { |
| 221 | + "type": "string", |
| 222 | + "description": "First name of the recipient" |
| 223 | + }, |
| 224 | + "lastName": { |
| 225 | + "type": "string", |
| 226 | + "description": "Last name of the recipient" |
| 227 | + }, |
| 228 | + "company": { |
| 229 | + "type": "string", |
| 230 | + "description": "Company name if applicable" |
| 231 | + }, |
| 232 | + "addressLine1": { |
| 233 | + "type": "string", |
| 234 | + "description": "Primary address line" |
| 235 | + }, |
| 236 | + "addressLine2": { |
| 237 | + "type": "string", |
| 238 | + "description": "Secondary address line" |
| 239 | + }, |
| 240 | + "city": { |
| 241 | + "type": "string", |
| 242 | + "description": "City" |
| 243 | + }, |
| 244 | + "state": { |
| 245 | + "type": "string", |
| 246 | + "description": "State or province" |
| 247 | + }, |
| 248 | + "postalCode": { |
| 249 | + "type": "string", |
| 250 | + "description": "Postal or ZIP code" |
| 251 | + }, |
| 252 | + "country": { |
| 253 | + "type": "string", |
| 254 | + "description": "Country code (ISO 3166-1 alpha-2)" |
| 255 | + }, |
| 256 | + "phone": { |
| 257 | + "type": "string", |
| 258 | + "description": "Phone number" |
| 259 | + } |
| 260 | + }, |
| 261 | + "required": ["firstName", "lastName", "addressLine1", "city", "state", "postalCode", "country"] |
| 262 | + } |
| 263 | + } |
| 264 | +} |
0 commit comments