29 lines
1.0 KiB
Python
29 lines
1.0 KiB
Python
"""
|
|
The emailed-return-label SKUs (SH007 for Signify, OK012 for Oak Street)
|
|
mark a ticket as a different kind of request entirely: not an outbound
|
|
kit, but a return label to be created and emailed to a client who
|
|
already has product to send back. See app/services/shipstation_send.py
|
|
for the label-creation side of this.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
from typing import Optional
|
|
|
|
from app import config
|
|
from app.status_rules import parse_status_list
|
|
|
|
|
|
def get_emailed_label_skus() -> set[str]:
|
|
return parse_status_list(
|
|
config.get("EMAILED_LABEL_SKUS", config.DEFAULT_EMAILED_LABEL_SKUS)
|
|
)
|
|
|
|
|
|
def is_emailed_label_order(skus: list[str], emailed_skus: Optional[set] = None) -> bool:
|
|
"""emailed_skus can be pre-fetched and passed in when checking many
|
|
orders at once (e.g. refreshing the table), to avoid re-reading
|
|
Settings from disk for every single order."""
|
|
if emailed_skus is None:
|
|
emailed_skus = get_emailed_label_skus()
|
|
return any((sku or "").strip().lower() in emailed_skus for sku in skus or [])
|