FINERACT-2354: [BE] re-aging preview page outcomes with incorrect calculation for diff scenarios with interest bearing loans

This commit is contained in:
Soma Sörös
2025-12-12 14:54:48 +01:00
committed by Adam Saghy
parent 85cc3d7132
commit 77c1f33f5a
2 changed files with 8 additions and 3 deletions
@@ -78,4 +78,8 @@ public class ReAgePreviewRequest implements Serializable {
@Locale
private String locale;
@QueryParam("reAgeInterestHandling")
@Parameter(description = "The interest handling type. Applied only for progressive interest-bearing loans. DEFAULT if not provided.")
private String reAgeInterestHandling;
}
@@ -28,6 +28,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.codes.domain.CodeValue;
@@ -307,14 +308,14 @@ public class LoanReAgingService {
private LoanReAgeParameter createReAgeParameterFromPreviewRequest(final LoanTransaction reAgeTransaction,
final ReAgePreviewRequest reAgePreviewRequest) {
final PeriodFrequencyType periodFrequencyType = PeriodFrequencyType.valueOf(reAgePreviewRequest.getFrequencyType());
final Locale locale = reAgePreviewRequest.getLocale() != null ? Locale.forLanguageTag(reAgePreviewRequest.getLocale())
: Locale.getDefault();
final Locale locale = Optional.ofNullable(reAgePreviewRequest.getLocale()).map(Locale::forLanguageTag).orElse(Locale.getDefault());
final LocalDate startDate = JsonParserHelper.convertFrom(reAgePreviewRequest.getStartDate(), LoanReAgingApiConstants.startDate,
reAgePreviewRequest.getDateFormat(), locale);
final Integer numberOfInstallments = reAgePreviewRequest.getNumberOfInstallments();
final Integer periodFrequencyNumber = reAgePreviewRequest.getFrequencyNumber();
final LoanReAgeInterestHandlingType reAgeInterestHandlingType = LoanReAgeInterestHandlingType.DEFAULT;
final LoanReAgeInterestHandlingType reAgeInterestHandlingType = Optional.ofNullable(reAgePreviewRequest.getReAgeInterestHandling())
.map(LoanReAgeInterestHandlingType::valueOf).orElse(LoanReAgeInterestHandlingType.DEFAULT);
return new LoanReAgeParameter(reAgeTransaction, periodFrequencyType, periodFrequencyNumber, startDate, numberOfInstallments,
reAgeInterestHandlingType, null);