fix key please
This commit is contained in:
1 parent
2f7769e2c3
commit
199995b947
2 files changed
+33
-3
No files matched your search
+30
-2
@@ -106,10 +106,29 @@ async def enrich_single_item(item_id: str, item_data: dict = None, logger=None)
|
|||||||
|
|
||||||
# Check if manual price review needed
|
# Check if manual price review needed
|
||||||
if lego_set.get("requires_manual_price"):
|
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:
|
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:
|
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(
|
await db.upsert(
|
||||||
"REVIEW",
|
"REVIEW",
|
||||||
@@ -120,6 +139,15 @@ async def enrich_single_item(item_id: str, item_data: dict = None, logger=None)
|
|||||||
},
|
},
|
||||||
"sq_object",
|
"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
|
# Update Square item with enriched data
|
||||||
success = await asquare.update_itm(item_id, lego_set, item_data=item)
|
success = await asquare.update_itm(item_id, lego_set, item_data=item)
|
||||||
|
|||||||
+3
-1
@@ -16,7 +16,9 @@ SQUARE_WEBHOOK_URL = sq_env.SQUARE_WEBHOOK_URL
|
|||||||
SQUARE_LEGO_CAT_ID = sq_env.LEGO_CAT_ID
|
SQUARE_LEGO_CAT_ID = sq_env.LEGO_CAT_ID
|
||||||
|
|
||||||
|
|
||||||
# Debug: Print configuration (redact 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:
|
if SQUARE_WEBHOOK_SIGNATURE_KEY:
|
||||||
print(f"[CONFIG] Signature key loaded: {SQUARE_WEBHOOK_SIGNATURE_KEY[:10]}...")
|
print(f"[CONFIG] Signature key loaded: {SQUARE_WEBHOOK_SIGNATURE_KEY[:10]}...")
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in new issue
Block a user