23 lines
864 B
Python
23 lines
864 B
Python
|
|
import logging
|
||
|
|
from typing import Dict
|
||
|
|
|
||
|
|
logger = logging.getLogger(__name__)
|
||
|
|
|
||
|
|
|
||
|
|
def handle_stage_change(opportunity: Dict, stage: Dict) -> None:
|
||
|
|
"""Handle side-effects for stage changes (Hub-local)."""
|
||
|
|
if stage.get("is_won"):
|
||
|
|
logger.info("✅ Opportunity won (id=%s, customer_id=%s)", opportunity.get("id"), opportunity.get("customer_id"))
|
||
|
|
_create_local_order_placeholder(opportunity)
|
||
|
|
elif stage.get("is_lost"):
|
||
|
|
logger.info("⚠️ Opportunity lost (id=%s, customer_id=%s)", opportunity.get("id"), opportunity.get("customer_id"))
|
||
|
|
|
||
|
|
|
||
|
|
def _create_local_order_placeholder(opportunity: Dict) -> None:
|
||
|
|
"""Placeholder for local order creation (next version)."""
|
||
|
|
logger.info(
|
||
|
|
"🧩 Local order hook pending for opportunity %s (customer_id=%s)",
|
||
|
|
opportunity.get("id"),
|
||
|
|
opportunity.get("customer_id")
|
||
|
|
)
|