Skip to content

Commit c9cf4c4

Browse files
authored
Hide EORI from tracking labels (#22)
1 parent d9ea46c commit c9cf4c4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/scaup/crud/pdf.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@ def __call__(self, shipment_id: int, token: str):
9898
detail="Failed to get consignee address from shipping service",
9999
)
100100

101-
to_lines = [v for k, v in consignee_response.json().items() if k.startswith("consignee_") and type(v) is str]
101+
to_lines = [
102+
v
103+
for k, v in consignee_response.json().items()
104+
if k.startswith("consignee_") and type(v) is str and not k.endswith("eori")
105+
]
102106

103107
return to_lines
104108

@@ -324,7 +328,9 @@ def get_shipping_labels(shipment_id: int, token: str):
324328
if response.status_code == 200:
325329
shipment_request = response.json()
326330

327-
from_lines = [line for line in shipment_request["contact"].values() if line is not None]
331+
from_lines = [
332+
line for field, line in shipment_request["contact"].items() if line is not None and field != "eori"
333+
]
328334

329335
to_lines = _get_consignee_address(shipment_request["shipmentId"], token)
330336

0 commit comments

Comments
 (0)