@@ -562,7 +562,7 @@ describe("Total calculation", function () {
562562 * TAX INCLUSIVE CART
563563 *
564564 * Total price -> 120 tax inclusive
565- * Fixed discount -> 10 tax inclusive
565+ * Fixed discount -> 10 tax inclusive total (which results in a subtotal of 8.33 of the discount)
566566 * Tax rate -> 20%
567567 */
568568
@@ -574,7 +574,7 @@ describe("Total calculation", function () {
574574 is_tax_inclusive : true ,
575575 adjustments : [
576576 {
577- amount : 10 ,
577+ amount : 8.333333333333334 ,
578578 } ,
579579 ] ,
580580 tax_lines : [
@@ -594,50 +594,50 @@ describe("Total calculation", function () {
594594 unit_price : 60 ,
595595 quantity : 2 ,
596596 subtotal : 100 ,
597- tax_total : 18 ,
598- total : 108 ,
597+ tax_total : 18.333333333333332 ,
598+ total : 110 ,
599599 is_tax_inclusive : true ,
600600
601601 original_total : 120 ,
602602 original_tax_total : 20 ,
603603
604- discount_subtotal : 10 ,
605- discount_tax_total : 2 ,
606- discount_total : 12 ,
604+ discount_subtotal : 8.333333333333334 ,
605+ discount_tax_total : 1.6666666666666667 ,
606+ discount_total : 10 ,
607607
608608 tax_lines : [
609609 {
610610 rate : 20 ,
611- total : 18 ,
611+ total : 18.333333333333332 ,
612612 subtotal : 20 ,
613613 } ,
614614 ] ,
615615 adjustments : [
616616 {
617- amount : 10 ,
618- subtotal : 10 ,
619- total : 12 ,
617+ amount : 8.333333333333334 ,
618+ subtotal : 8.333333333333334 ,
619+ total : 10 ,
620620 } ,
621621 ] ,
622622 } ,
623623 ] ,
624624 subtotal : 100 ,
625- tax_total : 18 ,
626- total : 108 , // total is 120 - 12 tax inclusive discount
625+ tax_total : 18.333333333333332 ,
626+ total : 110 ,
627627
628628 original_item_subtotal : 100 ,
629629 original_item_tax_total : 20 ,
630630 original_item_total : 120 ,
631631 original_tax_total : 20 ,
632632 original_total : 120 ,
633633
634- discount_subtotal : 10 ,
635- discount_tax_total : 2 ,
636- discount_total : 12 ,
634+ discount_subtotal : 8.333333333333334 ,
635+ discount_tax_total : 1.6666666666666667 ,
636+ discount_total : 10 ,
637637
638638 item_subtotal : 100 ,
639- item_tax_total : 18 ,
640- item_total : 108 ,
639+ item_tax_total : 18.333333333333332 ,
640+ item_total : 110 ,
641641
642642 credit_line_subtotal : 0 ,
643643 credit_line_tax_total : 0 ,
0 commit comments