fix key please

This commit is contained in:
C committed 2026-01-05 15:37:50 -08:00
1 parent 2f7769e2c3
commit 199995b947
2 files changed
+37 -7

No files matched your search

+30 -2
View File
@@ -106,10 +106,29 @@ async def enrich_single_item(item_id: str, item_data: dict = None, logger=None)
# Check if manual price review needed
if lego_set.get("requires_manual_price"):
# Get current Square price to check if it's already over $100
current_price_cents = None
variations = item.get("variations", [])
if variations:
price_money = (
variations[0].get("item_variation_data", {}).get("price_money", {})
)
current_price_cents = price_money.get("amount", 0)
current_price_dollars = (
current_price_cents / 100 if current_price_cents else 0
)
# Only add to review if current price is NOT already over $100
if current_price_dollars <= 100:
if logger:
logger.info(f"Item {item_id} requires manual price review (≥$110)")
logger.info(
f"Item {item_id} requires manual price review (≥$110, current: ${current_price_dollars:.2f})"
)
else:
print(f"[@DEBUG] Item {item_id} requires manual price review")
print(
f"[@DEBUG] Item {item_id} requires manual price review (current: ${current_price_dollars:.2f})"
)
await db.upsert(
"REVIEW",
@@ -120,6 +139,15 @@ async def enrich_single_item(item_id: str, item_data: dict = None, logger=None)
},
"sq_object",
)
else:
if logger:
logger.info(
f"Item {item_id} price already over $100 (${current_price_dollars:.2f}), skipping manual review"
)
else:
print(
f"[@DEBUG] Item {item_id} price already over $100 (${current_price_dollars:.2f}), skipping manual review"
)
# Update Square item with enriched data
success = await asquare.update_itm(item_id, lego_set, item_data=item)
+7 -5
View File
@@ -16,15 +16,17 @@ SQUARE_WEBHOOK_URL = sq_env.SQUARE_WEBHOOK_URL
SQUARE_LEGO_CAT_ID = sq_env.LEGO_CAT_ID
# Debug: Print configuration (redact key)
if SQUARE_WEBHOOK_SIGNATURE_KEY:
# Debug: Print configuration only in development or once per process
# When running under gunicorn, the on_starting hook handles this
if not os.getenv("GUNICORN_CMD_ARGS"):
if SQUARE_WEBHOOK_SIGNATURE_KEY:
print(f"[CONFIG] Signature key loaded: {SQUARE_WEBHOOK_SIGNATURE_KEY[:10]}...")
else:
else:
print("[CONFIG] WARNING: SQUARE_WEBHOOK_SIGNATURE_KEY not set!")
if SQUARE_WEBHOOK_URL:
if SQUARE_WEBHOOK_URL:
print(f"[CONFIG] Webhook URL: {SQUARE_WEBHOOK_URL}")
else:
else:
print("[CONFIG] WARNING: SQUARE_WEBHOOK_URL not set!")
# In-memory store for processed event IDs (idempotency)