package io.github.zutherb.appstash.shop.service.cart.impl;

import io.github.zutherb.appstash.shop.service.cart.model.CartItemInfo;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;

public abstract class AbstractFulfillmentProvider {
    
    public BigDecimal getTotalSum() {
        BigDecimal sum = BigDecimal.ZERO;
        for (CartItemInfo cartItemInfo : getAllItems()) {
            sum = sum.add(cartItemInfo.getTotalSum());
        }
        // double fraction = 25/100;        
        // return sum.subtract(sum.multiply(new BigDecimal(fraction)));
        
        return sum;
    }
    
    public BigDecimal getDiscountSum() {
        BigDecimal sum = BigDecimal.ZERO;
        for (CartItemInfo cartItemInfo : getAllItems()) {
            sum = sum.add(cartItemInfo.getTotalSum());
        }

        double factor = 25/100.0;
        double result = sum.doubleValue() * factor;
        return new BigDecimal(result);
    }

    public abstract List<CartItemInfo> getAllItems();
}

@@ -478,18 +478,16 @@
         
-//
  double 
@@ -487,23 +487,21 @@
 double f
-r
 act
-ion
+or
  = 25/10
@@ -505,16 +505,11 @@
 /100
-;       
+.0;
  %0A  
@@ -518,99 +518,111 @@
     
-// return sum.subtract(sum.multiply(new BigDecimal(fraction)));%0A        %0A        return sum
+double result = sum.doubleValue() - (sum.doubleValue() * factor);%0A        return new BigDecimal(result)
 ;%0A  

Update AbstractFulfillmentProvider.java