oleksii-novikov-onix commented on code in PR #4603:
URL: https://github.com/apache/fineract/pull/4603#discussion_r2054333614
##########
fineract-investor/src/main/java/org/apache/fineract/investor/service/AccountingServiceImpl.java:
##########
@@ -171,82 +175,91 @@ private void
createMappingToTransfer(ExternalAssetOwnerTransfer transfer, List<J
});
}
- private List<JournalEntry> createJournalEntries(Loan loan, Long
transactionId, LocalDate transactionDate, BigDecimal principalAmount,
- BigDecimal interestAmount, BigDecimal feesAmount, BigDecimal
penaltiesAmount, BigDecimal overPaymentAmount,
- boolean isReversalOrder) {
- Long loanProductId = loan.productId();
- Long loanId = loan.getId();
- Office office = loan.getOffice();
- String currencyCode = loan.getCurrencyCode();
- List<JournalEntry> journalEntryList = new ArrayList<>();
+ private List<JournalEntry> createJournalEntries(final Loan loan, final
Long transactionId, final LocalDate transactionDate,
+ final BigDecimal principalAmount, final BigDecimal interestAmount,
final BigDecimal feesAmount,
+ final BigDecimal penaltiesAmount, final BigDecimal
overPaymentAmount, final boolean isReversalOrder) {
+ final Long loanProductId = loan.productId();
+ final Long loanId = loan.getId();
+ final Office office = loan.getOffice();
+ final String currencyCode = loan.getCurrencyCode();
+ final List<JournalEntry> journalEntryList = new ArrayList<>();
BigDecimal totalDebitAmount = BigDecimal.ZERO;
- Map<GLAccount, BigDecimal> accountMap = new LinkedHashMap<>();
+ final Map<GLAccount, BigDecimal> accountMap = new LinkedHashMap<>();
// principal entry
- if (principalAmount != null &&
principalAmount.compareTo(BigDecimal.ZERO) > 0) {
- AccountingConstants.AccrualAccountsForLoan accrualAccount =
AccountingConstants.AccrualAccountsForLoan.LOAN_PORTFOLIO;
+ if (MathUtil.isGreaterThanZero(principalAmount)) {
+ totalDebitAmount = totalDebitAmount.add(principalAmount);
+ GLAccount account;
if (loan.isChargedOff()) {
- if (loan.isFraud()) {
- accrualAccount =
AccountingConstants.AccrualAccountsForLoan.CHARGE_OFF_FRAUD_EXPENSE;
+ final Long chargeOffReasonId = loan.fetchChargeOffReasonId();
+ final ProductToGLAccountMapping mapping = chargeOffReasonId !=
null
+ ? helper.getChargeOffMappingByCodeValue(loanProductId,
PortfolioProductType.LOAN, chargeOffReasonId)
+ : null;
+ if (mapping != null) {
+ account = mapping.getGlAccount();
Review Comment:
When `mapping != null`, we don’t check `loan.isFraud()` and use
`mapping.getGlAccount()` unconditionally.
Is this an issue?
--
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]