price
This commit is contained in:
@@ -117,6 +117,7 @@ class PricingService:
|
||||
"""Default pricing algorithm with complex pricing rules"""
|
||||
tcg_low = row.get('tcg_low_price')
|
||||
tcg_low_shipping = row.get('tcg_low_price_with_shipping')
|
||||
tcg_market_price = row.get('tcg_market_price')
|
||||
|
||||
if pd.isna(tcg_low) or pd.isna(tcg_low_shipping):
|
||||
logger.warning(f"Missing pricing data for row: {row}")
|
||||
@@ -124,14 +125,17 @@ class PricingService:
|
||||
return row
|
||||
|
||||
# Apply pricing rules
|
||||
if tcg_low < 0.35:
|
||||
if tcg_low < 0.35 and tcg_market_price < 1:
|
||||
new_price = 0.35
|
||||
elif tcg_low < 5 or tcg_low_shipping < 5:
|
||||
new_price = round(tcg_low * 1.25, 2)
|
||||
elif tcg_low_shipping > 25:
|
||||
new_price = round(tcg_low_shipping * 1.025, 2)
|
||||
new_price = round(tcg_low_shipping * .85, 2)
|
||||
elif tcg_low_shipping > 20:
|
||||
new_price = round(tcg_low_shipping * 1.0125, 2)
|
||||
else:
|
||||
new_price = round(tcg_low_shipping * 1.10, 2)
|
||||
# if new price is less than half of market price, set to 90% market
|
||||
if new_price < (tcg_market_price / 2):
|
||||
new_price = round(tcg_market_price * 0.85, 2)
|
||||
|
||||
row['new_price'] = new_price
|
||||
return row
|
||||
|
Reference in New Issue
Block a user