elemento-loyalty-processing 1.0.10__py3-none-any.whl → 1.0.12__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,4 +2,4 @@
2
2
 
3
3
  __author__ = "Anton Taraskin"
4
4
  __email__ = "hel.nidhoggr@gmail.com"
5
- __version__ = "1.0.6"
5
+ __version__ = "1.0.11"
@@ -1,6 +1,6 @@
1
1
  """RPC client services for customer app."""
2
2
 
3
- from datetime import datetime
3
+ from datetime import date, datetime
4
4
  from typing import Any
5
5
 
6
6
  from kaiju_tools.http import RPCClientService
@@ -19,6 +19,58 @@ class ElementoLoyaltyProcessingClient(RPCClientService):
19
19
  method="Lists.products.set", params=dict(id=id, items=items), max_timeout=_max_timeout, nowait=_nowait
20
20
  )
21
21
 
22
+ async def balance_history(
23
+ self,
24
+ customer_id: CustomerId,
25
+ next_transaction_id: TransactionId | None = None,
26
+ limit: int = 10,
27
+ _max_timeout: int = None,
28
+ _nowait: bool = False,
29
+ ) -> list:
30
+ return await self.call(
31
+ method="Balance.history",
32
+ params=dict(customer_id=customer_id, next_transaction_id=next_transaction_id, limit=limit),
33
+ max_timeout=_max_timeout,
34
+ nowait=_nowait,
35
+ )
36
+
37
+ async def balance_history_list(
38
+ self,
39
+ customer_id: CustomerId,
40
+ page: int = 1,
41
+ per_page: int = 24,
42
+ _max_timeout: int = None,
43
+ ) -> dict:
44
+ return await self.call(
45
+ method="Balance.history.list",
46
+ params=dict(customer_id=customer_id, page=page, per_page=per_page),
47
+ max_timeout=_max_timeout,
48
+ nowait=False,
49
+ )
50
+
51
+ async def balance_history_expiring(
52
+ self, customer_id: CustomerId, active_to: str, _max_timeout: int = None, _nowait: bool = False
53
+ ) -> list:
54
+ return await self.call(
55
+ method="Balance.history.expiring",
56
+ params=dict(customer_id=customer_id, active_to=active_to),
57
+ max_timeout=_max_timeout,
58
+ nowait=_nowait,
59
+ )
60
+
61
+ async def balance_history_expiring_list(
62
+ self,
63
+ customer_id: CustomerId,
64
+ active_to: str,
65
+ _max_timeout: int = None,
66
+ ) -> list[Any]:
67
+ return await self.call(
68
+ method="Balance.history.expiring.list",
69
+ params=dict(customer_id=customer_id, active_to=active_to),
70
+ max_timeout=_max_timeout,
71
+ nowait=False,
72
+ )
73
+
22
74
  async def balance_get_balance(
23
75
  self, customer_id: CustomerId, _max_timeout: int = None, _nowait: bool = False
24
76
  ) -> Points:
@@ -153,5 +205,32 @@ class ElementoLoyaltyProcessingClient(RPCClientService):
153
205
  nowait=_nowait,
154
206
  )
155
207
 
208
+ async def balance_history(
209
+ self,
210
+ customer_id: int,
211
+ next_transaction_id: int | None = None,
212
+ limit: int = 10,
213
+ _max_timeout: int = None,
214
+ _nowait: bool = False,
215
+ ):
216
+ """Call Balance.history."""
217
+ return await self.call(
218
+ method="Balance.history",
219
+ params={"customer_id": customer_id, "limit": limit, "next_transaction_id": next_transaction_id},
220
+ max_timeout=_max_timeout,
221
+ nowait=_nowait,
222
+ )
223
+
224
+ async def balance_history_expiring(
225
+ self, customer_id: int, active_to: date, _max_timeout: int = None, _nowait: bool = False
226
+ ):
227
+ """Call alance.history.expiring."""
228
+ return await self.call(
229
+ method="Balance.history.expiring",
230
+ params={"customer_id": customer_id, "active_to": active_to},
231
+ max_timeout=_max_timeout,
232
+ nowait=_nowait,
233
+ )
234
+
156
235
 
157
236
  SERVICE_CLASS_REGISTRY.register(ElementoLoyaltyProcessingClient)
@@ -37,6 +37,7 @@ __all__ = [
37
37
  "AppliedOffer",
38
38
  "PointType",
39
39
  "TransactionExtId",
40
+ "PurchaseStats",
40
41
  ]
41
42
 
42
43
  DATE_MAXVALUE = date.fromisoformat("3000-01-01")
@@ -145,6 +146,7 @@ class Item(Struct):
145
146
  class Cart(Struct):
146
147
  items: list[Item]
147
148
  total: Decimal = Decimal(0)
149
+ initial_total: Decimal = Decimal(0)
148
150
  discount: Decimal = Decimal(0)
149
151
  points_add: Points = Points(0)
150
152
  points_sub: Points = Points(0)
@@ -159,11 +161,13 @@ class StoredTransaction(Struct):
159
161
  id: TransactionId
160
162
  created: datetime
161
163
  customer_id: CustomerId
164
+ total: int
162
165
  type: TransactionType
163
166
  balance: list[int]
167
+ quantity: list[int]
164
168
  ext_id: TransactionExtId
165
169
  source: str
166
- data: dict[str, Any] = None
170
+ # data: dict[str, Any] = None
167
171
  active: bool = True
168
172
 
169
173
 
@@ -176,3 +180,9 @@ class Transaction(Struct):
176
180
  timestamp: datetime = None
177
181
  cart: Cart = None
178
182
  confirmed: bool = False
183
+
184
+
185
+ class PurchaseStats(Struct):
186
+ total: int
187
+ oldest_date: date | None
188
+ latest_date: date | None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: elemento-loyalty-processing
3
- Version: 1.0.10
3
+ Version: 1.0.12
4
4
  Summary: Elemento Loyalty Processing
5
5
  Requires-Python: >=3.11
6
6
  Requires-Dist: kaiju-tools<3,>=2.4.12
@@ -0,0 +1,7 @@
1
+ elemento_loyalty_processing/__init__.py,sha256=32qjgePFNecQb5PvKkcoMCOEoSSl-OkQ2BEWgQ069bE,118
2
+ elemento_loyalty_processing/client.py,sha256=_u2ObL9p1-bMqFHD4okzpNT-6IyaUKIVaHlLw8vK8dg,7967
3
+ elemento_loyalty_processing/types.py,sha256=JPR1RlZ2XEmR0VOf3azhwvd7yrivpCMObF-QAU7qfmA,3983
4
+ elemento_loyalty_processing-1.0.12.dist-info/METADATA,sha256=rONe7DgqnoFYKqsqK-eifeZz5io9pTTbYrLNJRmdRQI,450
5
+ elemento_loyalty_processing-1.0.12.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
+ elemento_loyalty_processing-1.0.12.dist-info/top_level.txt,sha256=N_AtPyYKvkr1NkoPAUrVl_4VCTP-kJIehtsLhkdacAc,28
7
+ elemento_loyalty_processing-1.0.12.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- elemento_loyalty_processing/__init__.py,sha256=fHuu8DtGv3an9oFY_4YEI9lvKn0w-rLd7ooxKUdlA2g,117
2
- elemento_loyalty_processing/client.py,sha256=x6g-53AxHTCwCp7FZKFL2lSyDLUMegaDAuXPFGhUeX4,5346
3
- elemento_loyalty_processing/types.py,sha256=A0WNlIOJGL4WfmcJtKt9FXz7QSvkUUqzYYuubDZkdyc,3777
4
- elemento_loyalty_processing-1.0.10.dist-info/METADATA,sha256=1RVpJdIZnrWcAmrJNyudXf16xMw2u3lgDaUFW4bOo5c,450
5
- elemento_loyalty_processing-1.0.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
- elemento_loyalty_processing-1.0.10.dist-info/top_level.txt,sha256=N_AtPyYKvkr1NkoPAUrVl_4VCTP-kJIehtsLhkdacAc,28
7
- elemento_loyalty_processing-1.0.10.dist-info/RECORD,,