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

1from decimal import Decimal 

2 

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 

8 

9 

10class ReceiptProductIn(BaseModel): 

11 model_config = {'extra': 'allow'} 

12 

13 id: UnsetField[int] 

14 """The unique identifier for the receipt product""" 

15 

16 cid: str 

17 """The CID of the receipt product""" 

18 

19 product_id: int 

20 """The ID of the product associated with the receipt product""" 

21 

22 meta: dict 

23 """The meta data of the receipt product""" 

24 

25 count: int 

26 """The count of the receipt product""" 

27 

28 portion_size: Decimal 

29 """The portion size of the receipt product""" 

30 

31 total: Decimal 

32 """The total of the receipt product""" 

33 

34 price: Decimal 

35 """The price of the receipt product""" 

36 

37 cost: UnsetField[Decimal] 

38 """The cost of the receipt product""" 

39 

40 is_gift: bool 

41 """Whether the receipt product is a gift""" 

42 

43 created_at: UnsetField[IsoDateTime] 

44 """The created at of the receipt product""" 

45 

46 updated_at: UnsetField[IsoDateTime] 

47 """The updated at of the receipt product""" 

48 

49 terminal_updated_at: UnsetField[IsoDateTime] 

50 """The terminal updated at of the receipt product""" 

51 

52 deleted_at: UnsetField[IsoDateTime] 

53 """The deleted at of the receipt product""" 

54 

55 

56class ReceiptPaymentMethod(BaseModel): 

57 id: int 

58 """The payment method ID""" 

59 

60 name: str 

61 """The name of the payment method""" 

62 

63 amount: Decimal 

64 """The amount of the payment method""" 

65 

66 

67class ReceiptProduct(ReceiptProductIn): 

68 receipt_id: int 

69 """The ID of the receipt associated with the receipt product""" 

70 

71 product_hash: str | None 

72 """The hash of the product associated with the receipt product""" 

73 

74 preprint_count: int 

75 """The preprint count of the receipt product""" 

76 

77 station_printed_count: int 

78 """The station printed count of the receipt product""" 

79 

80 station_aborted_count: int 

81 """The station aborted count of the receipt product""" 

82 

83 seller_id: int 

84 """The ID of the seller associated with the receipt product""" 

85 

86 loyalty_type: str | None 

87 """The loyalty type of the receipt product""" 

88 

89 loyalty_value: Decimal | None 

90 """The loyalty value of the receipt product""" 

91 

92 discount_rate: Decimal 

93 """The discount rate of the receipt product""" 

94 

95 discount_value: Decimal 

96 """The discount value of the receipt product""" 

97 

98 discount_type: DiscountType | None 

99 """The discount type of the receipt product""" 

100 

101 total_discount: Decimal 

102 """The total discount of the receipt product""" 

103 

104 subtotal: Decimal 

105 """The subtotal of the receipt product""" 

106 

107 receipt_discount: Decimal 

108 """The receipt discount of the receipt product""" 

109 

110 receipt_product_modificators: list 

111 """The receipt product modificators of the receipt product""" 

112 

113 taxes: list 

114 """The taxes of the receipt product""" 

115 

116 

117class Receipt(Timestamp): 

118 id: int 

119 """Unique receipt identifier""" 

120 

121 venue_id: UnsetOrNoneField[int] 

122 """The ID of the venue associated with the receipt""" 

123 

124 cash_shift_cid: UnsetOrNoneField[str] 

125 """The UUID of the cash shift associated with the receipt""" 

126 

127 cid: UnsetOrNoneField[str] 

128 """Transaction UUID""" 

129 

130 user_id: UnsetOrNoneField[int] 

131 """The ID of the user associated with the receipt""" 

132 

133 open_by_user_id: UnsetOrNoneField[int] 

134 """The ID of the user who opened the receipt""" 

135 

136 close_by_user_id: UnsetOrNoneField[int] 

137 """The ID of the user who closed the receipt""" 

138 

139 courier_id: UnsetOrNoneField[int] 

140 """The ID of the courier associated with the receipt""" 

141 

142 seller_id: UnsetOrNoneField[int] 

143 """The ID of the seller associated with the receipt""" 

144 

145 terminal_id: UnsetOrNoneField[int] 

146 """The ID of the terminal associated with the receipt""" 

147 

148 source: UnsetOrNoneField[str] 

149 """The source of the receipt""" 

150 

151 closed_terminal_id: UnsetOrNoneField[int] 

152 """The ID of the terminal where the receipt was closed""" 

153 

154 service_notification_id: UnsetOrNoneField[int] 

155 """The ID of the service notification associated with the receipt""" 

156 

157 table_id: UnsetOrNoneField[int] 

158 """The ID of the table associated with the receipt""" 

159 

160 hall_id: UnsetOrNoneField[int] 

161 """The ID of the hall associated with the receipt""" 

162 

163 customer_id: UnsetOrNoneField[int] 

164 """The ID of the customer associated with the receipt""" 

165 

166 sale_type_id: UnsetOrNoneField[int] 

167 """Sale type identifier""" 

168 

169 is_returns: UnsetOrNoneField[bool] 

170 """Whether the receipt is a return""" 

171 

172 guests: UnsetOrNoneField[int] 

173 """The number of guests associated with the receipt""" 

174 

175 status: UnsetOrNoneField[int] 

176 """Receipt status code""" 

177 

178 local_status: UnsetOrNoneField[int] = None 

179 """Receipt local status""" 

180 

181 lock: UnsetOrNoneField[bool] 

182 """Lock identifier""" 

183 

184 inventory_status: UnsetOrNoneField[int] 

185 """Inventory status code""" 

186 

187 report_status: UnsetOrNoneField[int] 

188 """Report status code""" 

189 

190 meta: UnsetOrNoneField[dict] 

191 """Receipt meta data""" 

192 

193 suspicion: UnsetOrNoneField[int] 

194 """Suspicion level code""" 

195 

196 printed: UnsetOrNoneField[bool] 

197 """Whether the receipt has been printed""" 

198 

199 total: UnsetOrNoneField[Decimal] 

200 """Total amount collected""" 

201 

202 subtotal: UnsetOrNoneField[Decimal] 

203 """Subtotal before adjustments""" 

204 

205 original_subtotal: UnsetOrNoneField[Decimal] 

206 """Receipt original subtotal""" 

207 

208 gift_total: UnsetOrNoneField[Decimal] 

209 """Receipt gift total""" 

210 

211 total_cost: UnsetOrNoneField[Decimal] = Field(alias='totalCost') 

212 """Receipt total cost""" 

213 

214 payment_methods: UnsetOrNoneField[list[ReceiptPaymentMethod]] 

215 """Payment methods associated with the receipt""" 

216 

217 fiscal_id: UnsetOrNoneField[str] 

218 """Receipt fiscal ID""" 

219 

220 by_cash: UnsetOrNoneField[Decimal] 

221 """Amount collected by cash""" 

222 

223 by_card: UnsetOrNoneField[Decimal] 

224 """Amount collected by card""" 

225 

226 remaining: UnsetOrNoneField[Decimal] 

227 """Remaining amount""" 

228 

229 customer_discount_type: UnsetOrNoneField[int] = None 

230 """Customer discount type""" 

231 

232 discount_type: UnsetOrNoneField[DiscountType] 

233 """Discount type""" 

234 

235 discount_value: UnsetOrNoneField[Decimal] 

236 """Discount value""" 

237 

238 discount_rate: UnsetOrNoneField[Decimal] 

239 """Discount rate""" 

240 

241 rps_discount: UnsetOrNoneField[Decimal] 

242 """RPS discount""" 

243 

244 service_charge: UnsetOrNoneField[Decimal] 

245 """Service charge""" 

246 

247 service_charge_value: UnsetOrNoneField[Decimal] 

248 """Service charge value""" 

249 

250 i_tax: UnsetOrNoneField[Decimal] 

251 """I tax""" 

252 

253 delivery_fee: UnsetOrNoneField[Decimal] 

254 """Delivery fee""" 

255 

256 e_tax: UnsetOrNoneField[Decimal] 

257 """E tax""" 

258 

259 total_tax: UnsetOrNoneField[Decimal] 

260 """Total tax""" 

261 

262 description: UnsetOrNoneField[str] 

263 """Receipt description""" 

264 

265 address: UnsetOrNoneField[str] 

266 """Receipt address""" 

267 

268 terminal_version: UnsetOrNoneField[str] 

269 """Receipt terminal version""" 

270 

271 loyalty_type: UnsetOrNoneField[int] 

272 """Loyalty type""" 

273 

274 loyalty_value: UnsetOrNoneField[Decimal] 

275 """Loyalty value""" 

276 

277 order_status: UnsetOrNoneField[OrderStatus] 

278 """Order status code""" 

279 

280 order_number: UnsetOrNoneField[str] 

281 """Order number""" 

282 

283 receipt_products: UnsetOrNoneField[list[ReceiptProduct]] = None 

284 """Receipt products""" 

285 

286 terminal_updated_at: UnsetOrNoneField[str] 

287 """Receipt terminal updated at""" 

288 

289 closed_at: UnsetOrNoneField[str] 

290 """Receipt closed at""" 

291 

292 shift_date: UnsetOrNoneField[str] 

293 """Shift date associated with the receipt""" 

294 

295 gift_count: UnsetOrNoneField[int] 

296 """Receipt gift count""" 

297 

298 total_discount: UnsetOrNoneField[Decimal] 

299 """Receipt total discount""" 

300 

301 properties: UnsetOrNoneField[dict] 

302 """Receipt properties""" 

303 

304 

305class ReceiptStockOperation(BaseModel): 

306 id: int 

307 """Unique identifier of the stock operation""" 

308 

309 receipt_id: int 

310 """ID of the receipt that generated this operation""" 

311 

312 receipt_product_id: UnsetOrNoneField[int] 

313 """ID of the receipt product, if applicable""" 

314 

315 product_id: int 

316 """ID of the product whose stock changed""" 

317 

318 stock_id: int 

319 """ID of the stock record""" 

320 

321 storage_id: int 

322 """ID of the storage the stock belongs to""" 

323 

324 quantity: Decimal 

325 """The quantity deducted (or added) by this operation""" 

326 

327 before_quantity: Decimal 

328 """Stock quantity before the operation""" 

329 

330 after_quantity: Decimal 

331 """Stock quantity after the operation""" 

332 

333 cost: Decimal 

334 """Unit cost used for the operation""" 

335 

336 before_cost: Decimal 

337 """Cost before the operation""" 

338 

339 total_cost: Decimal 

340 """Total cost of the operation""" 

341 

342 operated_at: UnsetOrNoneField[str] 

343 """Timestamp of the operation (YYYY-MM-DD HH:mm:ss)""" 

344 

345 product: UnsetOrNoneField[dict] 

346 """The related product object""" 

347 

348 stock: UnsetOrNoneField[dict] 

349 """The related stock object"""