printer-core 0.0.1__tar.gz → 0.0.3__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.
- {printer_core-0.0.1 → printer_core-0.0.3}/PKG-INFO +1 -1
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/services/flows/client.py +6 -2
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/services/order_print_service.py +2 -18
- printer_core-0.0.3/printer_core/tests/unitaries/__init__.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/tests/unitaries/test_flows.py +29 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/tests/unitaries/test_order_print_service.py +0 -20
- {printer_core-0.0.1 → printer_core-0.0.3}/pyproject.toml +2 -2
- /printer_core-0.0.1/printer_core/tests/__init__.py → /printer_core-0.0.3/.codex +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/.gitignore +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/README.md +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/__init__.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/algorithms/__init__.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/algorithms/products_modifiers_multiprinter.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/algorithms/products_modifiers_multiprinter_family.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/algorithms/products_modifiers_unique_ticket.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/builders/__init__.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/builders/client_ticket_builder.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/builders/header_builder.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/builders/kitchen_ticket_payload_builder.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/builders/printer_products_grouper.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/clock.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/context/__init__.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/context/ticket_context_builder.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/dispatchers/__init__.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/dispatchers/kitchen_ticket_dispatcher.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/dispatchers/payload_dispatcher.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/entities/__init__.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/entities/print_context.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/entities/print_models.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/formatters/__init__.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/formatters/discount_formatter.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/ports.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/selectors/__init__.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/selectors/family_product_selector.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/services/__init__.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/services/flows/__init__.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/services/flows/base.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/services/flows/kitchen.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/services/march_printer_service.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/services/multi_printer_family_service.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/services/multi_printer_service.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/services/print_policy.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/services/unique_ticket_service.py +0 -0
- {printer_core-0.0.1/printer_core/tests/unitaries → printer_core-0.0.3/printer_core/tests}/__init__.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/tests/unitaries/helpers.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/tests/unitaries/test_cases_output.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/tests/unitaries/test_client_ticket_builder.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/tests/unitaries/test_discount_formatter.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/tests/unitaries/test_family_product_selector.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/tests/unitaries/test_header_builder_foodeo_printers.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/tests/unitaries/test_kitchen_ticket_dispatcher.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/tests/unitaries/test_kitchen_ticket_payload_builder.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/tests/unitaries/test_march_printer_service.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/tests/unitaries/test_multi_printer_family_service.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/tests/unitaries/test_multi_printer_service.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/tests/unitaries/test_payload_dispatcher.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/tests/unitaries/test_print_policy.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/tests/unitaries/test_printer_helpers.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/tests/unitaries/test_printer_products_grouper.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/tests/unitaries/test_products_modifiers.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/tests/unitaries/test_ticket_context_builder.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/tests/unitaries/test_unique_ticket_service.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/utils/__init__.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/printer_core/utils/printer_helpers.py +0 -0
- {printer_core-0.0.1 → printer_core-0.0.3}/scripts/link_backend_env.sh +0 -0
|
@@ -52,7 +52,6 @@ class ClientPrintFlow:
|
|
|
52
52
|
worker=context.worker,
|
|
53
53
|
)
|
|
54
54
|
client_request = self._apply_client_request_overrides(client_request, channel)
|
|
55
|
-
client_request = client_request.model_copy(update={"is_invoice": False})
|
|
56
55
|
data = self._build_client_ticket(
|
|
57
56
|
client_request,
|
|
58
57
|
products,
|
|
@@ -60,7 +59,7 @@ class ClientPrintFlow:
|
|
|
60
59
|
context.main_printer,
|
|
61
60
|
tpv_key,
|
|
62
61
|
)
|
|
63
|
-
payload = [
|
|
62
|
+
payload = [self._serialize_client_payload(item) for item in data]
|
|
64
63
|
self._gateway.send_data(tpv_key, payload)
|
|
65
64
|
return data
|
|
66
65
|
|
|
@@ -95,3 +94,8 @@ class ClientPrintFlow:
|
|
|
95
94
|
if not print_settings:
|
|
96
95
|
return request
|
|
97
96
|
return request.model_copy(update={"PrintSettings": print_settings.model_copy(update={"show_header": False})})
|
|
97
|
+
|
|
98
|
+
def _serialize_client_payload(self, payload: ClientTicketPayload) -> dict[str, Any]:
|
|
99
|
+
serialized = payload.model_dump(mode="json", exclude_none=True)
|
|
100
|
+
serialized.setdefault("data", {})["is_invoice"] = payload.data.is_invoice
|
|
101
|
+
return serialized
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
from decimal import Decimal
|
|
4
|
-
from typing import Any
|
|
4
|
+
from typing import Any
|
|
5
5
|
|
|
6
6
|
from printer_core.clock import SystemClock
|
|
7
7
|
from printer_core.entities import (
|
|
@@ -13,26 +13,10 @@ from printer_core.entities import (
|
|
|
13
13
|
from printer_core.services.flows import PrintFlow
|
|
14
14
|
from printer_core.services.print_policy import FlowTarget, PrintPolicy
|
|
15
15
|
from printer_core.utils.printer_helpers import build_iva_data
|
|
16
|
-
from printer_core.ports import FamilyCategoryProvider, HeaderProvider, PrinterGateway, PrintSettingsBuilder
|
|
17
16
|
|
|
18
17
|
|
|
19
18
|
class OrderPrintService:
|
|
20
|
-
def __init__(
|
|
21
|
-
self,
|
|
22
|
-
gateway: PrinterGateway,
|
|
23
|
-
header_provider: HeaderProvider,
|
|
24
|
-
print_settings_builder: PrintSettingsBuilder,
|
|
25
|
-
family_provider: FamilyCategoryProvider,
|
|
26
|
-
currency_symbol_resolver: Callable[[str], str],
|
|
27
|
-
flows: list[PrintFlow],
|
|
28
|
-
domicile_service_label: str = "Domicile Service",
|
|
29
|
-
):
|
|
30
|
-
self._gateway = gateway
|
|
31
|
-
self._family_provider = family_provider
|
|
32
|
-
self._currency_symbol_resolver = currency_symbol_resolver
|
|
33
|
-
self._header_provider = header_provider
|
|
34
|
-
self._print_settings_builder = print_settings_builder
|
|
35
|
-
self._domicile_service_label = domicile_service_label
|
|
19
|
+
def __init__(self, flows: list[PrintFlow]):
|
|
36
20
|
self._clock = SystemClock()
|
|
37
21
|
self._flows = flows
|
|
38
22
|
|
|
File without changes
|
|
@@ -65,6 +65,35 @@ class ClientPrintFlowTest(unittest.TestCase):
|
|
|
65
65
|
self.assertEqual(payload["company_key"], "TPV1")
|
|
66
66
|
self.assertEqual(payload["data"]["PrintSettings"]["show_header"], False)
|
|
67
67
|
self.assertEqual(payload["data"]["headerData"]["client_name"], "local:web")
|
|
68
|
+
self.assertIn("is_invoice", payload["data"])
|
|
69
|
+
self.assertIsNone(payload["data"]["is_invoice"])
|
|
70
|
+
|
|
71
|
+
def test_execute_preserves_is_invoice_value_from_request(self):
|
|
72
|
+
gateway = FakeGateway()
|
|
73
|
+
flow = ClientPrintFlow(
|
|
74
|
+
gateway=gateway,
|
|
75
|
+
header_provider=FakeHeaderProvider(),
|
|
76
|
+
print_settings_builder=FakePrintSettingsBuilder(),
|
|
77
|
+
currency_symbol_resolver=lambda _: "",
|
|
78
|
+
domicile_service_label="Service",
|
|
79
|
+
)
|
|
80
|
+
context = type("Ctx", (), {
|
|
81
|
+
"kitchen_settings": make_kitchen_settings(),
|
|
82
|
+
"ticket_settings": make_ticket_settings(),
|
|
83
|
+
"main_printer": make_printer(),
|
|
84
|
+
"worker": None,
|
|
85
|
+
})()
|
|
86
|
+
|
|
87
|
+
flow.execute(
|
|
88
|
+
base_request=make_request(request_type="local", from_client="web", is_invoice=True),
|
|
89
|
+
products=[make_product()],
|
|
90
|
+
context=context,
|
|
91
|
+
channel=PrintChannel.LOCAL,
|
|
92
|
+
tpv_key="TPV1",
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
payload = gateway.calls[0][1][0]
|
|
96
|
+
self.assertTrue(payload["data"]["is_invoice"])
|
|
68
97
|
|
|
69
98
|
|
|
70
99
|
class KitchenPrintFlowTest(unittest.TestCase):
|
{printer_core-0.0.1 → printer_core-0.0.3}/printer_core/tests/unitaries/test_order_print_service.py
RENAMED
|
@@ -36,11 +36,6 @@ class OrderPrintServiceTest(unittest.TestCase):
|
|
|
36
36
|
kitchen_flow = FakeFlow(FlowTarget.KITCHEN, return_value=[{"kitchen": True}])
|
|
37
37
|
client_flow = FakeFlow(FlowTarget.CLIENT, return_value=[{"client": True}])
|
|
38
38
|
service = OrderPrintService(
|
|
39
|
-
gateway=object(),
|
|
40
|
-
header_provider=object(),
|
|
41
|
-
print_settings_builder=object(),
|
|
42
|
-
family_provider=object(),
|
|
43
|
-
currency_symbol_resolver=lambda _: "",
|
|
44
39
|
flows=[kitchen_flow, client_flow],
|
|
45
40
|
)
|
|
46
41
|
request = make_request(
|
|
@@ -69,11 +64,6 @@ class OrderPrintServiceTest(unittest.TestCase):
|
|
|
69
64
|
def test_print_job_domicile_total_includes_service_price(self):
|
|
70
65
|
kitchen_flow = FakeFlow(FlowTarget.KITCHEN, return_value=[])
|
|
71
66
|
service = OrderPrintService(
|
|
72
|
-
gateway=object(),
|
|
73
|
-
header_provider=object(),
|
|
74
|
-
print_settings_builder=object(),
|
|
75
|
-
family_provider=object(),
|
|
76
|
-
currency_symbol_resolver=lambda _: "",
|
|
77
67
|
flows=[kitchen_flow],
|
|
78
68
|
)
|
|
79
69
|
service._clock = FakeClock("2024-05-01 08:00")
|
|
@@ -98,11 +88,6 @@ class OrderPrintServiceTest(unittest.TestCase):
|
|
|
98
88
|
def test_print_job_overrides_created_at_for_barra(self):
|
|
99
89
|
kitchen_flow = FakeFlow(FlowTarget.KITCHEN, return_value=[])
|
|
100
90
|
service = OrderPrintService(
|
|
101
|
-
gateway=object(),
|
|
102
|
-
header_provider=object(),
|
|
103
|
-
print_settings_builder=object(),
|
|
104
|
-
family_provider=object(),
|
|
105
|
-
currency_symbol_resolver=lambda _: "",
|
|
106
91
|
flows=[kitchen_flow],
|
|
107
92
|
)
|
|
108
93
|
service._clock = FakeClock("2024-05-01 08:00")
|
|
@@ -122,11 +107,6 @@ class OrderPrintServiceTest(unittest.TestCase):
|
|
|
122
107
|
def test_print_job_skips_flows_when_disabled(self):
|
|
123
108
|
kitchen_flow = FakeFlow(FlowTarget.KITCHEN, return_value=[])
|
|
124
109
|
service = OrderPrintService(
|
|
125
|
-
gateway=object(),
|
|
126
|
-
header_provider=object(),
|
|
127
|
-
print_settings_builder=object(),
|
|
128
|
-
family_provider=object(),
|
|
129
|
-
currency_symbol_resolver=lambda _: "",
|
|
130
110
|
flows=[kitchen_flow],
|
|
131
111
|
)
|
|
132
112
|
request = make_request(request_type="local")
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "printer-core"
|
|
7
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.3"
|
|
8
8
|
description = "Foodeo Printer Core Domain."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -41,4 +41,4 @@ Repository = "https://github.com/Foodeo/printer-core"
|
|
|
41
41
|
Issues = "https://github.com/Foodeo/printer-core/issues"
|
|
42
42
|
|
|
43
43
|
[tool.hatch.build.targets.wheel]
|
|
44
|
-
packages = ["printer_core"]
|
|
44
|
+
packages = ["printer_core"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{printer_core-0.0.1 → printer_core-0.0.3}/printer_core/algorithms/products_modifiers_multiprinter.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{printer_core-0.0.1 → printer_core-0.0.3}/printer_core/builders/kitchen_ticket_payload_builder.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{printer_core-0.0.1 → printer_core-0.0.3}/printer_core/dispatchers/kitchen_ticket_dispatcher.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{printer_core-0.0.1 → printer_core-0.0.3}/printer_core/services/multi_printer_family_service.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{printer_core-0.0.1 → printer_core-0.0.3}/printer_core/tests/unitaries/test_client_ticket_builder.py
RENAMED
|
File without changes
|
{printer_core-0.0.1 → printer_core-0.0.3}/printer_core/tests/unitaries/test_discount_formatter.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{printer_core-0.0.1 → printer_core-0.0.3}/printer_core/tests/unitaries/test_march_printer_service.py
RENAMED
|
File without changes
|
|
File without changes
|
{printer_core-0.0.1 → printer_core-0.0.3}/printer_core/tests/unitaries/test_multi_printer_service.py
RENAMED
|
File without changes
|
{printer_core-0.0.1 → printer_core-0.0.3}/printer_core/tests/unitaries/test_payload_dispatcher.py
RENAMED
|
File without changes
|
|
File without changes
|
{printer_core-0.0.1 → printer_core-0.0.3}/printer_core/tests/unitaries/test_printer_helpers.py
RENAMED
|
File without changes
|
|
File without changes
|
{printer_core-0.0.1 → printer_core-0.0.3}/printer_core/tests/unitaries/test_products_modifiers.py
RENAMED
|
File without changes
|
|
File without changes
|
{printer_core-0.0.1 → printer_core-0.0.3}/printer_core/tests/unitaries/test_unique_ticket_service.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|