Skip to content

Commit

Permalink
Get product link
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaslinhares committed Jan 17, 2024
1 parent 9ef7f16 commit 9adfeaa
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions marketplace/services/vtex/utils/data_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class VtexProductDTO: # TODO: Implement This VtexProductDTO

class DataProcessor:
@staticmethod
def extract_fields(product_details, availability_details) -> FacebookProductDTO:
def extract_fields(domain, product_details, availability_details) -> FacebookProductDTO:
price = (
availability_details["price"]
if availability_details["price"] is not None
Expand All @@ -48,6 +48,7 @@ def extract_fields(product_details, availability_details) -> FacebookProductDTO:
if product_details.get("Images")
else product_details.get("ImageUrl")
)
product_url = f"https://{domain}/{product_details.get('DetailUrl')}"

Check warning on line 51 in marketplace/services/vtex/utils/data_processor.py

View check run for this annotation

Codecov / codecov/patch

marketplace/services/vtex/utils/data_processor.py#L51

Added line #L51 was not covered by tests
description = (
product_details["ProductDescription"]
if product_details["ProductDescription"] != ""
Expand All @@ -63,7 +64,7 @@ def extract_fields(product_details, availability_details) -> FacebookProductDTO:
else "out of stock",
condition="new",
price=list_price,
link="https://www.google.com.br/", # TODO: Need to set up the product link.
link=product_url,
image_link=image_url,
brand=product_details.get("BrandName", "N/A"),
sale_price=price,
Expand Down Expand Up @@ -121,7 +122,7 @@ def process_single_sku(
continue

product_dto = DataProcessor.extract_fields(
product_details, availability_details
domain, product_details, availability_details
)
params = {"seller_id": seller_id}
if all(rule.apply(product_dto, **params) for rule in rules):
Expand Down

0 comments on commit 9adfeaa

Please sign in to comment.