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 discountPercent = 25/100;
        BigDecimal decimalDiscountPercent = new BigDecimal(Double.toString(discountPercent));
        BigDecimal discountAmount = sum.multiply(decimalDiscountPercent);
        discountAmount = discountAmount.setScale(2, RoundingMode.HALF_UP);
        return discountAmount;
        
    }

    public abstract List<CartItemInfo> getAllItems();
}

@@ -833,24 +833,16 @@
       %7D%0A
-        
 %0A       
@@ -849,31 +849,22 @@
  double 
-discountPercent
+factor
  = 25/10
@@ -864,16 +864,18 @@
 = 25/100
+.0
 ;%0A      
@@ -880,282 +880,90 @@
     
-BigDecimal decimalDiscountPercent = new BigDecimal(Double.toString(discountPercent));%0A        BigDecimal discountAmount = sum.multiply(decimalDiscountPercent);%0A        discountAmount = discountAmount.setScale(2, RoundingMode.HALF_UP);%0A        return discountAmount;%0A        
+double result = sum.doubleValue() * factor;%0A        return new BigDecimal(result);
 %0A   

Update AbstractFulfillmentProvider.java