WE ARE SO CLOSE
This commit is contained in:
1 parent
3e21b904a2
commit
cff03d5eee
2 files changed
+9
-4
No files matched your search
+8
-3
@@ -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
|
||||
item = await get_item_by_id(item_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:
|
||||
|
||||
Reference in new issue
Block a user