elemento-loyalty-processing 1.0.2__tar.gz → 1.0.4__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.2 → elemento_loyalty_processing-1.0.4}/PKG-INFO +1 -1
- {elemento_loyalty_processing-1.0.2 → elemento_loyalty_processing-1.0.4}/app/__init__.py +1 -1
- {elemento_loyalty_processing-1.0.2 → elemento_loyalty_processing-1.0.4}/app/client.py +11 -9
- {elemento_loyalty_processing-1.0.2 → elemento_loyalty_processing-1.0.4}/app/types.py +23 -12
- {elemento_loyalty_processing-1.0.2 → elemento_loyalty_processing-1.0.4}/pyproject.toml +1 -1
- {elemento_loyalty_processing-1.0.2 → elemento_loyalty_processing-1.0.4}/MANIFEST.in +0 -0
- {elemento_loyalty_processing-1.0.2 → elemento_loyalty_processing-1.0.4}/README.md +0 -0
- {elemento_loyalty_processing-1.0.2 → elemento_loyalty_processing-1.0.4}/elemento_loyalty_processing.egg-info/SOURCES.txt +0 -0
- {elemento_loyalty_processing-1.0.2 → elemento_loyalty_processing-1.0.4}/setup.cfg +0 -0
|
@@ -44,14 +44,15 @@ class ElementoLoyaltyProcessingClient(RPCClientService):
|
|
|
44
44
|
|
|
45
45
|
async def balance_calculate(
|
|
46
46
|
self,
|
|
47
|
-
customer: dict[str, Any],
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
transaction_id: TransactionId
|
|
47
|
+
customer: Customer.Fields | dict[str, Any],
|
|
48
|
+
store_id: StoreId,
|
|
49
|
+
payment_type: str,
|
|
50
|
+
items: list[Item] | list[dict[str, Any]],
|
|
51
|
+
transaction_id: TransactionId,
|
|
52
|
+
action: str = BalanceAction.CALC.value,
|
|
53
|
+
points_sub: Points = 0,
|
|
52
54
|
order_id: str = None,
|
|
53
|
-
timestamp: datetime
|
|
54
|
-
actions: list[BalanceAction | str] = None,
|
|
55
|
+
timestamp: datetime = None,
|
|
55
56
|
meta: dict[str, Any] = None,
|
|
56
57
|
_max_timeout: int = None,
|
|
57
58
|
_nowait: bool = False,
|
|
@@ -61,13 +62,14 @@ class ElementoLoyaltyProcessingClient(RPCClientService):
|
|
|
61
62
|
method="Balance.calculate_cart",
|
|
62
63
|
params=dict(
|
|
63
64
|
customer=customer,
|
|
65
|
+
store_id=store_id,
|
|
64
66
|
items=items,
|
|
65
|
-
|
|
67
|
+
payment_type=payment_type,
|
|
66
68
|
points_sub=points_sub,
|
|
67
69
|
transaction_id=transaction_id,
|
|
68
70
|
order_id=order_id,
|
|
69
71
|
timestamp=timestamp,
|
|
70
|
-
|
|
72
|
+
action=action,
|
|
71
73
|
meta=meta,
|
|
72
74
|
),
|
|
73
75
|
max_timeout=_max_timeout,
|
|
@@ -3,6 +3,7 @@ from decimal import Decimal
|
|
|
3
3
|
from enum import Enum
|
|
4
4
|
from typing import Any, NewType, TypedDict
|
|
5
5
|
|
|
6
|
+
from elemento_customers.types import Customer, CustomerId
|
|
6
7
|
from msgspec import Struct
|
|
7
8
|
|
|
8
9
|
|
|
@@ -33,14 +34,16 @@ __all__ = [
|
|
|
33
34
|
"LifetimeId",
|
|
34
35
|
"ActionId",
|
|
35
36
|
"Points",
|
|
37
|
+
"StoreId",
|
|
38
|
+
"AppliedOffer",
|
|
36
39
|
]
|
|
37
40
|
|
|
38
41
|
DATE_MAXVALUE = date.fromisoformat("3000-01-01")
|
|
39
42
|
|
|
40
43
|
TransactionId = NewType("TransactionId", str)
|
|
41
44
|
EventTypeId = NewType("EventTypeId", str)
|
|
42
|
-
ListId = NewType("ListId",
|
|
43
|
-
|
|
45
|
+
ListId = NewType("ListId", int)
|
|
46
|
+
StoreId = NewType("StoreId", int)
|
|
44
47
|
OfferId = NewType("OfferId", int)
|
|
45
48
|
LifetimeId = NewType("LifetimeId", int)
|
|
46
49
|
GroupId = NewType("GroupId", int)
|
|
@@ -58,11 +61,6 @@ class OfferEventTypes(Enum):
|
|
|
58
61
|
RegistrationDone = "RegistrationDone"
|
|
59
62
|
|
|
60
63
|
|
|
61
|
-
class Customer(TypedDict):
|
|
62
|
-
id: CustomerId
|
|
63
|
-
profile: dict[str, Any]
|
|
64
|
-
|
|
65
|
-
|
|
66
64
|
class ItemListType(Enum):
|
|
67
65
|
STORE = "STORE"
|
|
68
66
|
PRODUCT = "PRODUCT"
|
|
@@ -112,7 +110,6 @@ class StoredTransaction(Struct):
|
|
|
112
110
|
active: bool = True
|
|
113
111
|
meta: dict[str, Any] | None = None
|
|
114
112
|
items: list[OrderItem] | None = None
|
|
115
|
-
id: int = None
|
|
116
113
|
|
|
117
114
|
|
|
118
115
|
class BalanceAction(Enum):
|
|
@@ -121,6 +118,16 @@ class BalanceAction(Enum):
|
|
|
121
118
|
ADD = "ADD"
|
|
122
119
|
|
|
123
120
|
|
|
121
|
+
class AppliedOffer(Struct):
|
|
122
|
+
offer_id: int | None
|
|
123
|
+
offer_name: str
|
|
124
|
+
points_sub: Points
|
|
125
|
+
points_sub_max: Points
|
|
126
|
+
points_add: Points
|
|
127
|
+
active_from: date
|
|
128
|
+
active_to: date
|
|
129
|
+
|
|
130
|
+
|
|
124
131
|
class Item(Struct):
|
|
125
132
|
pos: int
|
|
126
133
|
product_id: str
|
|
@@ -132,14 +139,18 @@ class Item(Struct):
|
|
|
132
139
|
points_add: Points = 0
|
|
133
140
|
points_sub: Points = 0
|
|
134
141
|
points_sub_max: Points = 0
|
|
135
|
-
params: dict[str, Any]
|
|
142
|
+
params: dict[str, Any] = {}
|
|
143
|
+
offers: list[AppliedOffer] = []
|
|
136
144
|
|
|
137
145
|
|
|
138
146
|
class Cart(Struct):
|
|
139
|
-
points_add: Points
|
|
140
|
-
points_sub: Points
|
|
141
|
-
points_sub_max: Points
|
|
142
147
|
items: list[Item]
|
|
148
|
+
total: Decimal = Decimal(0)
|
|
149
|
+
discount: Decimal = Decimal(0)
|
|
150
|
+
points_add: Points = Points(0)
|
|
151
|
+
points_sub: Points = Points(0)
|
|
152
|
+
points_sub_max: Points = Points(0)
|
|
153
|
+
points_available: Points = Points(0)
|
|
143
154
|
cashier_message: str | None = None
|
|
144
155
|
customer_message: str | None = None
|
|
145
156
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|