FINERACT-1981: EMI Calculation, Daily, Weekly, Monthly support plug to Repayment Schedule
This commit is contained in:
committed by
Adam Saghy
parent
9f5044b358
commit
db8000b4f3
-10
@@ -24,7 +24,6 @@ import jakarta.validation.constraints.NotNull;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.Year;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
@@ -35,7 +34,6 @@ import java.util.Locale;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.portfolio.common.domain.DaysInYearType;
|
||||
|
||||
public final class DateUtils {
|
||||
|
||||
@@ -396,12 +394,4 @@ public final class DateUtils {
|
||||
return formatter;
|
||||
}
|
||||
|
||||
public static Integer daysInYear(final DaysInYearType daysInYear, final LocalDate referenceDate) {
|
||||
return daysInYear.isActual() ? DateUtils.getDaysInYear(referenceDate.getYear()) : daysInYear.getValue();
|
||||
}
|
||||
|
||||
public static Integer getDaysInYear(final Integer year) {
|
||||
return Year.isLeap(year) ? 366 : 365;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+10
@@ -467,4 +467,14 @@ public final class MathUtil {
|
||||
}
|
||||
return percentageOf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove unused zeros from end of BigDecimal fraction and keep the format "0.0"
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
public static BigDecimal stripTrailingZeros(final BigDecimal value) {
|
||||
return value == null ? null : new BigDecimal(value.stripTrailingZeros().toPlainString());
|
||||
}
|
||||
}
|
||||
|
||||
+8
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.portfolio.common.domain;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
@@ -74,4 +75,11 @@ public enum DaysInMonthType {
|
||||
public boolean isDaysInMonth_30() {
|
||||
return DaysInMonthType.DAYS_30.getValue().equals(this.value);
|
||||
}
|
||||
|
||||
public Integer getNumberOfDays(final LocalDate referenceDate) {
|
||||
if (referenceDate == null) {
|
||||
return null;
|
||||
}
|
||||
return this == ACTUAL ? referenceDate.lengthOfMonth() : this.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
+8
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.portfolio.common.domain;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
@@ -83,4 +84,11 @@ public enum DaysInYearType {
|
||||
public boolean isActual() {
|
||||
return DaysInYearType.ACTUAL.getValue().equals(this.value);
|
||||
}
|
||||
|
||||
public Integer getNumberOfDays(final LocalDate referenceDate) {
|
||||
if (referenceDate == null) {
|
||||
return null;
|
||||
}
|
||||
return this == ACTUAL ? referenceDate.lengthOfYear() : this.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user