@@ -109,7 +109,7 @@ def test_get_talpa_pricing(self):
109109 "vat_percentage" : "25.50" ,
110110 }
111111
112- def test_get_talpa_pricing_prev_vat (self ):
112+ def test_get_talpa_pricing_other_vat (self ):
113113 product = ProductFactory (
114114 unit_price = Decimal (20 ),
115115 vat = 0.24 ,
@@ -125,18 +125,74 @@ def test_get_talpa_pricing_prev_vat(self):
125125 def test_get_talpa_pricing_with_discount (self ):
126126 product = ProductFactory (
127127 unit_price = Decimal (60 ),
128- low_emission_discount = Decimal (0.5 ),
128+ low_emission_discount = Decimal (0.25 ),
129+ vat = 0.255 ,
130+ )
131+ pricing = product .get_talpa_pricing (True , False )
132+ assert pricing == {
133+ "price_gross" : "45.00" ,
134+ "price_net" : "35.86" ,
135+ "price_vat" : "9.14" ,
136+ "vat_percentage" : "25.50" ,
137+ }
138+
139+ def test_get_talpa_pricing_with_secondary_vehicle (self ):
140+ product = ProductFactory (
141+ unit_price = Decimal (60 ),
142+ low_emission_discount = Decimal (0.25 ),
143+ vat = 0.255 ,
144+ )
145+ pricing = product .get_talpa_pricing (False , True )
146+ assert pricing == {
147+ "price_gross" : "90.00" ,
148+ "price_net" : "71.71" ,
149+ "price_vat" : "18.29" ,
150+ "vat_percentage" : "25.50" ,
151+ }
152+
153+ def test_get_talpa_pricing_with_discount_secondary_vehicle (self ):
154+ product = ProductFactory (
155+ unit_price = Decimal (60 ),
156+ low_emission_discount = Decimal (0.25 ),
157+ vat = 0.255 ,
158+ )
159+ pricing = product .get_talpa_pricing (True , True )
160+ assert pricing == {
161+ "price_gross" : "67.50" ,
162+ "price_net" : "53.78" ,
163+ "price_vat" : "13.72" ,
164+ "vat_percentage" : "25.50" ,
165+ }
166+
167+ def test_get_talpa_pricing_with_precise_discount (self ):
168+ product = ProductFactory (
169+ unit_price = Decimal (64.50 ),
170+ low_emission_discount = Decimal (0.2496124031 ),
129171 vat = 0.255 ,
130172 )
131173 pricing = product .get_talpa_pricing (True , False )
132174 assert pricing == {
133- "price_gross" : "30.00" ,
134- "price_net" : "23.90" ,
135- "price_vat" : "6.10" ,
175+ "price_gross" : "48.40" ,
176+ "price_net" : "38.57" ,
177+ "price_vat" : "9.83" ,
178+ "vat_percentage" : "25.50" ,
179+ }
180+
181+ def test_get_talpa_pricing_with_precise_discount_secondary_vehicle (self ):
182+ product = ProductFactory (
183+ unit_price = Decimal (64.50 ),
184+ low_emission_discount = Decimal (0.2496124031 ),
185+ vat = 0.255 ,
186+ )
187+ pricing = product .get_talpa_pricing (True , True )
188+ assert pricing == {
189+ "price_gross" : "72.60" ,
190+ "price_net" : "57.85" ,
191+ "price_vat" : "14.75" ,
136192 "vat_percentage" : "25.50" ,
137193 }
138194
139- def test_get_talpa_pricing_with_discount_prev_vat (self ):
195+ def test_get_talpa_pricing_with_discount_other_vat (self ):
140196 product = ProductFactory (
141197 unit_price = Decimal (20 ),
142198 low_emission_discount = Decimal (0.5 ),
0 commit comments