From e94e6c421ad64dd6a3ecd1e41d42582a2330ea70 Mon Sep 17 00:00:00 2001 From: Adam Saghy Date: Thu, 19 Dec 2024 15:05:50 +0100 Subject: [PATCH] FINERACT-1806: Unify Charge-off reason mapping fields --- .../ProductToGLAccountMappingReadPlatformServiceImpl.java | 2 +- .../fineract/accounting/common/AccountingConstants.java | 2 +- .../data/ChargeOffReasonToGLAccountMapper.java | 2 +- .../loanproduct/api/LoanProductsApiResourceSwagger.java | 4 ++-- .../LoanProductChargeOffReasonMappingsTest.java | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/fineract-accounting/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/ProductToGLAccountMappingReadPlatformServiceImpl.java b/fineract-accounting/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/ProductToGLAccountMappingReadPlatformServiceImpl.java index 9b19c65ab8..131365725b 100644 --- a/fineract-accounting/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/ProductToGLAccountMappingReadPlatformServiceImpl.java +++ b/fineract-accounting/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/ProductToGLAccountMappingReadPlatformServiceImpl.java @@ -285,7 +285,7 @@ private List fetchChargeOffReasonMappings(fina .description(codeDescription).position(orderPosition).active(isActive).mandatory(isMandatory).build(); final ChargeOffReasonToGLAccountMapper chargeOffReasonToGLAccountMapper = new ChargeOffReasonToGLAccountMapper() - .setChargeOffReasonCodeValue(chargeOffReasonsCodeValue).setChargeOffExpenseAccount(chargeOffExpenseAccount); + .setChargeOffReasonCodeValue(chargeOffReasonsCodeValue).setExpenseAccount(chargeOffExpenseAccount); chargeOffReasonToGLAccountMappers.add(chargeOffReasonToGLAccountMapper); } return chargeOffReasonToGLAccountMappers; diff --git a/fineract-core/src/main/java/org/apache/fineract/accounting/common/AccountingConstants.java b/fineract-core/src/main/java/org/apache/fineract/accounting/common/AccountingConstants.java index 7976659c39..ac6dbf5d95 100644 --- a/fineract-core/src/main/java/org/apache/fineract/accounting/common/AccountingConstants.java +++ b/fineract-core/src/main/java/org/apache/fineract/accounting/common/AccountingConstants.java @@ -174,7 +174,7 @@ public enum LoanProductAccountingParams { INCOME_FROM_GOODWILL_CREDIT_FEES("incomeFromGoodwillCreditFeesAccountId"), // INCOME_FROM_GOODWILL_CREDIT_PENALTY("incomeFromGoodwillCreditPenaltyAccountId"), // CHARGE_OFF_REASON_TO_EXPENSE_ACCOUNT_MAPPINGS("chargeOffReasonToExpenseAccountMappings"), // - EXPENSE_GL_ACCOUNT_ID("expenseGLAccountId"), // + EXPENSE_GL_ACCOUNT_ID("expenseAccountId"), // CHARGE_OFF_REASON_CODE_VALUE_ID("chargeOffReasonCodeValueId"); // private final String value; diff --git a/fineract-core/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/data/ChargeOffReasonToGLAccountMapper.java b/fineract-core/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/data/ChargeOffReasonToGLAccountMapper.java index f95e933f2b..05f61f5b49 100644 --- a/fineract-core/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/data/ChargeOffReasonToGLAccountMapper.java +++ b/fineract-core/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/data/ChargeOffReasonToGLAccountMapper.java @@ -32,5 +32,5 @@ public class ChargeOffReasonToGLAccountMapper implements Serializable { private static final long serialVersionUID = 1L; private CodeValueData chargeOffReasonCodeValue; - private GLAccountData chargeOffExpenseAccount; + private GLAccountData expenseAccount; } diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/api/LoanProductsApiResourceSwagger.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/api/LoanProductsApiResourceSwagger.java index 76e7c177a9..c4ea55c376 100644 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/api/LoanProductsApiResourceSwagger.java +++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/api/LoanProductsApiResourceSwagger.java @@ -333,7 +333,7 @@ private PostChargeOffReasonToExpenseAccountMappings() {} @Schema(example = "1") public Long chargeOffReasonCodeValueId; @Schema(example = "1") - public Long expenseGLAccountId; + public Long expenseAccountId; } } @@ -1234,7 +1234,7 @@ static final class GetChargeOffReasonToExpenseAccountMappings { private GetChargeOffReasonToExpenseAccountMappings() {} public GetCodeValueData chargeOffReasonCodeValue; - public GetGLAccountData chargeOffExpenseAccount; + public GetGLAccountData expenseAccount; static final class GetCodeValueData { diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanProductChargeOffReasonMappingsTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanProductChargeOffReasonMappingsTest.java index 84d518adc0..e7e7a2d4e1 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanProductChargeOffReasonMappingsTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanProductChargeOffReasonMappingsTest.java @@ -59,7 +59,7 @@ public void testCreateAndUpdateLoanProductWithValidChargeOffReason() { GetLoanProductsProductIdResponse loanProductDetails = loanTransactionHelper.getLoanProduct(localLoanProductId.intValue()); Assertions.assertEquals(expenseAccount.getAccountID().longValue(), - loanProductDetails.getChargeOffReasonToExpenseAccountMappings().get(0).getChargeOffExpenseAccount().getId()); + loanProductDetails.getChargeOffReasonToExpenseAccountMappings().get(0).getExpenseAccount().getId()); Assertions.assertEquals(Long.valueOf(chargeOffReasons), loanProductDetails.getChargeOffReasonToExpenseAccountMappings().get(0).getChargeOffReasonCodeValue().getId()); @@ -71,7 +71,7 @@ public void testCreateAndUpdateLoanProductWithValidChargeOffReason() { loanProductDetails = loanTransactionHelper.getLoanProduct(localLoanProductId.intValue()); Assertions.assertEquals(otherExpenseAccount.getAccountID().longValue(), - loanProductDetails.getChargeOffReasonToExpenseAccountMappings().get(0).getChargeOffExpenseAccount().getId()); + loanProductDetails.getChargeOffReasonToExpenseAccountMappings().get(0).getExpenseAccount().getId()); Assertions.assertEquals(Long.valueOf(chargeOffReasons), loanProductDetails.getChargeOffReasonToExpenseAccountMappings().get(0).getChargeOffReasonCodeValue().getId()); }); @@ -232,7 +232,7 @@ private static List createPostCharg List chargeOffReasonToExpenseAccountMappings = new ArrayList<>(); PostChargeOffReasonToExpenseAccountMappings chargeOffReasonToExpenseAccountMapping = new PostChargeOffReasonToExpenseAccountMappings(); chargeOffReasonToExpenseAccountMapping.setChargeOffReasonCodeValueId(chargeOffReasonId); - chargeOffReasonToExpenseAccountMapping.setExpenseGLAccountId(glAccountId); + chargeOffReasonToExpenseAccountMapping.setExpenseAccountId(glAccountId); chargeOffReasonToExpenseAccountMappings.add(chargeOffReasonToExpenseAccountMapping); return chargeOffReasonToExpenseAccountMappings; }