diff --git a/api/resources/prices.py b/api/resources/prices.py index aa3e16d..a9974fc 100644 --- a/api/resources/prices.py +++ b/api/resources/prices.py @@ -46,6 +46,7 @@ def wallpaper(): 'material': material.name, 'material_id': material.id, 'm2_price': m2_price(material, market, reseller=reseller, designer=designer, rounded=False, inc_vat=True), + 'm2_price_excl_vat': m2_price(material, market, reseller=reseller, designer=designer, rounded=False, inc_vat=False), 'price': wallpaper_price(width, height, material, market, reseller=reseller, designer=designer, rounded=False, inc_vat=True), 'price_excl_vat': wallpaper_price(width, height, material, market, reseller=reseller, designer=designer, rounded=False, inc_vat=False), }) @@ -75,6 +76,7 @@ def canvas(): 'width': width, 'height': height, 'm2_price': m2_price(material, market, reseller=reseller, designer=designer, rounded=False, inc_vat=True), + 'm2_price_excl_vat': m2_price(material, market, reseller=reseller, designer=designer, rounded=False, inc_vat=False), 'price': old_canvas_price(width, height, material, market, reseller=reseller, designer=designer, framed=framed, rounded=False, inc_vat=True), 'price_excl_vat': old_canvas_price(width, height, material, market, reseller=reseller, designer=designer, framed=framed, rounded=False, inc_vat=False) }) @@ -140,6 +142,7 @@ def inquiry_wallpaper(inquiry): 'material': material.name, 'material_id': material.id, 'm2_price': m2_price(material, inquiry.market, designer=inquiry.designer, reseller=inquiry.dealer_store, inquiry=inquiry, rounded=False, inc_vat=True), + 'm2_price_excl_vat': m2_price(material, inquiry.market, designer=inquiry.designer, reseller=inquiry.dealer_store, inquiry=inquiry, rounded=False, inc_vat=False), 'inquiry_price_excl_retouch': inquiry_price(inquiry, material=material, width=width, height=height, rounded=False, inc_price_retouch=False, inc_vat=True), 'inquiry_price': inquiry_price(inquiry, material=material, width=width, height=height, rounded=False, inc_vat=True), 'inquiry_price_excl_vat': inquiry_price(inquiry, material=material, width=width, height=height, rounded=False, inc_vat=False) @@ -167,6 +170,7 @@ def inquiry_canvas(inquiry): 'width': width, 'height': height, 'm2_price': m2_price(material, inquiry.market, designer=inquiry.designer, reseller=inquiry.dealer_store, inquiry=inquiry, rounded=False, inc_vat=True), + 'm2_price_excl_vat': m2_price(material, inquiry.market, designer=inquiry.designer, reseller=inquiry.dealer_store, inquiry=inquiry, rounded=False, inc_vat=False), 'inquiry_price_excl_retouch': inquiry_price(inquiry, material=material, width=width, height=height, framed=framed, rounded=False, inc_price_retouch=False, inc_vat=True), 'inquiry_price': inquiry_price(inquiry, material=material, width=width, height=height, framed=framed, rounded=False, inc_vat=True), 'inquiry_price_excl_vat': inquiry_price(inquiry, material=material, width=width, height=height, framed=framed, rounded=False, inc_vat=False) diff --git a/docs/prices.md b/docs/prices.md index 16aef81..9dd9ec8 100644 --- a/docs/prices.md +++ b/docs/prices.md @@ -25,6 +25,7 @@ Sample response "data": [ { "m2_price": 295.0, + "m2_price_excl_vat": 236.0, "material": "standard-wallpaper", "material_id": 1, "price": 1180.0, @@ -32,6 +33,7 @@ Sample response }, { "m2_price": 325.0, + "m2_price_excl_vat": 260.0, "material": "premium-wallpaper", "material_id": 4, "price": 1300.0, @@ -66,6 +68,7 @@ Sample response "framed": true, "height": 50, "m2_price": 252.37137599999997, + "m2_price_excl_vat": 201.89710079999998, "price": 224.92771680815997, "price_excl_vat": 179.942173446528, "width": 100 @@ -74,6 +77,7 @@ Sample response "framed": false, "height": 50, "m2_price": 252.37137599999997, + "m2_price_excl_vat": 201.89710079999998, "price": 126.18568799999998, "price_excl_vat": 100.94855039999999, "width": 100 @@ -138,17 +142,19 @@ Sample response "inquiry_price": 3595.50219975, "inquiry_price_excl_retouch": 3595.50219975, "inquiry_price_excl_vat": 2876.4017598, + "m2_price": 268.72213750000003, + "m2_price_excl_vat": 214.97771, "material": "standard-wallpaper", - "material_id": 1, - "m2_price": 268.72213750000003 + "material_id": 1 }, { "inquiry_price": 3961.1464912499996, "inquiry_price_excl_retouch": 3961.1464912499996, "inquiry_price_excl_vat": 3168.9171929999998, + "m2_price": 296.04981250000003, + "m2_price_excl_vat": 236.83985, "material": "premium-wallpaper", - "material_id": 4, - "m2_price": 296.04981250000003 + "material_id": 4 } ], "retouch_price": 0, @@ -169,19 +175,21 @@ Sample response { "framed": true, "height": 150, - "inquiry_price": 356.25, - "inquiry_price_excl_retouch": 356.25, - "inquiry_price_excl_vat": 285, + "inquiry_price": 355.71481084, + "inquiry_price_excl_retouch": 355.71481084, + "inquiry_price_excl_vat": 284.571848672, "m2_price": 112.887, + "m2_price_excl_vat": 90.3096, "width": 150 }, { "framed": false, "height": 150, - "inquiry_price": 846.25, - "inquiry_price_excl_retouch": 846.25, - "inquiry_price_excl_vat": 677, + "inquiry_price": 846.6525, + "inquiry_price_excl_retouch": 846.6525, + "inquiry_price_excl_vat": 677.322, "m2_price": 112.887, + "m2_price_excl_vat": 90.3096, "width": 500 } ], diff --git a/tests/resources/test_prices.py b/tests/resources/test_prices.py index b1d0371..54deaf0 100644 --- a/tests/resources/test_prices.py +++ b/tests/resources/test_prices.py @@ -54,6 +54,7 @@ class TestEndpoints(flask_testing.TestCase): expected = [ { 'm2_price': 295.0, + 'm2_price_excl_vat': 236.0, 'price_excl_vat': 236.0, 'price': 295.0, 'material': 'standard-wallpaper', @@ -61,6 +62,7 @@ class TestEndpoints(flask_testing.TestCase): }, { 'm2_price': 325.0, + 'm2_price_excl_vat': 260.0, 'price_excl_vat': 260.0, 'price': 325.0, 'material': 'premium-wallpaper', @@ -82,6 +84,7 @@ class TestEndpoints(flask_testing.TestCase): 'price_excl_vat': 981.76, 'material_id': 1, 'm2_price': 306.8, + 'm2_price_excl_vat': 245.44, 'material': 'standard-wallpaper' }, { @@ -89,6 +92,7 @@ class TestEndpoints(flask_testing.TestCase): 'price_excl_vat': 1081.6000000000001, 'material_id': 2, 'm2_price': 338.00000000000006, + 'm2_price_excl_vat': 270.40000000000003, 'material': 'premium-wallpaper' } ] @@ -106,7 +110,8 @@ class TestEndpoints(flask_testing.TestCase): 'width': 150, 'height': 40, 'framed': True, - 'm2_price': 999.0 + 'm2_price': 999.0, + 'm2_price_excl_vat': 799.2, }, { 'price_excl_vat': 319.68000000000006, @@ -114,7 +119,8 @@ class TestEndpoints(flask_testing.TestCase): 'width': 200, 'height': 20, 'framed': False, - 'm2_price': 999.0 + 'm2_price': 999.0, + 'm2_price_excl_vat': 799.2, } ] self.assertEqual(expected, response.json['data']) @@ -133,6 +139,7 @@ class TestEndpoints(flask_testing.TestCase): 'price': 1236.9099140000003, 'framed': True, 'm2_price': 1038.96, + 'm2_price_excl_vat': 831.1680000000001, 'width': 150 }, { @@ -141,6 +148,7 @@ class TestEndpoints(flask_testing.TestCase): 'price': 415.58400000000006, 'framed': False, 'm2_price': 1038.96, + 'm2_price_excl_vat': 831.1680000000001, 'width': 200 } ]