ShipStation tracking pull, status tracking, dashboard rework
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
"""
|
||||
Turns a ticket's tracking numbers into the JIRA status your team would
|
||||
set it to at end-of-day close-out - "Waiting For Return" if a return
|
||||
label was also generated by ShipStation's automation, "Device Return
|
||||
Not Needed" if it's outgoing-only. Saves having to eyeball each one.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import List, Optional
|
||||
|
||||
from app import config
|
||||
|
||||
|
||||
def suggest_jira_status(tracking_numbers: List[dict]) -> Optional[str]:
|
||||
if not tracking_numbers:
|
||||
return None
|
||||
|
||||
has_outgoing = any(not t.get("is_return") for t in tracking_numbers)
|
||||
has_return = any(t.get("is_return") for t in tracking_numbers)
|
||||
|
||||
if not has_outgoing:
|
||||
# Only a return label with no outgoing - unusual, don't guess.
|
||||
return None
|
||||
|
||||
if has_return:
|
||||
return config.get(
|
||||
"FULFILLED_STATUS_WITH_RETURN", config.DEFAULT_FULFILLED_WITH_RETURN
|
||||
)
|
||||
return config.get(
|
||||
"FULFILLED_STATUS_WITHOUT_RETURN", config.DEFAULT_FULFILLED_WITHOUT_RETURN
|
||||
)
|
||||
Reference in New Issue
Block a user