FINERACT-1806: Rework Product to GL account mapping and fix charge-off reason typos
This commit is contained in:
+1
-1
@@ -178,7 +178,7 @@ public class AccountingProcessorHelper {
|
||||
}
|
||||
|
||||
public ProductToGLAccountMapping getChargeOffMappingByCodeValue(Integer chargeOffReasonCodeValue) {
|
||||
return accountMappingRepository.findChargesOffReasonMappingById(chargeOffReasonCodeValue);
|
||||
return accountMappingRepository.findChargeOffReasonMappingById(chargeOffReasonCodeValue);
|
||||
}
|
||||
|
||||
public SavingsDTO populateSavingsDtoFromMap(final Map<String, Object> accountingBridgeData, final boolean cashBasedAccountingEnabled,
|
||||
|
||||
+3
-1
@@ -232,7 +232,9 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
|
||||
// need to fetch if there are account mappings (always one)
|
||||
Integer chargeOffReasonCodeValue = loanDTO.getChargeOffReasonCodeValue();
|
||||
|
||||
ProductToGLAccountMapping mapping = helper.getChargeOffMappingByCodeValue(chargeOffReasonCodeValue);
|
||||
ProductToGLAccountMapping mapping = chargeOffReasonCodeValue != null
|
||||
? helper.getChargeOffMappingByCodeValue(chargeOffReasonCodeValue)
|
||||
: null;
|
||||
if (mapping != null) {
|
||||
GLAccount accountCredit = this.helper.getLinkedGLAccountForLoanProduct(loanProductId,
|
||||
AccrualAccountsForLoan.LOAN_PORTFOLIO.getValue(), paymentTypeId);
|
||||
|
||||
+54
-65
@@ -30,6 +30,7 @@ import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsFor
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FinancialActivity;
|
||||
import org.apache.fineract.accounting.glaccount.domain.GLAccount;
|
||||
import org.apache.fineract.accounting.journalentry.data.ChargePaymentDTO;
|
||||
import org.apache.fineract.accounting.journalentry.data.GLAccountBalanceHolder;
|
||||
import org.apache.fineract.accounting.journalentry.data.LoanDTO;
|
||||
import org.apache.fineract.accounting.journalentry.data.LoanTransactionDTO;
|
||||
import org.apache.fineract.infrastructure.core.service.MathUtil;
|
||||
@@ -139,71 +140,59 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
|
||||
final Long paymentTypeId = loanTransactionDTO.getPaymentTypeId();
|
||||
final boolean isReversal = loanTransactionDTO.isReversed();
|
||||
|
||||
Map<GLAccount, BigDecimal> accountMapForCredit = new LinkedHashMap<>();
|
||||
|
||||
Map<Integer, BigDecimal> accountMapForDebit = new LinkedHashMap<>();
|
||||
GLAccountBalanceHolder glAccountBalanceHolder = new GLAccountBalanceHolder();
|
||||
|
||||
// principal payment
|
||||
if (principalAmount != null && principalAmount.compareTo(BigDecimal.ZERO) > 0) {
|
||||
if (isMarkedFraud) {
|
||||
populateCreditDebitMaps(loanProductId, principalAmount, paymentTypeId, CashAccountsForLoan.LOAN_PORTFOLIO.getValue(),
|
||||
CashAccountsForLoan.CHARGE_OFF_FRAUD_EXPENSE.getValue(), accountMapForCredit, accountMapForDebit);
|
||||
CashAccountsForLoan.CHARGE_OFF_FRAUD_EXPENSE.getValue(), glAccountBalanceHolder);
|
||||
} else {
|
||||
populateCreditDebitMaps(loanProductId, principalAmount, paymentTypeId, CashAccountsForLoan.LOAN_PORTFOLIO.getValue(),
|
||||
CashAccountsForLoan.CHARGE_OFF_EXPENSE.getValue(), accountMapForCredit, accountMapForDebit);
|
||||
CashAccountsForLoan.CHARGE_OFF_EXPENSE.getValue(), glAccountBalanceHolder);
|
||||
}
|
||||
}
|
||||
|
||||
// interest payment
|
||||
if (interestAmount != null && interestAmount.compareTo(BigDecimal.ZERO) > 0) {
|
||||
populateCreditDebitMaps(loanProductId, interestAmount, paymentTypeId, CashAccountsForLoan.INTEREST_ON_LOANS.getValue(),
|
||||
CashAccountsForLoan.INCOME_FROM_CHARGE_OFF_INTEREST.getValue(), accountMapForCredit, accountMapForDebit);
|
||||
CashAccountsForLoan.INCOME_FROM_CHARGE_OFF_INTEREST.getValue(), glAccountBalanceHolder);
|
||||
}
|
||||
|
||||
// handle fees payment
|
||||
if (feesAmount != null && feesAmount.compareTo(BigDecimal.ZERO) > 0) {
|
||||
populateCreditDebitMaps(loanProductId, feesAmount, paymentTypeId, CashAccountsForLoan.INCOME_FROM_FEES.getValue(),
|
||||
CashAccountsForLoan.INCOME_FROM_CHARGE_OFF_FEES.getValue(), accountMapForCredit, accountMapForDebit);
|
||||
CashAccountsForLoan.INCOME_FROM_CHARGE_OFF_FEES.getValue(), glAccountBalanceHolder);
|
||||
}
|
||||
|
||||
// handle penalties payment
|
||||
if (penaltiesAmount != null && penaltiesAmount.compareTo(BigDecimal.ZERO) > 0) {
|
||||
populateCreditDebitMaps(loanProductId, penaltiesAmount, paymentTypeId, CashAccountsForLoan.INCOME_FROM_PENALTIES.getValue(),
|
||||
CashAccountsForLoan.INCOME_FROM_CHARGE_OFF_PENALTY.getValue(), accountMapForCredit, accountMapForDebit);
|
||||
CashAccountsForLoan.INCOME_FROM_CHARGE_OFF_PENALTY.getValue(), glAccountBalanceHolder);
|
||||
}
|
||||
|
||||
// create credit entries
|
||||
for (Map.Entry<GLAccount, BigDecimal> creditEntry : accountMapForCredit.entrySet()) {
|
||||
for (Map.Entry<Long, BigDecimal> creditEntry : glAccountBalanceHolder.getCreditBalances().entrySet()) {
|
||||
GLAccount glAccount = glAccountBalanceHolder.getGlAccountMap().get(creditEntry.getKey());
|
||||
this.helper.createCreditJournalEntryOrReversalForLoan(office, currencyCode, loanId, transactionId, transactionDate,
|
||||
creditEntry.getValue(), isReversal, creditEntry.getKey());
|
||||
creditEntry.getValue(), isReversal, glAccount);
|
||||
}
|
||||
|
||||
// create debit entries
|
||||
for (Map.Entry<Integer, BigDecimal> debitEntry : accountMapForDebit.entrySet()) {
|
||||
this.helper.createDebitJournalEntryOrReversalForLoan(office, currencyCode, debitEntry.getKey().intValue(), loanProductId,
|
||||
paymentTypeId, loanId, transactionId, transactionDate, debitEntry.getValue(), isReversal);
|
||||
for (Map.Entry<Long, BigDecimal> debitEntry : glAccountBalanceHolder.getDebitBalances().entrySet()) {
|
||||
GLAccount glAccount = glAccountBalanceHolder.getGlAccountMap().get(debitEntry.getKey());
|
||||
this.helper.createDebitJournalEntryOrReversalForLoan(office, currencyCode, loanId, transactionId, transactionDate,
|
||||
debitEntry.getValue(), isReversal, glAccount);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void populateCreditDebitMaps(Long loanProductId, BigDecimal transactionPartAmount, Long paymentTypeId,
|
||||
Integer creditAccountType, Integer debitAccountType, Map<GLAccount, BigDecimal> accountMapForCredit,
|
||||
Map<Integer, BigDecimal> accountMapForDebit) {
|
||||
Integer creditAccountType, Integer debitAccountType, GLAccountBalanceHolder glAccountBalanceHolder) {
|
||||
// Resolve Credit
|
||||
GLAccount accountCredit = this.helper.getLinkedGLAccountForLoanProduct(loanProductId, creditAccountType, paymentTypeId);
|
||||
if (accountMapForCredit.containsKey(accountCredit)) {
|
||||
BigDecimal amount = accountMapForCredit.get(accountCredit).add(transactionPartAmount);
|
||||
accountMapForCredit.put(accountCredit, amount);
|
||||
} else {
|
||||
accountMapForCredit.put(accountCredit, transactionPartAmount);
|
||||
}
|
||||
Integer accountDebit = returnExistingDebitAccountInMapMatchingGLAccount(loanProductId, paymentTypeId, debitAccountType,
|
||||
accountMapForDebit);
|
||||
if (accountMapForDebit.containsKey(accountDebit)) {
|
||||
BigDecimal amount = accountMapForDebit.get(accountDebit).add(transactionPartAmount);
|
||||
accountMapForDebit.put(accountDebit, amount);
|
||||
} else {
|
||||
accountMapForDebit.put(accountDebit, transactionPartAmount);
|
||||
}
|
||||
glAccountBalanceHolder.addToCredit(accountCredit, transactionPartAmount);
|
||||
// Resolve Debit
|
||||
GLAccount accountDebit = this.helper.getLinkedGLAccountForLoanProduct(loanProductId, debitAccountType, paymentTypeId);
|
||||
glAccountBalanceHolder.addToDebit(accountDebit, transactionPartAmount);
|
||||
}
|
||||
|
||||
private Integer returnExistingDebitAccountInMapMatchingGLAccount(Long loanProductId, Long paymentTypeId, Integer accountType,
|
||||
@@ -568,9 +557,7 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
|
||||
final Long paymentTypeId = loanTransactionDTO.getPaymentTypeId();
|
||||
final boolean isReversal = loanTransactionDTO.isReversed();
|
||||
|
||||
Map<GLAccount, BigDecimal> accountMapForCredit = new LinkedHashMap<>();
|
||||
Map<Integer, BigDecimal> accountMapForDebit = new LinkedHashMap<>();
|
||||
|
||||
GLAccountBalanceHolder glAccountBalanceHolder = new GLAccountBalanceHolder();
|
||||
BigDecimal totalDebitAmount = new BigDecimal(0);
|
||||
|
||||
// principal payment
|
||||
@@ -580,35 +567,35 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
|
||||
if (isMarkedFraud) {
|
||||
populateCreditDebitMaps(loanProductId, principalAmount, paymentTypeId,
|
||||
CashAccountsForLoan.CHARGE_OFF_FRAUD_EXPENSE.getValue(), CashAccountsForLoan.FUND_SOURCE.getValue(),
|
||||
accountMapForCredit, accountMapForDebit);
|
||||
glAccountBalanceHolder);
|
||||
} else {
|
||||
populateCreditDebitMaps(loanProductId, principalAmount, paymentTypeId,
|
||||
CashAccountsForLoan.CHARGE_OFF_EXPENSE.getValue(), CashAccountsForLoan.FUND_SOURCE.getValue(),
|
||||
accountMapForCredit, accountMapForDebit);
|
||||
glAccountBalanceHolder);
|
||||
}
|
||||
} else if (loanTransactionDTO.getTransactionType().isPayoutRefund()) {
|
||||
if (isMarkedFraud) {
|
||||
populateCreditDebitMaps(loanProductId, principalAmount, paymentTypeId,
|
||||
CashAccountsForLoan.CHARGE_OFF_FRAUD_EXPENSE.getValue(), CashAccountsForLoan.FUND_SOURCE.getValue(),
|
||||
accountMapForCredit, accountMapForDebit);
|
||||
glAccountBalanceHolder);
|
||||
|
||||
} else {
|
||||
populateCreditDebitMaps(loanProductId, principalAmount, paymentTypeId,
|
||||
CashAccountsForLoan.CHARGE_OFF_EXPENSE.getValue(), CashAccountsForLoan.FUND_SOURCE.getValue(),
|
||||
accountMapForCredit, accountMapForDebit);
|
||||
glAccountBalanceHolder);
|
||||
}
|
||||
|
||||
} else if (loanTransactionDTO.getTransactionType().isGoodwillCredit()) {
|
||||
populateCreditDebitMaps(loanProductId, principalAmount, paymentTypeId, CashAccountsForLoan.INCOME_FROM_RECOVERY.getValue(),
|
||||
CashAccountsForLoan.GOODWILL_CREDIT.getValue(), accountMapForCredit, accountMapForDebit);
|
||||
CashAccountsForLoan.GOODWILL_CREDIT.getValue(), glAccountBalanceHolder);
|
||||
|
||||
} else if (loanTransactionDTO.getTransactionType().isRepayment()) {
|
||||
populateCreditDebitMaps(loanProductId, principalAmount, paymentTypeId, CashAccountsForLoan.INCOME_FROM_RECOVERY.getValue(),
|
||||
CashAccountsForLoan.FUND_SOURCE.getValue(), accountMapForCredit, accountMapForDebit);
|
||||
CashAccountsForLoan.FUND_SOURCE.getValue(), glAccountBalanceHolder);
|
||||
|
||||
} else {
|
||||
populateCreditDebitMaps(loanProductId, principalAmount, paymentTypeId, CashAccountsForLoan.LOAN_PORTFOLIO.getValue(),
|
||||
CashAccountsForLoan.FUND_SOURCE.getValue(), accountMapForCredit, accountMapForDebit);
|
||||
CashAccountsForLoan.FUND_SOURCE.getValue(), glAccountBalanceHolder);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -619,23 +606,23 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
|
||||
if (loanTransactionDTO.getTransactionType().isMerchantIssuedRefund()) {
|
||||
populateCreditDebitMaps(loanProductId, interestAmount, paymentTypeId,
|
||||
CashAccountsForLoan.INCOME_FROM_CHARGE_OFF_INTEREST.getValue(), CashAccountsForLoan.FUND_SOURCE.getValue(),
|
||||
accountMapForCredit, accountMapForDebit);
|
||||
glAccountBalanceHolder);
|
||||
|
||||
} else if (loanTransactionDTO.getTransactionType().isPayoutRefund()) {
|
||||
populateCreditDebitMaps(loanProductId, interestAmount, paymentTypeId,
|
||||
CashAccountsForLoan.INCOME_FROM_CHARGE_OFF_INTEREST.getValue(), CashAccountsForLoan.FUND_SOURCE.getValue(),
|
||||
accountMapForCredit, accountMapForDebit);
|
||||
glAccountBalanceHolder);
|
||||
|
||||
} else if (loanTransactionDTO.getTransactionType().isGoodwillCredit()) {
|
||||
populateCreditDebitMaps(loanProductId, interestAmount, paymentTypeId, CashAccountsForLoan.INCOME_FROM_RECOVERY.getValue(),
|
||||
CashAccountsForLoan.INCOME_FROM_GOODWILL_CREDIT_INTEREST.getValue(), accountMapForCredit, accountMapForDebit);
|
||||
CashAccountsForLoan.INCOME_FROM_GOODWILL_CREDIT_INTEREST.getValue(), glAccountBalanceHolder);
|
||||
} else if (loanTransactionDTO.getTransactionType().isRepayment()) {
|
||||
populateCreditDebitMaps(loanProductId, interestAmount, paymentTypeId, CashAccountsForLoan.INCOME_FROM_RECOVERY.getValue(),
|
||||
CashAccountsForLoan.FUND_SOURCE.getValue(), accountMapForCredit, accountMapForDebit);
|
||||
CashAccountsForLoan.FUND_SOURCE.getValue(), glAccountBalanceHolder);
|
||||
|
||||
} else {
|
||||
populateCreditDebitMaps(loanProductId, interestAmount, paymentTypeId, CashAccountsForLoan.INTEREST_ON_LOANS.getValue(),
|
||||
CashAccountsForLoan.FUND_SOURCE.getValue(), accountMapForCredit, accountMapForDebit);
|
||||
CashAccountsForLoan.FUND_SOURCE.getValue(), glAccountBalanceHolder);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -646,24 +633,24 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
|
||||
if (loanTransactionDTO.getTransactionType().isMerchantIssuedRefund()) {
|
||||
populateCreditDebitMaps(loanProductId, feesAmount, paymentTypeId,
|
||||
CashAccountsForLoan.INCOME_FROM_CHARGE_OFF_FEES.getValue(), CashAccountsForLoan.FUND_SOURCE.getValue(),
|
||||
accountMapForCredit, accountMapForDebit);
|
||||
glAccountBalanceHolder);
|
||||
|
||||
} else if (loanTransactionDTO.getTransactionType().isPayoutRefund()) {
|
||||
populateCreditDebitMaps(loanProductId, feesAmount, paymentTypeId,
|
||||
CashAccountsForLoan.INCOME_FROM_CHARGE_OFF_FEES.getValue(), CashAccountsForLoan.FUND_SOURCE.getValue(),
|
||||
accountMapForCredit, accountMapForDebit);
|
||||
glAccountBalanceHolder);
|
||||
|
||||
} else if (loanTransactionDTO.getTransactionType().isGoodwillCredit()) {
|
||||
populateCreditDebitMaps(loanProductId, feesAmount, paymentTypeId, CashAccountsForLoan.INCOME_FROM_RECOVERY.getValue(),
|
||||
CashAccountsForLoan.INCOME_FROM_GOODWILL_CREDIT_FEES.getValue(), accountMapForCredit, accountMapForDebit);
|
||||
CashAccountsForLoan.INCOME_FROM_GOODWILL_CREDIT_FEES.getValue(), glAccountBalanceHolder);
|
||||
|
||||
} else if (loanTransactionDTO.getTransactionType().isRepayment()) {
|
||||
populateCreditDebitMaps(loanProductId, feesAmount, paymentTypeId, CashAccountsForLoan.INCOME_FROM_RECOVERY.getValue(),
|
||||
CashAccountsForLoan.FUND_SOURCE.getValue(), accountMapForCredit, accountMapForDebit);
|
||||
CashAccountsForLoan.FUND_SOURCE.getValue(), glAccountBalanceHolder);
|
||||
|
||||
} else {
|
||||
populateCreditDebitMaps(loanProductId, feesAmount, paymentTypeId, CashAccountsForLoan.INCOME_FROM_FEES.getValue(),
|
||||
CashAccountsForLoan.FUND_SOURCE.getValue(), accountMapForCredit, accountMapForDebit);
|
||||
CashAccountsForLoan.FUND_SOURCE.getValue(), glAccountBalanceHolder);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -674,24 +661,24 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
|
||||
if (loanTransactionDTO.getTransactionType().isMerchantIssuedRefund()) {
|
||||
populateCreditDebitMaps(loanProductId, penaltiesAmount, paymentTypeId,
|
||||
CashAccountsForLoan.INCOME_FROM_CHARGE_OFF_PENALTY.getValue(), CashAccountsForLoan.FUND_SOURCE.getValue(),
|
||||
accountMapForCredit, accountMapForDebit);
|
||||
glAccountBalanceHolder);
|
||||
|
||||
} else if (loanTransactionDTO.getTransactionType().isPayoutRefund()) {
|
||||
populateCreditDebitMaps(loanProductId, penaltiesAmount, paymentTypeId,
|
||||
CashAccountsForLoan.INCOME_FROM_CHARGE_OFF_PENALTY.getValue(), CashAccountsForLoan.FUND_SOURCE.getValue(),
|
||||
accountMapForCredit, accountMapForDebit);
|
||||
glAccountBalanceHolder);
|
||||
|
||||
} else if (loanTransactionDTO.getTransactionType().isGoodwillCredit()) {
|
||||
populateCreditDebitMaps(loanProductId, penaltiesAmount, paymentTypeId, CashAccountsForLoan.INCOME_FROM_RECOVERY.getValue(),
|
||||
CashAccountsForLoan.INCOME_FROM_GOODWILL_CREDIT_PENALTY.getValue(), accountMapForCredit, accountMapForDebit);
|
||||
CashAccountsForLoan.INCOME_FROM_GOODWILL_CREDIT_PENALTY.getValue(), glAccountBalanceHolder);
|
||||
|
||||
} else if (loanTransactionDTO.getTransactionType().isRepayment()) {
|
||||
populateCreditDebitMaps(loanProductId, penaltiesAmount, paymentTypeId, CashAccountsForLoan.INCOME_FROM_RECOVERY.getValue(),
|
||||
CashAccountsForLoan.FUND_SOURCE.getValue(), accountMapForCredit, accountMapForDebit);
|
||||
CashAccountsForLoan.FUND_SOURCE.getValue(), glAccountBalanceHolder);
|
||||
|
||||
} else {
|
||||
populateCreditDebitMaps(loanProductId, penaltiesAmount, paymentTypeId, CashAccountsForLoan.INCOME_FROM_PENALTIES.getValue(),
|
||||
CashAccountsForLoan.FUND_SOURCE.getValue(), accountMapForCredit, accountMapForDebit);
|
||||
CashAccountsForLoan.FUND_SOURCE.getValue(), glAccountBalanceHolder);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -701,26 +688,27 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
|
||||
totalDebitAmount = totalDebitAmount.add(overPaymentAmount);
|
||||
if (loanTransactionDTO.getTransactionType().isMerchantIssuedRefund()) {
|
||||
populateCreditDebitMaps(loanProductId, overPaymentAmount, paymentTypeId, CashAccountsForLoan.OVERPAYMENT.getValue(),
|
||||
CashAccountsForLoan.FUND_SOURCE.getValue(), accountMapForCredit, accountMapForDebit);
|
||||
CashAccountsForLoan.FUND_SOURCE.getValue(), glAccountBalanceHolder);
|
||||
|
||||
} else if (loanTransactionDTO.getTransactionType().isPayoutRefund()) {
|
||||
populateCreditDebitMaps(loanProductId, overPaymentAmount, paymentTypeId, CashAccountsForLoan.OVERPAYMENT.getValue(),
|
||||
CashAccountsForLoan.FUND_SOURCE.getValue(), accountMapForCredit, accountMapForDebit);
|
||||
CashAccountsForLoan.FUND_SOURCE.getValue(), glAccountBalanceHolder);
|
||||
|
||||
} else if (loanTransactionDTO.getTransactionType().isGoodwillCredit()) {
|
||||
populateCreditDebitMaps(loanProductId, overPaymentAmount, paymentTypeId, CashAccountsForLoan.OVERPAYMENT.getValue(),
|
||||
CashAccountsForLoan.GOODWILL_CREDIT.getValue(), accountMapForCredit, accountMapForDebit);
|
||||
CashAccountsForLoan.GOODWILL_CREDIT.getValue(), glAccountBalanceHolder);
|
||||
} else {
|
||||
populateCreditDebitMaps(loanProductId, overPaymentAmount, paymentTypeId, CashAccountsForLoan.OVERPAYMENT.getValue(),
|
||||
CashAccountsForLoan.FUND_SOURCE.getValue(), accountMapForCredit, accountMapForDebit);
|
||||
CashAccountsForLoan.FUND_SOURCE.getValue(), glAccountBalanceHolder);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// create credit entries
|
||||
for (Map.Entry<GLAccount, BigDecimal> creditEntry : accountMapForCredit.entrySet()) {
|
||||
for (Map.Entry<Long, BigDecimal> creditEntry : glAccountBalanceHolder.getCreditBalances().entrySet()) {
|
||||
GLAccount glAccount = glAccountBalanceHolder.getGlAccountMap().get(creditEntry.getKey());
|
||||
this.helper.createCreditJournalEntryOrReversalForLoan(office, currencyCode, loanId, transactionId, transactionDate,
|
||||
creditEntry.getValue(), isReversal, creditEntry.getKey());
|
||||
creditEntry.getValue(), isReversal, glAccount);
|
||||
}
|
||||
|
||||
/*** create a single debit entry (or reversal) for the entire amount **/
|
||||
@@ -732,9 +720,10 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
|
||||
loanProductId, paymentTypeId, loanId, transactionId, transactionDate, totalDebitAmount, isReversal);
|
||||
} else {
|
||||
// create debit entries
|
||||
for (Map.Entry<Integer, BigDecimal> debitEntry : accountMapForDebit.entrySet()) {
|
||||
this.helper.createDebitJournalEntryOrReversalForLoan(office, currencyCode, debitEntry.getKey().intValue(), loanProductId,
|
||||
paymentTypeId, loanId, transactionId, transactionDate, debitEntry.getValue(), isReversal);
|
||||
for (Map.Entry<Long, BigDecimal> debitEntry : glAccountBalanceHolder.getDebitBalances().entrySet()) {
|
||||
GLAccount glAccount = glAccountBalanceHolder.getGlAccountMap().get(debitEntry.getKey());
|
||||
this.helper.createDebitJournalEntryOrReversalForLoan(office, currencyCode, loanId, transactionId, transactionDate,
|
||||
debitEntry.getValue(), isReversal, glAccount);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -162,7 +162,7 @@ public class LoanProductsApiResource {
|
||||
@Operation(summary = "Create a Loan Product", description = "Depending of the Accounting Rule (accountingRule) selected, additional fields with details of the appropriate Ledger Account identifiers would need to be passed in.\n"
|
||||
+ "\n" + "Refer MifosX Accounting Specs Draft for more details regarding the significance of the selected accounting rule\n\n"
|
||||
+ "Mandatory Fields: name, shortName, currencyCode, digitsAfterDecimal, inMultiplesOf, principal, numberOfRepayments, repaymentEvery, repaymentFrequencyType, interestRatePerPeriod, interestRateFrequencyType, amortizationType, interestType, interestCalculationPeriodType, transactionProcessingStrategyCode, accountingRule, isInterestRecalculationEnabled, daysInYearType, daysInMonthType\n\n"
|
||||
+ "Optional Fields: inArrearsTolerance, graceOnPrincipalPayment, graceOnInterestPayment, graceOnInterestCharged, graceOnArrearsAgeing, charges, paymentChannelToFundSourceMappings, feeToIncomeAccountMappings, penaltyToIncomeAccountMappings, chargeOffReasonsToExpenseMappings, includeInBorrowerCycle, useBorrowerCycle,principalVariationsForBorrowerCycle, numberOfRepaymentVariationsForBorrowerCycle, interestRateVariationsForBorrowerCycle, multiDisburseLoan,maxTrancheCount, outstandingLoanBalance,overdueDaysForNPA,holdGuaranteeFunds, principalThresholdForLastInstalment, accountMovesOutOfNPAOnlyOnArrearsCompletion, canDefineInstallmentAmount, installmentAmountInMultiplesOf, allowAttributeOverrides, allowPartialPeriodInterestCalcualtion,dueDaysForRepaymentEvent,overDueDaysForRepaymentEvent,enableDownPayment,disbursedAmountPercentageDownPayment,enableAutoRepaymentForDownPayment,repaymentStartDateType\n\n"
|
||||
+ "Optional Fields: inArrearsTolerance, graceOnPrincipalPayment, graceOnInterestPayment, graceOnInterestCharged, graceOnArrearsAgeing, charges, paymentChannelToFundSourceMappings, feeToIncomeAccountMappings, penaltyToIncomeAccountMappings, chargeOffReasonToExpenseAccountMappings, includeInBorrowerCycle, useBorrowerCycle,principalVariationsForBorrowerCycle, numberOfRepaymentVariationsForBorrowerCycle, interestRateVariationsForBorrowerCycle, multiDisburseLoan,maxTrancheCount, outstandingLoanBalance,overdueDaysForNPA,holdGuaranteeFunds, principalThresholdForLastInstalment, accountMovesOutOfNPAOnlyOnArrearsCompletion, canDefineInstallmentAmount, installmentAmountInMultiplesOf, allowAttributeOverrides, allowPartialPeriodInterestCalcualtion,dueDaysForRepaymentEvent,overDueDaysForRepaymentEvent,enableDownPayment,disbursedAmountPercentageDownPayment,enableAutoRepaymentForDownPayment,repaymentStartDateType\n\n"
|
||||
+ "Additional Mandatory Fields for Cash(2) based accounting: fundSourceAccountId, loanPortfolioAccountId, interestOnLoanAccountId, incomeFromFeeAccountId, incomeFromPenaltyAccountId, writeOffAccountId, transfersInSuspenseAccountId, overpaymentLiabilityAccountId\n\n"
|
||||
+ "Additional Mandatory Fields for periodic (3) and upfront (4)accrual accounting: fundSourceAccountId, loanPortfolioAccountId, interestOnLoanAccountId, incomeFromFeeAccountId, incomeFromPenaltyAccountId, writeOffAccountId, receivableInterestAccountId, receivableFeeAccountId, receivablePenaltyAccountId, transfersInSuspenseAccountId, overpaymentLiabilityAccountId\n\n"
|
||||
+ "Additional Mandatory Fields if interest recalculation is enabled(true): interestRecalculationCompoundingMethod, rescheduleStrategyMethod, recalculationRestFrequencyType\n\n"
|
||||
|
||||
+2
-2
@@ -144,7 +144,7 @@ public final class LoanProductDataValidator {
|
||||
LoanProductAccountingParams.INCOME_FROM_GOODWILL_CREDIT_INTEREST.getValue(),
|
||||
LoanProductAccountingParams.INCOME_FROM_GOODWILL_CREDIT_FEES.getValue(),
|
||||
LoanProductAccountingParams.INCOME_FROM_GOODWILL_CREDIT_PENALTY.getValue(),
|
||||
LoanProductAccountingParams.CHARGE_OFF_REASONS_TO_EXPENSE.getValue(),
|
||||
LoanProductAccountingParams.CHARGE_OFF_REASON_TO_EXPENSE_ACCOUNT_MAPPINGS.getValue(),
|
||||
LoanProductAccountingParams.EXPENSE_GL_ACCOUNT_ID.getValue(),
|
||||
LoanProductAccountingParams.CHARGE_OFF_REASON_CODE_VALUE_ID.getValue(), LoanProductConstants.USE_BORROWER_CYCLE_PARAMETER_NAME,
|
||||
LoanProductConstants.PRINCIPAL_VARIATIONS_FOR_BORROWER_CYCLE_PARAMETER_NAME,
|
||||
@@ -1992,7 +1992,7 @@ public final class LoanProductDataValidator {
|
||||
}
|
||||
|
||||
private void validateChargeOffToExpenseMappings(final DataValidatorBuilder baseDataValidator, final JsonElement element) {
|
||||
String parameterName = LoanProductAccountingParams.CHARGE_OFF_REASONS_TO_EXPENSE.getValue();
|
||||
String parameterName = LoanProductAccountingParams.CHARGE_OFF_REASON_TO_EXPENSE_ACCOUNT_MAPPINGS.getValue();
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(parameterName, element)) {
|
||||
final JsonArray chargeOffToExpenseMappingArray = this.fromApiJsonHelper.extractJsonArrayNamed(parameterName, element);
|
||||
|
||||
Reference in New Issue
Block a user