FINERACT-1971: Down payment (auto) transaction using installment multiples of setting
This commit is contained in:
committed by
Adam Saghy
parent
7499859d39
commit
849790ea46
+2
-2
@@ -124,7 +124,7 @@ public class Money implements Comparable<Money> {
|
||||
BigDecimal amountScaled = existingVal;
|
||||
BigDecimal inMultiplesOfValue = BigDecimal.valueOf(inMultiplesOf.intValue());
|
||||
if (inMultiplesOfValue.compareTo(BigDecimal.ZERO) > 0) {
|
||||
amountScaled = existingVal.divide(inMultiplesOfValue, 0, RoundingMode.HALF_UP).multiply(inMultiplesOfValue);
|
||||
amountScaled = existingVal.divide(inMultiplesOfValue, 0, MoneyHelper.getRoundingMode()).multiply(inMultiplesOfValue);
|
||||
}
|
||||
return amountScaled;
|
||||
}
|
||||
@@ -133,7 +133,7 @@ public class Money implements Comparable<Money> {
|
||||
BigDecimal amountScaled = existingVal.getAmount();
|
||||
BigDecimal inMultiplesOfValue = BigDecimal.valueOf(inMultiplesOf.intValue());
|
||||
if (inMultiplesOfValue.compareTo(BigDecimal.ZERO) > 0) {
|
||||
amountScaled = amountScaled.divide(inMultiplesOfValue, 0, RoundingMode.HALF_UP).multiply(inMultiplesOfValue);
|
||||
amountScaled = amountScaled.divide(inMultiplesOfValue, 0, MoneyHelper.getRoundingMode()).multiply(inMultiplesOfValue);
|
||||
}
|
||||
return Money.of(existingVal.getCurrency(), amountScaled);
|
||||
}
|
||||
|
||||
+8
@@ -22,10 +22,12 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import java.math.MathContext;
|
||||
import java.math.RoundingMode;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class MoneyHelper {
|
||||
|
||||
@@ -59,4 +61,10 @@ public class MoneyHelper {
|
||||
}
|
||||
return mathContext;
|
||||
}
|
||||
|
||||
public static void fetchRoundingModeFromGlobalConfig() {
|
||||
roundingMode = RoundingMode.valueOf(staticConfigurationDomainService.getRoundingMode());
|
||||
log.info("Fetch Rounding Mode from Global Config {}", roundingMode.name());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user