Added RubbbbiconMD SKU and updated SIGGNIGFY. Fixed some SKU mismatch bugs
This commit is contained in:
@@ -273,27 +273,21 @@ def send_order_to_shipstation_api(order: Order) -> dict:
|
||||
VALID_CHARGE_EVENTS = {"on_creation", "on_carrier_acceptance", "carrier_default"}
|
||||
|
||||
|
||||
def _return_config_prefix(order: Order) -> str:
|
||||
"""
|
||||
Normally keyed off company, but RMD-prefixed SKUs (RubiconMD, an Oak
|
||||
Street subsidiary) use their own UPS account and return address even
|
||||
though the ticket is still classified as Oak Street Health for every
|
||||
other purpose - so this checks the ticket's actual SKUs, not just
|
||||
order.company. (The IE prefix seen in Signify's catalog is deprecated
|
||||
and deliberately not handled here - not expected on current tickets.)
|
||||
"""
|
||||
if any((sku or "").strip().upper().startswith("RMD") for sku in (order.skus or [])):
|
||||
return "RUBICONMD_RETURN_"
|
||||
if order.company == "Signify Health":
|
||||
return "SIGNIFY_RETURN_"
|
||||
return "OAKSTREET_RETURN_"
|
||||
def _is_rubiconmd_order(order: Order) -> bool:
|
||||
return any((sku or "").strip().upper().startswith("RMD") for sku in (order.skus or []))
|
||||
|
||||
|
||||
def _return_address_for_order(order: Order) -> dict:
|
||||
"""RubiconMD (RMD-prefixed SKUs) uses Oak Street's own address in every
|
||||
respect except the name on the label - not a separate warehouse, just
|
||||
a different name for the same shipping account/address."""
|
||||
settings = config.load_settings()
|
||||
prefix = _return_config_prefix(order)
|
||||
prefix = "SIGNIFY_RETURN_" if order.company == "Signify Health" else "OAKSTREET_RETURN_"
|
||||
name = settings.get(f"{prefix}NAME", "")
|
||||
if _is_rubiconmd_order(order):
|
||||
name = settings.get("RUBICONMD_RETURN_NAME", "") or name
|
||||
return {
|
||||
"name": settings.get(f"{prefix}NAME", ""),
|
||||
"name": name,
|
||||
"phone": settings.get(f"{prefix}PHONE", ""),
|
||||
"address_line1": settings.get(f"{prefix}ADDRESS1", ""),
|
||||
"address_line2": settings.get(f"{prefix}ADDRESS2", "") or None,
|
||||
@@ -305,11 +299,13 @@ def _return_address_for_order(order: Order) -> dict:
|
||||
|
||||
|
||||
def _return_carrier_for_order(order: Order) -> tuple[str, str]:
|
||||
"""Each shipping account (Signify, Oak Street, and RubiconMD as its own
|
||||
subsidiary account) has its own UPS carrier_id, even where the physical
|
||||
warehouse is shared."""
|
||||
"""RubiconMD uses Oak Street's own UPS account - no separate carrier,
|
||||
just a different name on the return address (see
|
||||
_return_address_for_order). Each of the two REAL shipping accounts
|
||||
(Signify, Oak Street) has its own carrier_id even though they share a
|
||||
physical warehouse."""
|
||||
settings = config.load_settings()
|
||||
prefix = _return_config_prefix(order)
|
||||
prefix = "SIGNIFY_RETURN_" if order.company == "Signify Health" else "OAKSTREET_RETURN_"
|
||||
return settings.get(f"{prefix}CARRIER_ID", ""), settings.get(f"{prefix}SERVICE_CODE", "")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user