adamsaghy commented on code in PR #2908:
URL: https://github.com/apache/fineract/pull/2908#discussion_r1089107771
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java:
##########
@@ -3510,6 +3510,39 @@ private void
processIncomeAccrualTransactionOnLoanClosure() {
updateLoanOutstandingBalances();
}
+ public void applyIncomeAccrualTransaction(LocalDate closedDate) {
+ ExternalId externalId = ExternalId.empty();
+ boolean isExternalIdAutoGenerationEnabled =
TemporaryConfigurationServiceContainer.isExternalIdAutoGenerationEnabled();
+ if (isPeriodicAccrualAccountingEnabledOnLoanProduct()) {
+ List<LoanTransaction> updatedAccrualTransactions =
retrieveListOfAccrualTransactions();
+ LocalDate lastAccruedDate = this.getDisbursementDate();
+ if (!updatedAccrualTransactions.isEmpty()) {
+ lastAccruedDate =
updatedAccrualTransactions.get(updatedAccrualTransactions.size() -
1).getTransactionDate();
+ }
+ HashMap<String, Object> feeDetails = new HashMap<>();
+ determineFeeDetails(lastAccruedDate, closedDate, feeDetails);
+ if (isExternalIdAutoGenerationEnabled) {
+ externalId = ExternalId.generate();
+ }
+ BigDecimal fee = (BigDecimal) feeDetails.get(FEE);
+ if (fee == null) {
+ fee = BigDecimal.ZERO;
+ }
+ BigDecimal penalty = (BigDecimal) feeDetails.get(PENALTY);
+ if (penalty == null) {
+ penalty = BigDecimal.ZERO;
+ }
+ BigDecimal total = fee.add(penalty);
+ // TODO: calculate interest?
Review Comment:
Please check whether we need the interest calculation as well, or do it
later...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]