Include segment in price requests (#70)

This commit is contained in:
Fredrik Ringqvist
2023-05-12 09:22:33 +02:00
committed by GitHub
parent 4556155a84
commit ad36f31122
3 changed files with 40 additions and 9 deletions
+17 -2
View File
@@ -16,10 +16,14 @@ def wallpaper_m2_price_new(
if own_image:
price_m2_incl_vat = get_own_image_wallpaper_m2_price(material_id, market.id)
segment = "OWN-IMAGE"
else:
price_m2_incl_vat = get_wallpaper_m2_price(product_id, material_id, market.id)
prices = get_wallpaper_m2_price(product_id, material_id, market.id)
price_m2_incl_vat = prices["price"]
segment = prices["segment"]
price_m2_excl_vat = price_m2_incl_vat / market.vat
segment_price = price_m2_incl_vat
if inquiry:
inquiry_premium = (float(inquiry.pricepremium) / 100) + 1
@@ -29,6 +33,8 @@ def wallpaper_m2_price_new(
return {
"incl_vat": price_m2_incl_vat,
"excl_vat": price_m2_excl_vat,
"segment": segment,
"segment_price": segment_price,
}
@@ -93,6 +99,8 @@ def wallpaper_price_new(
"excl_vat": price_excl_vat,
"m2_price_incl_vat": m2_prices["incl_vat"],
"m2_price_excl_vat": m2_prices["excl_vat"],
"segment": m2_prices["segment"],
"segment_price": m2_prices["incl_vat"],
}
@@ -149,17 +157,22 @@ def external_product_own_image_price(external_product_id, market):
return {
'incl_vat': price_incl_vat,
'excl_vat': price_excl_vat,
'segment': 'OWN-IMAGE',
'segment_price': price_incl_vat,
}
def external_product_price_new(product_id, external_product_id, market):
price_incl_vat = get_external_product_price(product_id, external_product_id, market.id)
prices = get_external_product_price(product_id, external_product_id, market.id)
price_incl_vat = prices['price']
price_excl_vat = price_incl_vat / market.vat
return {
'incl_vat': price_incl_vat,
'excl_vat': price_excl_vat,
'segment': prices['segment'],
'segment_price': price_incl_vat,
}
@@ -234,6 +247,8 @@ def inquiry_price_new(
"excl_retouch_excl_vat": price_excl_retouch_excl_vat,
"m2_price_incl_vat": prices["m2_price_incl_vat"],
"m2_price_excl_vat": prices["m2_price_excl_vat"],
"segment": prices["segment"],
"segment_price": prices["segment_price"],
}