FINERACT-2181: Capitalized Income and Buy Down Fees accounting values are still displayed on loan product after feature disabled

This commit is contained in:
Jose Alberto Hernandez
2025-07-16 12:06:52 +02:00
committed by Adam Saghy
parent 9e15e459f0
commit e2f481f351
6 changed files with 89 additions and 29 deletions
@@ -369,7 +369,8 @@ public class ProductToGLAccountMappingWritePlatformServiceImpl implements Produc
@Override
@Transactional
public Map<String, Object> updateLoanProductToGLAccountMapping(final Long loanProductId, final JsonCommand command,
final boolean accountingRuleChanged, final AccountingRuleType accountingRuleType) {
final boolean accountingRuleChanged, final AccountingRuleType accountingRuleType, final boolean enableIncomeCapitalization,
final boolean enableBuyDownFee) {
/***
* Variable tracks all accounting mapping properties that have been updated
***/
@@ -389,7 +390,7 @@ public class ProductToGLAccountMappingWritePlatformServiceImpl implements Produc
} /*** else examine and update individual changes ***/
else {
this.loanProductToGLAccountMappingHelper.handleChangesToLoanProductToGLAccountMappings(loanProductId, changes, element,
accountingRuleType);
accountingRuleType, enableIncomeCapitalization, enableBuyDownFee);
this.loanProductToGLAccountMappingHelper.updatePaymentChannelToFundSourceMappings(command, element, loanProductId, changes);
this.loanProductToGLAccountMappingHelper.updateChargesToIncomeAccountMappings(command, element, loanProductId, changes);
this.loanProductToGLAccountMappingHelper.updateChargeOffReasonToExpenseAccountMappings(command, element, loanProductId,
@@ -258,10 +258,20 @@ public class LoanProductWritePlatformServiceJpaRepositoryImpl implements LoanPro
}
}
boolean enableIncomeCapitalization = product.getLoanProductRelatedDetail().isEnableIncomeCapitalization();
if (changes.containsKey(LoanProductConstants.ENABLE_INCOME_CAPITALIZATION_PARAM_NAME)) {
enableIncomeCapitalization = (boolean) changes.get(LoanProductConstants.ENABLE_INCOME_CAPITALIZATION_PARAM_NAME);
}
boolean enableBuyDownFee = product.getLoanProductRelatedDetail().isEnableBuyDownFee();
if (changes.containsKey(LoanProductConstants.ENABLE_BUY_DOWN_FEE_PARAM_NAME)) {
enableBuyDownFee = (boolean) changes.get(LoanProductConstants.ENABLE_BUY_DOWN_FEE_PARAM_NAME);
}
// accounting related changes
final boolean accountingTypeChanged = changes.containsKey("accountingRule");
final Map<String, Object> accountingMappingChanges = this.accountMappingWritePlatformService
.updateLoanProductToGLAccountMapping(product.getId(), command, accountingTypeChanged, product.getAccountingRule());
.updateLoanProductToGLAccountMapping(product.getId(), command, accountingTypeChanged, product.getAccountingRule(),
enableIncomeCapitalization, enableBuyDownFee);
changes.putAll(accountingMappingChanges);
if (changes.containsKey(LoanProductConstants.RATES_PARAM_NAME)) {