Coverage for packages/clopos/src/integrify/clopos/schemas/receipts/object.py: 100%
232 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
3from integrify.clopos.helpers import IsoDateTime
4from integrify.clopos.schemas.common.object import Timestamp
5from integrify.clopos.schemas.enums import DiscountType, OrderStatus
6from integrify.utils import UnsetField, UnsetOrNoneField
7from pydantic import BaseModel, Field
10class ReceiptProductIn(BaseModel):
11 model_config = {'extra': 'allow'}
13 id: UnsetField[int]
14 """The unique identifier for the receipt product"""
16 cid: str
17 """The CID of the receipt product"""
19 product_id: int
20 """The ID of the product associated with the receipt product"""
22 meta: dict
23 """The meta data of the receipt product"""
25 count: int
26 """The count of the receipt product"""
28 portion_size: Decimal
29 """The portion size of the receipt product"""
31 total: Decimal
32 """The total of the receipt product"""
34 price: Decimal
35 """The price of the receipt product"""
37 cost: UnsetField[Decimal]
38 """The cost of the receipt product"""
40 is_gift: bool
41 """Whether the receipt product is a gift"""
43 created_at: UnsetField[IsoDateTime]
44 """The created at of the receipt product"""
46 updated_at: UnsetField[IsoDateTime]
47 """The updated at of the receipt product"""
49 terminal_updated_at: UnsetField[IsoDateTime]
50 """The terminal updated at of the receipt product"""
52 deleted_at: UnsetField[IsoDateTime]
53 """The deleted at of the receipt product"""
56class ReceiptPaymentMethod(BaseModel):
57 id: int
58 """The payment method ID"""
60 name: str
61 """The name of the payment method"""
63 amount: Decimal
64 """The amount of the payment method"""
67class ReceiptProduct(ReceiptProductIn):
68 receipt_id: int
69 """The ID of the receipt associated with the receipt product"""
71 product_hash: str | None
72 """The hash of the product associated with the receipt product"""
74 preprint_count: int
75 """The preprint count of the receipt product"""
77 station_printed_count: int
78 """The station printed count of the receipt product"""
80 station_aborted_count: int
81 """The station aborted count of the receipt product"""
83 seller_id: int
84 """The ID of the seller associated with the receipt product"""
86 loyalty_type: str | None
87 """The loyalty type of the receipt product"""
89 loyalty_value: Decimal | None
90 """The loyalty value of the receipt product"""
92 discount_rate: Decimal
93 """The discount rate of the receipt product"""
95 discount_value: Decimal
96 """The discount value of the receipt product"""
98 discount_type: DiscountType | None
99 """The discount type of the receipt product"""
101 total_discount: Decimal
102 """The total discount of the receipt product"""
104 subtotal: Decimal
105 """The subtotal of the receipt product"""
107 receipt_discount: Decimal
108 """The receipt discount of the receipt product"""
110 receipt_product_modificators: list
111 """The receipt product modificators of the receipt product"""
113 taxes: list
114 """The taxes of the receipt product"""
117class Receipt(Timestamp):
118 id: int
119 """Unique receipt identifier"""
121 venue_id: UnsetOrNoneField[int]
122 """The ID of the venue associated with the receipt"""
124 cash_shift_cid: UnsetOrNoneField[str]
125 """The UUID of the cash shift associated with the receipt"""
127 cid: UnsetOrNoneField[str]
128 """Transaction UUID"""
130 user_id: UnsetOrNoneField[int]
131 """The ID of the user associated with the receipt"""
133 open_by_user_id: UnsetOrNoneField[int]
134 """The ID of the user who opened the receipt"""
136 close_by_user_id: UnsetOrNoneField[int]
137 """The ID of the user who closed the receipt"""
139 courier_id: UnsetOrNoneField[int]
140 """The ID of the courier associated with the receipt"""
142 seller_id: UnsetOrNoneField[int]
143 """The ID of the seller associated with the receipt"""
145 terminal_id: UnsetOrNoneField[int]
146 """The ID of the terminal associated with the receipt"""
148 source: UnsetOrNoneField[str]
149 """The source of the receipt"""
151 closed_terminal_id: UnsetOrNoneField[int]
152 """The ID of the terminal where the receipt was closed"""
154 service_notification_id: UnsetOrNoneField[int]
155 """The ID of the service notification associated with the receipt"""
157 table_id: UnsetOrNoneField[int]
158 """The ID of the table associated with the receipt"""
160 hall_id: UnsetOrNoneField[int]
161 """The ID of the hall associated with the receipt"""
163 customer_id: UnsetOrNoneField[int]
164 """The ID of the customer associated with the receipt"""
166 sale_type_id: UnsetOrNoneField[int]
167 """Sale type identifier"""
169 is_returns: UnsetOrNoneField[bool]
170 """Whether the receipt is a return"""
172 guests: UnsetOrNoneField[int]
173 """The number of guests associated with the receipt"""
175 status: UnsetOrNoneField[int]
176 """Receipt status code"""
178 local_status: UnsetOrNoneField[int] = None
179 """Receipt local status"""
181 lock: UnsetOrNoneField[bool]
182 """Lock identifier"""
184 inventory_status: UnsetOrNoneField[int]
185 """Inventory status code"""
187 report_status: UnsetOrNoneField[int]
188 """Report status code"""
190 meta: UnsetOrNoneField[dict]
191 """Receipt meta data"""
193 suspicion: UnsetOrNoneField[int]
194 """Suspicion level code"""
196 printed: UnsetOrNoneField[bool]
197 """Whether the receipt has been printed"""
199 total: UnsetOrNoneField[Decimal]
200 """Total amount collected"""
202 subtotal: UnsetOrNoneField[Decimal]
203 """Subtotal before adjustments"""
205 original_subtotal: UnsetOrNoneField[Decimal]
206 """Receipt original subtotal"""
208 gift_total: UnsetOrNoneField[Decimal]
209 """Receipt gift total"""
211 total_cost: UnsetOrNoneField[Decimal] = Field(alias='totalCost')
212 """Receipt total cost"""
214 payment_methods: UnsetOrNoneField[list[ReceiptPaymentMethod]]
215 """Payment methods associated with the receipt"""
217 fiscal_id: UnsetOrNoneField[str]
218 """Receipt fiscal ID"""
220 by_cash: UnsetOrNoneField[Decimal]
221 """Amount collected by cash"""
223 by_card: UnsetOrNoneField[Decimal]
224 """Amount collected by card"""
226 remaining: UnsetOrNoneField[Decimal]
227 """Remaining amount"""
229 customer_discount_type: UnsetOrNoneField[int] = None
230 """Customer discount type"""
232 discount_type: UnsetOrNoneField[DiscountType]
233 """Discount type"""
235 discount_value: UnsetOrNoneField[Decimal]
236 """Discount value"""
238 discount_rate: UnsetOrNoneField[Decimal]
239 """Discount rate"""
241 rps_discount: UnsetOrNoneField[Decimal]
242 """RPS discount"""
244 service_charge: UnsetOrNoneField[Decimal]
245 """Service charge"""
247 service_charge_value: UnsetOrNoneField[Decimal]
248 """Service charge value"""
250 i_tax: UnsetOrNoneField[Decimal]
251 """I tax"""
253 delivery_fee: UnsetOrNoneField[Decimal]
254 """Delivery fee"""
256 e_tax: UnsetOrNoneField[Decimal]
257 """E tax"""
259 total_tax: UnsetOrNoneField[Decimal]
260 """Total tax"""
262 description: UnsetOrNoneField[str]
263 """Receipt description"""
265 address: UnsetOrNoneField[str]
266 """Receipt address"""
268 terminal_version: UnsetOrNoneField[str]
269 """Receipt terminal version"""
271 loyalty_type: UnsetOrNoneField[int]
272 """Loyalty type"""
274 loyalty_value: UnsetOrNoneField[Decimal]
275 """Loyalty value"""
277 order_status: UnsetOrNoneField[OrderStatus]
278 """Order status code"""
280 order_number: UnsetOrNoneField[str]
281 """Order number"""
283 receipt_products: UnsetOrNoneField[list[ReceiptProduct]] = None
284 """Receipt products"""
286 terminal_updated_at: UnsetOrNoneField[str]
287 """Receipt terminal updated at"""
289 closed_at: UnsetOrNoneField[str]
290 """Receipt closed at"""
292 shift_date: UnsetOrNoneField[str]
293 """Shift date associated with the receipt"""
295 gift_count: UnsetOrNoneField[int]
296 """Receipt gift count"""
298 total_discount: UnsetOrNoneField[Decimal]
299 """Receipt total discount"""
301 properties: UnsetOrNoneField[dict]
302 """Receipt properties"""
305class ReceiptStockOperation(BaseModel):
306 id: int
307 """Unique identifier of the stock operation"""
309 receipt_id: int
310 """ID of the receipt that generated this operation"""
312 receipt_product_id: UnsetOrNoneField[int]
313 """ID of the receipt product, if applicable"""
315 product_id: int
316 """ID of the product whose stock changed"""
318 stock_id: int
319 """ID of the stock record"""
321 storage_id: int
322 """ID of the storage the stock belongs to"""
324 quantity: Decimal
325 """The quantity deducted (or added) by this operation"""
327 before_quantity: Decimal
328 """Stock quantity before the operation"""
330 after_quantity: Decimal
331 """Stock quantity after the operation"""
333 cost: Decimal
334 """Unit cost used for the operation"""
336 before_cost: Decimal
337 """Cost before the operation"""
339 total_cost: Decimal
340 """Total cost of the operation"""
342 operated_at: UnsetOrNoneField[str]
343 """Timestamp of the operation (YYYY-MM-DD HH:mm:ss)"""
345 product: UnsetOrNoneField[dict]
346 """The related product object"""
348 stock: UnsetOrNoneField[dict]
349 """The related stock object"""