More Shipstation integrations(warehouses)

This commit is contained in:
2026-08-31 15:00:37 -05:00
parent 4c172c1fd5
commit 9651b82415
12 changed files with 337 additions and 139 deletions
+7 -5
View File
@@ -17,11 +17,13 @@ from app.models import Order
from app.status_rules import status_in
def get_open_ticket_numbers(source: str, terminal_statuses: set[str]) -> List[str]:
def get_open_ticket_numbers(source: str, active_statuses: set[str]) -> List[str]:
"""
Ticket numbers for a source that haven't reached a terminal status
yet - i.e. still worth re-fetching to catch status changes (like a
cancellation) even if the ticket wasn't created today.
Ticket numbers for a source that are still in an active status - i.e.
still worth re-fetching to catch a status change (a cancellation, a
fulfillment, or any other transition) even if the ticket wasn't
created today. Once a ticket leaves the active set, we stop
re-checking it - whatever it became, it's no longer "not done yet".
"""
session = get_session()
try:
@@ -37,5 +39,5 @@ def get_open_ticket_numbers(source: str, terminal_statuses: set[str]) -> List[st
return [
ticket_number
for ticket_number, status in rows
if ticket_number and not status_in(status, terminal_statuses)
if ticket_number and status_in(status, active_statuses)
]