File tree Expand file tree Collapse file tree 3 files changed +14
-4
lines changed
Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,8 @@ class PercentageDiscountChanged < Infra::Event
7070 attribute :order_id , Infra ::Types ::UUID
7171 attribute :type , Infra ::Types ::String
7272 attribute :amount , Infra ::Types ::Price
73+ attribute :base_total_value , Infra ::Types ::Price
74+ attribute :total_value , Infra ::Types ::Price
7375 end
7476
7577 class ProductMadeFreeForOrder < Infra ::Event
Original file line number Diff line number Diff line change @@ -68,7 +68,9 @@ def change_discount(discount)
6868 data : {
6969 order_id : @id ,
7070 type : discount . type ,
71- amount : discount . value
71+ amount : discount . value ,
72+ base_total_value : @list . base_sum ,
73+ total_value : @list . base_sum - @list . base_sum * ( discount . value / 100 )
7274 }
7375 )
7476 end
Original file line number Diff line number Diff line change @@ -189,7 +189,9 @@ def test_calculates_total_value_with_discount
189189 data : {
190190 order_id : order_id ,
191191 type : Pricing ::Discounts ::GENERAL_DISCOUNT ,
192- amount : 50
192+ amount : 50 ,
193+ base_total_value : 20 ,
194+ total_value : 10
193195 }
194196 ) ,
195197 OrderTotalValueCalculated . new (
@@ -341,7 +343,9 @@ def test_changing_discount_possible_when_discount_is_set
341343 data : {
342344 order_id : order_id ,
343345 type : Pricing ::Discounts ::GENERAL_DISCOUNT ,
344- amount : 100
346+ amount : 100 ,
347+ base_total_value : 20 ,
348+ total_value : 0
345349 }
346350 ) ,
347351 OrderTotalValueCalculated . new (
@@ -377,7 +381,9 @@ def test_changing_discount_possible_more_than_once
377381 data : {
378382 order_id : order_id ,
379383 type : Pricing ::Discounts ::GENERAL_DISCOUNT ,
380- amount : 100
384+ amount : 100 ,
385+ base_total_value : 20 ,
386+ total_value : 0
381387 }
382388 ) ,
383389 OrderTotalValueCalculated . new (
You can’t perform that action at this time.
0 commit comments