Skip to content

Commit

Permalink
FINERACT-2060: Accrual reverse replay logic and Handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Marta Jankovics committed Nov 22, 2024
1 parent 281aff3 commit a28b331
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3679,6 +3679,10 @@ public void updateInterestRateFrequencyType() {
this.loanRepaymentScheduleDetail.setInterestPeriodFrequencyType(this.loanProduct.getInterestPeriodFrequencyType());
}

public void updateInterestRateFrequencyType(PeriodFrequencyType periodFrequencyType) {
this.loanRepaymentScheduleDetail.setInterestPeriodFrequencyType(periodFrequencyType);
}

public void addLoanTransaction(final LoanTransaction loanTransaction) {
this.loanTransactions.add(loanTransaction);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import lombok.experimental.Accessors;
import org.apache.fineract.infrastructure.core.service.DateUtils;
import org.apache.fineract.organisation.monetary.domain.Money;
import org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleProcessingWrapper;
import org.apache.fineract.portfolio.loanproduct.domain.LoanProductRelatedDetail;

@Data
Expand Down Expand Up @@ -145,8 +144,16 @@ Optional<RepaymentPeriod> findRepaymentPeriodForBalanceChange(final LocalDate ba
}
// TODO use isInPeriod
return repaymentPeriods.stream()//
.filter(repaymentPeriod -> LoanRepaymentScheduleProcessingWrapper.isInPeriod(balanceChangeDate,
repaymentPeriod.getFromDate(), repaymentPeriod.getDueDate(), repaymentPeriod.getPrevious().isEmpty()))
.filter(repaymentPeriod -> {
final boolean isFirstPeriod = repaymentPeriod.getPrevious().isEmpty();
if (isFirstPeriod) {
return !balanceChangeDate.isBefore(repaymentPeriod.getFromDate())
&& !balanceChangeDate.isAfter(repaymentPeriod.getDueDate());
} else {
return balanceChangeDate.isAfter(repaymentPeriod.getFromDate())
&& !balanceChangeDate.isAfter(repaymentPeriod.getDueDate());
}
})//
.findFirst();
}

Expand Down

0 comments on commit a28b331

Please sign in to comment.