Coverage for packages/clopos/src/integrify/clopos/schemas/orders/object.py: 100%
136 statements
« prev ^ index » next coverage.py v7.16.0, created at 2026-10-19 02:39 +0000
« prev ^ index » next coverage.py v7.16.0, created at 2026-10-19 02:39 +0000
1from decimal import Decimal
2from typing import Union
4from integrify.clopos.schemas.common.object import Service, Timestamp
5from integrify.clopos.schemas.enums import DiscountType, OrderStatus
6from integrify.clopos.schemas.products.object import Product
7from integrify.clopos.schemas.sales.object import PaymentMethod, SaleType
8from integrify.utils import UnsetField, UnsetOrNoneField
9from pydantic import BaseModel
12class ServiceIn(BaseModel):
13 sale_type_id: int
14 sale_type_name: str
15 venue_id: int
16 venue_name: str
19class CustomerIn(BaseModel):
20 id: int
21 name: str
22 customer_discount_type: UnsetField[int] = None
23 phone: UnsetField[str] = None
24 address: UnsetOrNoneField[str]
27class ProductIn(BaseModel):
28 product_id: int
29 count: int
30 product_modificators: UnsetOrNoneField[list[dict]]
31 meta: UnsetOrNoneField[dict]
34class OrderPayloadIn(BaseModel):
35 service: ServiceIn
36 customer: CustomerIn
37 products: list[ProductIn]
38 meta: UnsetOrNoneField[dict]
41class OrderProductProduct(BaseModel):
42 product: UnsetOrNoneField[Union['Product', list]]
43 """The product information"""
45 count: int
46 """The quantity of the product"""
48 status: UnsetOrNoneField[str]
49 """The status of the product (e.g., "Active", "Inactive")"""
51 product_modificators: UnsetOrNoneField[list[dict]]
52 """The modificators of the product"""
54 product_hash: UnsetOrNoneField[str]
55 """The hash of the product"""
58class OrderProductMeta(BaseModel):
59 price: UnsetOrNoneField[Decimal]
60 """The sales price of the product"""
62 order_product: OrderProductProduct
63 """The product information"""
66class OrderProduct(BaseModel):
67 product_id: UnsetOrNoneField[int]
68 """The product ID"""
70 count: int
71 """The quantity of the product"""
73 product_modificators: UnsetOrNoneField[list[dict]]
74 """The modificators of the product"""
76 meta: UnsetOrNoneField[OrderProductMeta]
77 """The product information"""
80class OrderCustomer(BaseModel):
81 id: UnsetOrNoneField[int]
82 """The customer ID"""
84 name: str
85 """The name of the customer"""
87 phone: UnsetOrNoneField[str]
88 """The phone number of the customer"""
90 address: UnsetOrNoneField[str]
91 """The address of the customer"""
93 customer_discount_type: UnsetOrNoneField[DiscountType] # noqa: F821
94 """The discount type of the customer"""
97class OrderPayload(BaseModel):
98 service: UnsetOrNoneField[Service]
99 """The sale type of the order"""
101 customer: UnsetOrNoneField['OrderCustomer']
102 """The sale type of the order"""
104 products: UnsetOrNoneField[list[OrderProduct]]
105 """The products in the order"""
107 meta: UnsetOrNoneField[dict]
108 """The order information"""
110 customer_id: UnsetOrNoneField[int]
111 """The customer ID of the order"""
113 sale_type_id: UnsetOrNoneField[int]
114 """The sale type ID of the order"""
116 payload_updated_at: UnsetOrNoneField[str]
117 """The timestamp of the last update to the payload"""
120class OrderItem(BaseModel):
121 id: int
122 """The order item's identifier"""
124 product_id: int
125 """The product ID of the order item"""
127 quantity: int
128 """The quantity of the order item"""
130 unit_price: Decimal
131 """The sales price of the order item"""
133 total_price: Decimal
134 """The total sales price of the order item"""
137class Order(Timestamp):
138 id: int
139 """The unique identifier for the order"""
141 venue_id: UnsetOrNoneField[int]
142 """The ID of the venue associated with the order"""
144 type: UnsetOrNoneField[str]
145 """The ID of the sale type associated with the order"""
147 integration: UnsetOrNoneField[str]
148 """The integration channel associated with the order"""
150 integration_uuid: UnsetOrNoneField[str]
151 """The UUID of the integration associated with the order"""
153 integration_id: UnsetOrNoneField[int]
154 """The ID of the integration associated with the order"""
156 customer_ref_id: UnsetOrNoneField[str]
157 """The reference ID of the customer associated with the order"""
159 integration_status: UnsetOrNoneField[str]
160 """The status of the integration associated with the order"""
162 integration_response: UnsetOrNoneField[str]
163 """The response from the integration associated with the order"""
165 customer_id: UnsetOrNoneField[int]
166 """The ID of the customer associated with the order"""
168 receive_user_id: UnsetOrNoneField[int]
169 """The ID of the user who received the order"""
171 receive_terminal_id: UnsetOrNoneField[int]
172 """The ID of the terminal where the order was received"""
174 status: OrderStatus
175 """Current lifecycle state. accepted orders are sent to the POS"""
177 payload: OrderPayload
178 """ Payload of the order"""
180 receipt_id: UnsetOrNoneField[int]
181 """Linked open receipt ID once the POS accepts the order"""
183 payment_status: UnsetOrNoneField[str]
184 """ Payment state (e.g., pending, paid)"""
186 total_amount: UnsetOrNoneField[Decimal]
187 """Order grand total"""
189 line_items: UnsetOrNoneField[list[OrderItem]]
190 """Line items of the order"""
192 sale_type: UnsetOrNoneField[SaleType]
193 """An object containing details of the associated sale type"""
195 payment_method_id: UnsetOrNoneField[int]
196 """The ID of the payment method associated with the order"""
198 payment_method: UnsetOrNoneField[PaymentMethod]
199 """An object containing details of the associated payment method"""
201 properties: UnsetOrNoneField[dict]
202 """Additional properties of the order"""