11from decimal import Decimal
2- from typing import Optional
32
43from pydantic import BaseModel
54
65from integrify .clopos .helpers import IsoDateTime
6+ from integrify .utils import UnsetField , UnsetOrNoneField
77
88
99class PaymentMethodIn (BaseModel ):
@@ -17,8 +17,39 @@ class PaymentMethodIn(BaseModel):
1717 """The amount of the payment method"""
1818
1919
20- class ReceiptProductIn (BaseModel ):
20+ class ServiceIn (BaseModel ):
21+ sale_type_id : int
22+ sale_type_name : str
23+ venue_id : int
24+ venue_name : str
25+
26+
27+ class CustomerIn (BaseModel ):
2128 id : int
29+ name : str
30+ customer_discount_type : UnsetField [int ] = None
31+ phone : UnsetField [str ] = None
32+ address : UnsetOrNoneField [str ]
33+
34+
35+ class ProductIn (BaseModel ):
36+ product_id : int
37+ count : int
38+ product_modificators : UnsetOrNoneField [list [dict ]]
39+ meta : UnsetOrNoneField [dict ]
40+
41+
42+ class OrderPayloadIn (BaseModel ):
43+ service : ServiceIn
44+ customer : CustomerIn
45+ products : list [ProductIn ]
46+ meta : UnsetOrNoneField [dict ]
47+
48+
49+ class ReceiptProductIn (BaseModel ):
50+ model_config = {'extra' : 'allow' }
51+
52+ id : UnsetField [int ]
2253 """The unique identifier for the receipt product"""
2354
2455 cid : str
@@ -27,12 +58,6 @@ class ReceiptProductIn(BaseModel):
2758 product_id : int
2859 """The ID of the product associated with the receipt product"""
2960
30- receipt_id : int
31- """The ID of the receipt associated with the receipt product"""
32-
33- product_hash : str
34- """The hash of the product associated with the receipt product"""
35-
3661 meta : dict
3762 """The meta data of the receipt product"""
3863
@@ -48,62 +73,20 @@ class ReceiptProductIn(BaseModel):
4873 price : Decimal
4974 """The price of the receipt product"""
5075
51- cost : Decimal
76+ cost : UnsetField [ Decimal ]
5277 """The cost of the receipt product"""
5378
5479 is_gift : bool
5580 """Whether the receipt product is a gift"""
5681
57- preprint_count : int
58- """The preprint count of the receipt product"""
59-
60- station_printed_count : int
61- """The station printed count of the receipt product"""
62-
63- station_aborted_count : int
64- """The station aborted count of the receipt product"""
65-
66- seller_id : int
67- """The ID of the seller associated with the receipt product"""
68-
69- loyalty_type : Optional [str ]
70- """The loyalty type of the receipt product"""
71-
72- loyalty_value : Optional [Decimal ]
73- """The loyalty value of the receipt product"""
74-
75- discount_rate : Decimal
76- """The discount rate of the receipt product"""
77-
78- discount_value : Decimal
79- """The discount value of the receipt product"""
80-
81- discount_type : Decimal
82- """The discount type of the receipt product"""
83-
84- total_discount : Decimal
85- """The total discount of the receipt product"""
86-
87- subtotal : Decimal
88- """The subtotal of the receipt product"""
89-
90- receipt_discount : Decimal
91- """The receipt discount of the receipt product"""
92-
93- created_at : IsoDateTime
82+ created_at : UnsetField [IsoDateTime ]
9483 """The created at of the receipt product"""
9584
96- updated_at : IsoDateTime
85+ updated_at : UnsetField [ IsoDateTime ]
9786 """The updated at of the receipt product"""
9887
99- terminal_updated_at : IsoDateTime
88+ terminal_updated_at : UnsetField [ IsoDateTime ]
10089 """The terminal updated at of the receipt product"""
10190
102- deleted_at : IsoDateTime
91+ deleted_at : UnsetField [ IsoDateTime ]
10392 """The deleted at of the receipt product"""
104-
105- receipt_product_modificators : list
106- """The receipt product modificators of the receipt product"""
107-
108- taxes : list
109- """The taxes of the receipt product"""
0 commit comments