From 1bf37658095182ea2280388ce4179b4f746f0df5 Mon Sep 17 00:00:00 2001 From: Fredrik Ringqvist <35255659+fredrikphotowall@users.noreply.github.com> Date: Wed, 16 Nov 2022 07:42:56 +0100 Subject: [PATCH] 3002 - Local wallpaper kit prices (#63) --- api/lib/prices.py | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/api/lib/prices.py b/api/lib/prices.py index 60bdd9b..5b12371 100644 --- a/api/lib/prices.py +++ b/api/lib/prices.py @@ -165,17 +165,46 @@ def inquiry_price( def wallpaper_kit_price( market, reseller=None, rounded=True, inc_vat=True ): - # Hardcode price as it hasn't been updated for a long time - # price from "product-stockprices" - price = 143.2 + # Prices in local currency + prices = { + 'AT': 15.91, + 'AU': 23.64, + 'BE': 17.25, + 'CA': 24, + 'CH': 19.09, + 'DE': 16.36, + 'DK': 132.67, + 'EE': 16.96, + 'ES': 17.55, + 'FI': 17.34, + 'FR': 16.22, + 'GB': 13.31, + 'GLOBAL': 13.45, + 'IE': 15.52, + 'IT': 17.21, + 'LU': 15.88, + 'NL': 16.53, + 'NO': 154.26, + 'PL': 19.31, + 'SE': 159.2, + 'SG': 19.81, + 'US': 19.81, + } + local_price = prices.get(market.name) + + if (local_price): + # Note that the local wallpaper kit prices do not follow usual behaviour of multiplying by market exchange rate + price = local_price + else: + # Default/fallback price + price = prices.get('SE') + price *= market.exchange_rate price *= market.price_adjustments if reseller: price *= (float(reseller.pricepremium) / 100) + 1 - price *= market.exchange_rate - if inc_vat: price *= market.vat