FINERACT-2197: Introduce a new type of ACTUAL during calculation of days in year, update
This commit is contained in:
committed by
Adam Saghy
parent
3f2079566c
commit
f3bb66f209
+36
-67
@@ -350,6 +350,30 @@ final class LoanProductsApiResourceSwagger {
|
|||||||
public Long resourceId;
|
public Long resourceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final class GetLoanProductsDaysInMonthType {
|
||||||
|
|
||||||
|
private GetLoanProductsDaysInMonthType() {}
|
||||||
|
|
||||||
|
@Schema(example = "1")
|
||||||
|
public Long id;
|
||||||
|
@Schema(example = "DaysInMonthType.actual")
|
||||||
|
public String code;
|
||||||
|
@Schema(example = "Actual")
|
||||||
|
public String description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final class GetLoanProductsDaysInYearType {
|
||||||
|
|
||||||
|
private GetLoanProductsDaysInYearType() {}
|
||||||
|
|
||||||
|
@Schema(example = "1")
|
||||||
|
public Long id;
|
||||||
|
@Schema(example = "DaysInYearType.actual")
|
||||||
|
public String code;
|
||||||
|
@Schema(example = "Actual")
|
||||||
|
public String description;
|
||||||
|
}
|
||||||
|
|
||||||
@Schema(description = "GetLoanProductsResponse")
|
@Schema(description = "GetLoanProductsResponse")
|
||||||
public static final class GetLoanProductsResponse {
|
public static final class GetLoanProductsResponse {
|
||||||
|
|
||||||
@@ -435,30 +459,6 @@ final class LoanProductsApiResourceSwagger {
|
|||||||
public String description;
|
public String description;
|
||||||
}
|
}
|
||||||
|
|
||||||
static final class GetLoansProductsDaysInMonthType {
|
|
||||||
|
|
||||||
private GetLoansProductsDaysInMonthType() {}
|
|
||||||
|
|
||||||
@Schema(example = "30")
|
|
||||||
public Long id;
|
|
||||||
@Schema(example = "DaysInMonthType.days360")
|
|
||||||
public String code;
|
|
||||||
@Schema(example = "30 Days")
|
|
||||||
public String description;
|
|
||||||
}
|
|
||||||
|
|
||||||
static final class GetLoansProductsDaysInYearType {
|
|
||||||
|
|
||||||
private GetLoansProductsDaysInYearType() {}
|
|
||||||
|
|
||||||
@Schema(example = "360")
|
|
||||||
public Long id;
|
|
||||||
@Schema(example = "DaysInYearType.days360")
|
|
||||||
public String code;
|
|
||||||
@Schema(example = "360 Days")
|
|
||||||
public String description;
|
|
||||||
}
|
|
||||||
|
|
||||||
static final class GetLoanProductsDaysInYearCustomStrategy {
|
static final class GetLoanProductsDaysInYearCustomStrategy {
|
||||||
|
|
||||||
private GetLoanProductsDaysInYearCustomStrategy() {}
|
private GetLoanProductsDaysInYearCustomStrategy() {}
|
||||||
@@ -626,8 +626,8 @@ final class LoanProductsApiResourceSwagger {
|
|||||||
public List<Integer> interestRateVariationsForBorrowerCycle;
|
public List<Integer> interestRateVariationsForBorrowerCycle;
|
||||||
@Schema(example = "[]")
|
@Schema(example = "[]")
|
||||||
public List<Integer> numberOfRepaymentVariationsForBorrowerCycle;
|
public List<Integer> numberOfRepaymentVariationsForBorrowerCycle;
|
||||||
public GetLoansProductsDaysInMonthType daysInMonthType;
|
public GetLoanProductsDaysInMonthType daysInMonthType;
|
||||||
public GetLoansProductsDaysInYearType daysInYearType;
|
public GetLoanProductsDaysInYearType daysInYearType;
|
||||||
public GetLoanProductsDaysInYearCustomStrategy daysInYearCustomStrategy;
|
public GetLoanProductsDaysInYearCustomStrategy daysInYearCustomStrategy;
|
||||||
@Schema(example = "true")
|
@Schema(example = "true")
|
||||||
public Boolean isInterestRecalculationEnabled;
|
public Boolean isInterestRecalculationEnabled;
|
||||||
@@ -713,42 +713,6 @@ final class LoanProductsApiResourceSwagger {
|
|||||||
public String description;
|
public String description;
|
||||||
}
|
}
|
||||||
|
|
||||||
static final class GetLoansProductsDaysInMonthTemplateType {
|
|
||||||
|
|
||||||
private GetLoansProductsDaysInMonthTemplateType() {}
|
|
||||||
|
|
||||||
@Schema(example = "1")
|
|
||||||
public Long id;
|
|
||||||
@Schema(example = "DaysInMonthType.actual")
|
|
||||||
public String code;
|
|
||||||
@Schema(example = "Actual")
|
|
||||||
public String description;
|
|
||||||
}
|
|
||||||
|
|
||||||
static final class GetLoanProductsDaysInYearTemplateType {
|
|
||||||
|
|
||||||
private GetLoanProductsDaysInYearTemplateType() {}
|
|
||||||
|
|
||||||
@Schema(example = "1")
|
|
||||||
public Long id;
|
|
||||||
@Schema(example = "DaysInYearType.actual")
|
|
||||||
public String code;
|
|
||||||
@Schema(example = "Actual")
|
|
||||||
public String description;
|
|
||||||
}
|
|
||||||
|
|
||||||
static final class GetLoanProductsDaysInYearCustomStrategyTemplateType {
|
|
||||||
|
|
||||||
private GetLoanProductsDaysInYearCustomStrategyTemplateType() {}
|
|
||||||
|
|
||||||
@Schema(example = "FULL_LEAP_YEAR")
|
|
||||||
public String id;
|
|
||||||
@Schema(example = "DaysInYearCustomStrategyType.fullLeapYear")
|
|
||||||
public String code;
|
|
||||||
@Schema(example = "Full Leap Year")
|
|
||||||
public String description;
|
|
||||||
}
|
|
||||||
|
|
||||||
static final class GetLoanProductsInterestRecalculationTemplateData {
|
static final class GetLoanProductsInterestRecalculationTemplateData {
|
||||||
|
|
||||||
private GetLoanProductsInterestRecalculationTemplateData() {}
|
private GetLoanProductsInterestRecalculationTemplateData() {}
|
||||||
@@ -1098,9 +1062,9 @@ final class LoanProductsApiResourceSwagger {
|
|||||||
@Schema(example = "[]")
|
@Schema(example = "[]")
|
||||||
public List<Integer> numberOfRepaymentVariationsForBorrowerCycle;
|
public List<Integer> numberOfRepaymentVariationsForBorrowerCycle;
|
||||||
public GetLoanProductsTemplateResponse.GetLoanProductsAccountingRule accountingRule;
|
public GetLoanProductsTemplateResponse.GetLoanProductsAccountingRule accountingRule;
|
||||||
public GetLoansProductsDaysInMonthTemplateType daysInMonthType;
|
public GetLoanProductsDaysInMonthType daysInMonthType;
|
||||||
public GetLoanProductsDaysInYearTemplateType daysInYearType;
|
public GetLoanProductsDaysInYearType daysInYearType;
|
||||||
public GetLoanProductsDaysInYearCustomStrategyTemplateType daysInYearCustomStrategy;
|
public StringEnumOptionData daysInYearCustomStrategy;
|
||||||
@Schema(example = "false")
|
@Schema(example = "false")
|
||||||
public Boolean isInterestRecalculationEnabled;
|
public Boolean isInterestRecalculationEnabled;
|
||||||
public GetLoanProductsInterestRecalculationTemplateData interestRecalculationData;
|
public GetLoanProductsInterestRecalculationTemplateData interestRecalculationData;
|
||||||
@@ -1117,9 +1081,9 @@ final class LoanProductsApiResourceSwagger {
|
|||||||
public Set<GetLoanProductsResponse.GetLoanProductsAccountingRule> accountingRuleOptions;
|
public Set<GetLoanProductsResponse.GetLoanProductsAccountingRule> accountingRuleOptions;
|
||||||
public GetLoanProductsAccountingMappingOptions accountingMappingOptions;
|
public GetLoanProductsAccountingMappingOptions accountingMappingOptions;
|
||||||
public Set<GetLoanProductsValueConditionTypeOptions> valueConditionTypeOptions;
|
public Set<GetLoanProductsValueConditionTypeOptions> valueConditionTypeOptions;
|
||||||
public Set<GetLoansProductsDaysInMonthTemplateType> daysInMonthTypeOptions;
|
public Set<StringEnumOptionData> daysInMonthTypeOptions;
|
||||||
public Set<GetLoanProductsInterestTemplateType> daysInYearTypeOptions;
|
public Set<GetLoanProductsInterestTemplateType> daysInYearTypeOptions;
|
||||||
public Set<GetLoanProductsDaysInYearCustomStrategyTemplateType> daysInYearTypeCustomStrategyOptions;
|
public Set<StringEnumOptionData> daysInYearTypeCustomStrategyOptions;
|
||||||
public Set<GetLoanProductsResponse.GetLoanProductsInterestRecalculationData.GetLoanProductsInterestRecalculationCompoundingType> interestRecalculationCompoundingTypeOptions;
|
public Set<GetLoanProductsResponse.GetLoanProductsInterestRecalculationData.GetLoanProductsInterestRecalculationCompoundingType> interestRecalculationCompoundingTypeOptions;
|
||||||
public Set<GetLoanProductsResponse.GetLoanProductsInterestRecalculationData.GetLoanProductsRescheduleStrategyType> rescheduleStrategyTypeOptions;
|
public Set<GetLoanProductsResponse.GetLoanProductsInterestRecalculationData.GetLoanProductsRescheduleStrategyType> rescheduleStrategyTypeOptions;
|
||||||
public Set<GetLoanProductsResponse.GetLoanProductsInterestRecalculationData.GetLoanProductsInterestRecalculationCompoundingFrequencyType> interestRecalculationFrequencyTypeOptions;
|
public Set<GetLoanProductsResponse.GetLoanProductsInterestRecalculationData.GetLoanProductsInterestRecalculationCompoundingFrequencyType> interestRecalculationFrequencyTypeOptions;
|
||||||
@@ -1402,6 +1366,9 @@ final class LoanProductsApiResourceSwagger {
|
|||||||
@Schema(example = "[]")
|
@Schema(example = "[]")
|
||||||
public List<Integer> numberOfRepaymentVariationsForBorrowerCycle;
|
public List<Integer> numberOfRepaymentVariationsForBorrowerCycle;
|
||||||
public GetLoanProductsResponse.GetLoanProductsAccountingRule accountingRule;
|
public GetLoanProductsResponse.GetLoanProductsAccountingRule accountingRule;
|
||||||
|
public GetLoanProductsDaysInMonthType daysInMonthType;
|
||||||
|
public GetLoanProductsDaysInYearType daysInYearType;
|
||||||
|
public StringEnumOptionData daysInYearCustomStrategy;
|
||||||
@Schema(example = "false")
|
@Schema(example = "false")
|
||||||
public Boolean canUseForTopup;
|
public Boolean canUseForTopup;
|
||||||
public GetLoanAccountingMappings accountingMappings;
|
public GetLoanAccountingMappings accountingMappings;
|
||||||
@@ -1555,6 +1522,8 @@ final class LoanProductsApiResourceSwagger {
|
|||||||
public Long daysInMonthType;
|
public Long daysInMonthType;
|
||||||
@Schema(example = "1")
|
@Schema(example = "1")
|
||||||
public Long daysInYearType;
|
public Long daysInYearType;
|
||||||
|
@Schema(example = "FULL_LEAP_YEAR")
|
||||||
|
public String daysInYearCustomStrategy;
|
||||||
@Schema(example = "true")
|
@Schema(example = "true")
|
||||||
public Boolean allowPartialPeriodInterestCalcualtion;
|
public Boolean allowPartialPeriodInterestCalcualtion;
|
||||||
@Schema(example = "179")
|
@Schema(example = "179")
|
||||||
|
|||||||
+7
@@ -523,6 +523,13 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
|
|||||||
this.daysInYearType = newValue;
|
this.daysInYearType = newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (command.parameterExists(LoanProductConstants.DAYS_IN_YEAR_CUSTOM_STRATEGY_TYPE_PARAMETER_NAME)) {
|
||||||
|
final DaysInYearCustomStrategyType newValue = DaysInYearCustomStrategyType
|
||||||
|
.valueOf(command.stringValueOfParameterNamed(LoanProductConstants.DAYS_IN_YEAR_CUSTOM_STRATEGY_TYPE_PARAMETER_NAME));
|
||||||
|
actualChanges.put(LoanProductConstants.DAYS_IN_YEAR_CUSTOM_STRATEGY_TYPE_PARAMETER_NAME, newValue.name());
|
||||||
|
this.daysInYearCustomStrategy = newValue;
|
||||||
|
}
|
||||||
|
|
||||||
if (command.isChangeInBooleanParameterNamed(LoanProductConstants.IS_INTEREST_RECALCULATION_ENABLED_PARAMETER_NAME,
|
if (command.isChangeInBooleanParameterNamed(LoanProductConstants.IS_INTEREST_RECALCULATION_ENABLED_PARAMETER_NAME,
|
||||||
this.isInterestRecalculationEnabled)) {
|
this.isInterestRecalculationEnabled)) {
|
||||||
final boolean newValue = command
|
final boolean newValue = command
|
||||||
|
|||||||
+18
@@ -20,7 +20,9 @@ package org.apache.fineract.integrationtests;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import org.apache.fineract.client.models.GetLoanProductsProductIdResponse;
|
||||||
import org.apache.fineract.client.models.PostLoanProductsResponse;
|
import org.apache.fineract.client.models.PostLoanProductsResponse;
|
||||||
|
import org.apache.fineract.client.models.PutLoanProductsProductIdRequest;
|
||||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||||
import org.apache.fineract.integrationtests.common.FineractClientHelper;
|
import org.apache.fineract.integrationtests.common.FineractClientHelper;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
@@ -46,6 +48,22 @@ public class DaysInYearCustomStrategyTest extends BaseLoanIntegrationTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_Update_DaysInYearsCustomStrategy_Value() {
|
||||||
|
PostLoanProductsResponse postLoanProduct = loanProductHelper.createLoanProduct(create4IProgressive().currencyCode("USD")
|
||||||
|
.daysInYearType(DaysInYearType.ACTUAL).daysInYearCustomStrategy(DaysInYearCustomStrategy.FEB_29_PERIOD_ONLY));
|
||||||
|
Assertions.assertNotNull(postLoanProduct.getResourceId());
|
||||||
|
final Long loanProductId = postLoanProduct.getResourceId();
|
||||||
|
|
||||||
|
GetLoanProductsProductIdResponse loanProduct = loanTransactionHelper.getLoanProduct(loanProductId.intValue());
|
||||||
|
Assertions.assertEquals("FEB_29_PERIOD_ONLY", loanProduct.getDaysInYearCustomStrategy().getId());
|
||||||
|
|
||||||
|
loanProductHelper.updateLoanProductById(loanProductId,
|
||||||
|
new PutLoanProductsProductIdRequest().daysInYearCustomStrategy(DaysInYearCustomStrategy.FULL_LEAP_YEAR));
|
||||||
|
loanProduct = loanTransactionHelper.getLoanProduct(loanProductId.intValue());
|
||||||
|
Assertions.assertEquals("FULL_LEAP_YEAR", loanProduct.getDaysInYearCustomStrategy().getId());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFEB_29_PERIOD_ONLY() {
|
public void testFEB_29_PERIOD_ONLY() {
|
||||||
runAt("1 January 2024", () -> {
|
runAt("1 January 2024", () -> {
|
||||||
|
|||||||
Reference in New Issue
Block a user