P5-7013 Move wallpaperkit price to api (#38)
This commit is contained in:
@@ -511,3 +511,25 @@ def inquiry_price(
|
||||
price = round_half_up(price)
|
||||
|
||||
return 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
|
||||
|
||||
price *= market.price_adjustments
|
||||
|
||||
if reseller:
|
||||
price *= (float(reseller.pricepremium) / 100) + 1
|
||||
|
||||
price *= market.exchange_rate
|
||||
|
||||
if inc_vat:
|
||||
price *= market.vat
|
||||
|
||||
if rounded:
|
||||
price = round_half_up(price)
|
||||
|
||||
return price
|
||||
|
||||
@@ -19,6 +19,7 @@ from api.lib.prices import (
|
||||
framed_print_price,
|
||||
wallpaper_m2_price,
|
||||
inquiry_price,
|
||||
wallpaper_kit_price,
|
||||
)
|
||||
from api.lib.limits import calculate_canvas_limits
|
||||
|
||||
@@ -226,6 +227,25 @@ def diy_frame():
|
||||
return jsonify(data=data)
|
||||
|
||||
|
||||
@mod.route("/wallpaper-kit", methods=["GET"])
|
||||
@validate_exists("market")
|
||||
def wallpaper_kit():
|
||||
market_id = request.args.get("market", type=int)
|
||||
market = Market.query.get_or_404(market_id)
|
||||
reseller = get_reseller()
|
||||
|
||||
data = [
|
||||
{
|
||||
"price": wallpaper_kit_price(market, reseller=reseller, rounded=False),
|
||||
"price_excl_vat": wallpaper_kit_price(
|
||||
market, reseller=reseller, rounded=False, inc_vat=False
|
||||
),
|
||||
}
|
||||
]
|
||||
|
||||
return jsonify(data=data)
|
||||
|
||||
|
||||
@mod.route("/poster-hanger", methods=["GET"])
|
||||
@validate_number("width")
|
||||
@validate_exists("market")
|
||||
|
||||
Reference in New Issue
Block a user