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