diff --git a/library/src/main/java/org/mustangproject/Charge.java b/library/src/main/java/org/mustangproject/Charge.java index a16f5e66..c1810c57 100644 --- a/library/src/main/java/org/mustangproject/Charge.java +++ b/library/src/main/java/org/mustangproject/Charge.java @@ -116,20 +116,12 @@ public class Charge implements IZUGFeRDAllowanceCharge { @Override public BigDecimal getTotalAmount(IAbsoluteValueProvider currentItem) { - if (percent!=null) { - return currentItem.getValue().multiply(getPercent().divide(new BigDecimal(100))); - } else if(totalAmount != null) { - return totalAmount; - } else { - throw new RuntimeException("percent must be set"); - } - } - - public BigDecimal getTotalAmount() { if (totalAmount!=null) { return totalAmount; + } else if (percent!=null) { + return currentItem.getValue().multiply(getPercent().divide(new BigDecimal(100))); } else { - throw new RuntimeException("totalAmount must be set"); + throw new RuntimeException("Either totalAmount or percent must be set"); } }