P5-4771 add extra shipping price for framed prints

This commit is contained in:
Martin Carlsson
2020-01-27 11:00:07 +01:00
committed by GitHub
parent 708dc769ba
commit 1d214566ec
3 changed files with 99 additions and 3 deletions
+94
View File
@@ -319,6 +319,100 @@ def framed_print_price(
price = sku_prices[sku]
# add extra shipping price (in SEK)
extra_shipping_price = {
pwinty.GLOBAL_CFP_11x14: { # 28x36
"US": 167,
"NO": 247,
"FI": 85,
"PL": 102,
"ES": 63,
"SE": 32,
},
pwinty.GLOBAL_CFP_12x16: { # 30x40
"US": 167,
"NO": 247,
"FI": 85,
"PL": 102,
"ES": 63,
"SE": 32,
},
pwinty.GLOBAL_CFP_16x20: { # 40x50
"US": 243,
"NO": 247,
"FI": 85,
"PL": 123,
"ES": 63,
"SE": 32,
},
pwinty.GLOBAL_CFP_18x24: { # 45x60
"US": 243,
"NO": 247,
"FI": 85,
"PL": 139,
"ES": 63,
"SE": 32,
},
pwinty.GLOBAL_CFP_20x28: { # 50x70
"US": 472,
"NO": 371,
"FI": 85,
"PL": 150,
"ES": 63,
"SE": 32,
},
pwinty.GLOBAL_CFP_24x32: { # 60x80
"US": 472,
"NO": 371,
"FI": 85,
"PL": 160,
"ES": 63,
"SE": 32,
},
pwinty.GLOBAL_CFP_24x36: { # 60x90
"US": 510,
"NO": 989,
"FI": 85,
"PL": 196,
"ES": 63,
"SE": 32,
},
pwinty.GLOBAL_CFP_28x40: { # 70x100
"US": 510,
"NO": 989,
"FI": 85,
"PL": 211,
"ES": 63,
"SE": 32,
},
pwinty.GLOBAL_CFP_12x12: { # 30x30
"US": 167,
"NO": 247,
"FI": 85,
"PL": 102,
"ES": 63,
"SE": 32,
},
pwinty.GLOBAL_CFP_20x20: { # 50x50
"US": 243,
"NO": 247,
"FI": 85,
"PL": 123,
"ES": 63,
"SE": 32,
},
pwinty.GLOBAL_CFP_28x28: { # 70x70
"US": 472,
"NO": 371,
"FI": 85,
"PL": 150,
"ES": 63,
"SE": 32,
},
}
price += extra_shipping_price[sku].get(market.territory, 0)
price *= market.price_adjustments
if designer:
+4 -2
View File
@@ -545,9 +545,9 @@ class TestPrice(unittest2.TestCase):
)
def test_framed_print_price(self):
self.assertEqual(558, framed_print_price(sku="GLOBAL-CFP-12x12", market=sweden))
self.assertEqual(598, framed_print_price(sku="GLOBAL-CFP-12x12", market=sweden))
self.assertEqual(
569,
609,
framed_print_price(
sku="GLOBAL-CFP-12x12", market=sweden, designer=designer_moomin
),
@@ -555,6 +555,8 @@ class TestPrice(unittest2.TestCase):
self.assertEqual(
528, framed_print_price(sku="GLOBAL-CFP-12x12", market=denmark)
)
self.assertEqual(113, framed_print_price(sku="GLOBAL-CFP-28x40", market=russia))
self.assertEqual(208, framed_print_price(sku="GLOBAL-CFP-28x40", market=us))
def test_invalid_framed_print_code(self):
with self.assertRaises(ValueError) as context:
+1 -1
View File
@@ -208,7 +208,7 @@ class TestEndpoints(flask_testing.TestCase):
"/prices/framed-print?sku=GLOBAL-CFP-12x12&territory=SE"
)
self.assert200(response)
expected = [{"price": 557.5, "price_excl_vat": 446, "sku": "GLOBAL-CFP-12x12"}]
expected = [{"price": 597.5, "price_excl_vat": 478, "sku": "GLOBAL-CFP-12x12"}]
self.assertEqual(expected, response.json["data"])
def test_framed_print_invalid_sku(self):