fix asquare to match brickset

This commit is contained in:
C committed 2026-01-04 10:41:10 -08:00
1 parent 63a8c29105
commit bb6704f3aa
1 file changed
+12 -8
+12 -8
View File
@@ -55,10 +55,14 @@ async def update_itm(lego_set: dict):
""" """
Asynchronously updates an item in the Square catalog based on the provided LEGO set information. Asynchronously updates an item in the Square catalog based on the provided LEGO set information.
Args: Args:
lego_set (dict): A dictionary containing LEGO set details. Expected keys include: lego_set (dict): A dictionary containing LEGO set details from abricksetapi. Expected keys include:
- "sets": List of set dictionaries, each with "name", "number", "barcode" (with "UPC"), and "image" (with "thumbnailURL"). - "set_num": LEGO set number (e.g., "75192")
- "pw_name": The name associated with the LEGO set in another system. - "set_name": Official LEGO set name
- "set_adjustredprice": The adjusted price for the set. - "set_theme": LEGO theme (e.g., "Star Wars")
- "set_barcode": UPC barcode
- "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
Returns: Returns:
bool: True if the update operation was successful. bool: True if the update operation was successful.
Raises: Raises:
@@ -66,10 +70,10 @@ async def update_itm(lego_set: dict):
Exception: For errors during Square API interaction. Exception: For errors during Square API interaction.
""" """
set_name = lego_set["sets"][0]["name"] set_number = lego_set["set_num"]
set_number = lego_set["sets"][0]["number"] set_name = lego_set["set_name"]
set_upc = lego_set["sets"][0]["barcode"]["UPC"] set_upc = lego_set["set_barcode"]
set_image = lego_set["sets"][0]["image"]["thumbnailURL"] set_image = lego_set["set_image"]
pw_name = lego_set["pw_name"] pw_name = lego_set["pw_name"]
set_adjustedprice = lego_set["set_adjustredprice"] set_adjustedprice = lego_set["set_adjustredprice"]