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());
        }
        
        double fraction = 25/100;
        // return sum.multiply(new BigDecimal(Double.toString(fraction)));
        return new BigDecimal("25.50");
    }

    public abstract List<CartItemInfo> getAllItems();
}

@@ -819,22 +819,26 @@
         
-double
+BigDecimal
  fractio
@@ -841,22 +841,42 @@
 ction = 
+BigDecimal.valueOf(
 25/100
+)
 ;%0A      
@@ -868,35 +868,32 @@
 25/100);%0A       
- //
  return sum.mult
@@ -901,39 +901,8 @@
 ply(
-new BigDecimal(Double.toString(
 frac
@@ -898,34 +898,32 @@
 ltiply(fraction)
-))
 ;%0A        return
@@ -920,39 +920,8 @@
     
-return new BigDecimal(%2225.50%22);
 %0A   

Update AbstractFulfillmentProvider.java