FINERACT-1981: Progressive loan schedule handling
This commit is contained in:
committed by
Arnold Gálovics
parent
71d2e51051
commit
2ea23be9a4
+17
@@ -450,4 +450,21 @@ public final class MathUtil {
|
||||
}
|
||||
return percentageOf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate percentage of a value
|
||||
*
|
||||
* @param value
|
||||
* @param percentage
|
||||
* @param mc
|
||||
* @return
|
||||
*/
|
||||
public static BigDecimal percentageOf(final BigDecimal value, final BigDecimal percentage, final MathContext mc) {
|
||||
BigDecimal percentageOf = BigDecimal.ZERO;
|
||||
if (isGreaterThanZero(value)) {
|
||||
final BigDecimal multiplicand = percentage.divide(BigDecimal.valueOf(100L), mc);
|
||||
percentageOf = value.multiply(multiplicand, mc);
|
||||
}
|
||||
return percentageOf;
|
||||
}
|
||||
}
|
||||
|
||||
+9
@@ -129,6 +129,15 @@ public class Money implements Comparable<Money> {
|
||||
return amountScaled;
|
||||
}
|
||||
|
||||
public static Money roundToMultiplesOf(final Money existingVal, final Integer inMultiplesOf) {
|
||||
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);
|
||||
}
|
||||
return Money.of(existingVal.getCurrency(), amountScaled);
|
||||
}
|
||||
|
||||
public static double ceiling(final double n, final double s) {
|
||||
double c;
|
||||
|
||||
|
||||
+1
-4
@@ -717,15 +717,12 @@ public final class CalendarUtils {
|
||||
if (recur == null) {
|
||||
return null;
|
||||
}
|
||||
LocalDate date = startDate;
|
||||
final LocalDate seedDate = calendar.getStartDateLocalDate();
|
||||
/**
|
||||
* if (isValidRedurringDate(calendar.getRecurrence(), seedDate, date)) { date = date.plusDays(1); }
|
||||
**/
|
||||
|
||||
final LocalDate scheduleDate = getNextRecurringDate(recur, seedDate, date);
|
||||
|
||||
return scheduleDate;
|
||||
return getNextRecurringDate(recur, seedDate, startDate);
|
||||
}
|
||||
|
||||
public static void validateNthDayOfMonthFrequency(DataValidatorBuilder baseDataValidator, final String repeatsOnNthDayOfMonthParamName,
|
||||
|
||||
Reference in New Issue
Block a user