WE ARE SO CLOSE

This commit is contained in:
C committed 2026-01-04 12:17:19 -08:00
1 parent 3e21b904a2
commit cff03d5eee
2 files changed
+8 -3

No files matched your search

+7 -2
View File
@@ -202,7 +202,7 @@ async def get_item_by_variation_id(variation_id: str) -> dict:
raise
async def update_itm(item_id: str, lego_set: dict):
async def update_itm(item_id: str, lego_set: dict, item_data: dict = None):
"""
Asynchronously updates an item in the Square catalog based on the provided LEGO set information.
Args:
@@ -215,6 +215,7 @@ async def update_itm(item_id: str, lego_set: dict):
- "set_image": Thumbnail URL
- "pw_name": Formatted name for Square inventory (e.g., "75192 - STAR WARS UCS Millennium Falcon")
- "set_adjustredprice": Retail price with 10% markup applied
item_data (dict): Optional pre-fetched item data to avoid redundant API call
Returns:
bool: True if the update operation was successful.
Raises:
@@ -233,8 +234,12 @@ async def update_itm(item_id: str, lego_set: dict):
# Convert price to cents for Square API
price_in_cents = int(set_adjustedprice * 100)
# Get current item to retrieve variation ID
# Get current item to retrieve variation ID (only if not provided)
if item_data is None:
item = await get_item_by_id(item_id)
else:
item = item_data
variations = item.get("variations", [])
if not variations:
+1 -1
View File
@@ -111,7 +111,7 @@ async def enrich_single_item(item_id: str, item_data: dict = None, logger=None)
)
# Update Square item with enriched data
success = await asquare.update_itm(item_id, lego_set)
success = await asquare.update_itm(item_id, lego_set, item_data=item)
if success:
if logger: