elemento-loyalty-processing 1.0.10__tar.gz → 1.0.12__tar.gz
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.
- {elemento_loyalty_processing-1.0.10 → elemento_loyalty_processing-1.0.12}/PKG-INFO +1 -1
- {elemento_loyalty_processing-1.0.10 → elemento_loyalty_processing-1.0.12}/app/__init__.py +1 -1
- {elemento_loyalty_processing-1.0.10 → elemento_loyalty_processing-1.0.12}/app/client.py +80 -1
- {elemento_loyalty_processing-1.0.10 → elemento_loyalty_processing-1.0.12}/app/types.py +11 -1
- {elemento_loyalty_processing-1.0.10 → elemento_loyalty_processing-1.0.12}/pyproject.toml +1 -1
- {elemento_loyalty_processing-1.0.10 → elemento_loyalty_processing-1.0.12}/MANIFEST.in +0 -0
- {elemento_loyalty_processing-1.0.10 → elemento_loyalty_processing-1.0.12}/README.md +0 -0
- {elemento_loyalty_processing-1.0.10 → elemento_loyalty_processing-1.0.12}/elemento_loyalty_processing.egg-info/SOURCES.txt +0 -0
- {elemento_loyalty_processing-1.0.10 → elemento_loyalty_processing-1.0.12}/setup.cfg +0 -0
|
@@ -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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|