P5-6491 use market instead of territory for price calculations (#37)

This commit is contained in:
Martin Carlsson
2021-01-25 09:24:26 +01:00
committed by GitHub
parent dee7344ba5
commit 464e2f1fa6
11 changed files with 127 additions and 256 deletions
+29 -38
View File
@@ -3,47 +3,38 @@
import unittest2
import mock
from api.lib.prices import *
from tests.factories import DesignerFactory, ContractCustomerFactory, InquiryFactory
from api.models import market
from api.models import Inquiry
from api.models import Product
from api.models.product import Material
from tests.factories import (
DesignerFactory,
ContractCustomerFactory,
InquiryFactory,
MarketFactory,
)
from api.models import Inquiry, Product, Material
sweden = MarketFactory.build(name="SE", exchange_rate=1, price_adjustments=1, vat=1.25)
denmark = MarketFactory.build(
name="DK", price_adjustments=1.185, exchange_rate=0.799000, vat=1.25
)
us = MarketFactory.build(name="US", price_adjustments=1.06, exchange_rate=0.1198, vat=1)
nl = MarketFactory.build(name="NL", price_adjustments=1.15, exchange_rate=0.1, vat=1.21)
eu = MarketFactory.build(name="EU", price_adjustments=1.13, exchange_rate=0.1, vat=1.25)
designer = DesignerFactory.build(
pricepremium_wallpaper=17.647,
pricepremium_canvas=8,
pricepremium_poster=15.50,
pricepremium_framed_print=13,
)
sweden = market.from_territory("SE")
sweden.price_adjustments = 1
sweden.exchange_rate = 1
reseller = ContractCustomerFactory.build(pricepremium=15)
denmark = market.from_territory("DK")
denmark.price_adjustments = 1.185
denmark.exchange_rate = 0.799000
us = market.from_territory("US")
us.price_adjustments = 1.06
us.exchange_rate = 0.119800
nl = market.from_territory("NL")
nl.price_adjustments = 1.15
nl.exchange_rate = 0.100000
eu = market.from_territory("EU")
eu.price_adjustments = 1.13
eu.exchange_rate = 0.100000
designer = DesignerFactory()
designer.pricepremium_wallpaper = 17.647
designer.pricepremium_canvas = 8
designer.pricepremium_poster = 15.50
designer.pricepremium_framed_print = 13
reseller = ContractCustomerFactory(pricepremium=15)
designer_moomin = DesignerFactory()
designer_moomin.pricepremium_wallpaper = 2
designer_moomin.pricepremium_canvas = 3
designer_moomin.pricepremium_poster = 4
designer_moomin.pricepremium_framed_print = 7
designer_moomin = DesignerFactory.build(
pricepremium_wallpaper=2,
pricepremium_canvas=3,
pricepremium_poster=4,
pricepremium_framed_print=7,
)
standard_wallpaper = Material(name="standard-wallpaper", price=23600)
premium_wallpaper = Material(name="premium-wallpaper", price=26000)