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.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());
        }
        
        BigDecimal fraction = BigDecimal.valueOf(25/100);
        return sum.multiply(fraction);
        
    }

    public abstract List<CartItemInfo> getAllItems();
}

@@ -823,95 +823,313 @@
     
-BigDecimal fraction = BigDecimal.valueOf(25/100);%0A        return sum.multiply(fraction)
+double discountPercent = 25/100;%0A        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  

Update AbstractFulfillmentProvider.java