FINERACT-2389: Negative amount is shown on repayment schedule

This commit is contained in:
Jose Alberto Hernandez
2025-11-18 14:28:20 +01:00
committed by Adam Saghy
parent 9a16a26d5f
commit 60526f0ce9
7 changed files with 218 additions and 9 deletions
@@ -175,6 +175,8 @@ public enum DefaultLoanProduct implements LoanProduct {
LP1_NO_OVERRIDES, //
LP2_ADV_INTEREST_DAILY_EMI_ACTUAL_ACTUAL_INTEREST_RECALC_ZERO_CHARGE_OF_ACCRUAL, //
LP2_ADV_CUSTOM_PMT_ALLOC_INTEREST_DAILY_EMI_ACTUAL_ACTUAL_INTEREST_RECALC_ZERO_CHARGE_OFF_ACCRUAL, //
LP1_INTEREST_FLAT_DAILY_RECALCULATION_SAR_MULTIDISB_EXPECT_TRANCHES, //
LP1_INTEREST_FLAT_DAILY_ACTUAL_ACTUAL_MULTIDISB_EXPECT_TRANCHES, //
;
@Override
@@ -4196,6 +4196,48 @@ public class LoanProductGlobalInitializerStep implements FineractGlobalInitializ
TestContext.INSTANCE.set(
TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_INTEREST_DAILY_EMI_ACTUAL_ACTUAL_INTEREST_RECALC_ZERO_CHARGE_OF_ACCRUAL,
responseLoanProductsResponseAdvCustomPaymentAllocationProgressiveLoanInterestDailyEmiActualInterestRecalcZeroChargeOffChargebackAccruals);
// LP1 with 12% Flat interest, interest period: Daily, Interest recalculation- Same as repayment
// Multi-disbursement that expects tranches
PostLoanProductsRequest loanProductsRequestInterestFlatSaRRecalculationSameAsRepaymentMultiDisbursementExpectsTranches = loanProductsRequestFactory
.defaultLoanProductsRequestLP1InterestDecliningBalanceDailyRecalculationCompoundingNone()//
.name(DefaultLoanProduct.LP1_INTEREST_FLAT_DAILY_RECALCULATION_SAR_MULTIDISB_EXPECT_TRANCHES.getName())//
.interestType(INTEREST_TYPE_FLAT)//
.interestCalculationPeriodType(InterestCalculationPeriodTime.DAILY.value)//
.allowPartialPeriodInterestCalcualtion(false)//
.recalculationRestFrequencyType(RecalculationRestFrequencyType.SAME_AS_REPAYMENT.value)//
.recalculationRestFrequencyInterval(1)//
.installmentAmountInMultiplesOf(null)//
.multiDisburseLoan(true)//
.disallowExpectedDisbursements(false)//
.maxTrancheCount(10)//
.outstandingLoanBalance(10000.0);//
Response<PostLoanProductsResponse> responseLoanProductsRequestInterestFlatSaRRecalculationSameAsRepaymentMultiDisbursementExpectsTranches = loanProductsApi
.createLoanProduct(loanProductsRequestInterestFlatSaRRecalculationSameAsRepaymentMultiDisbursementExpectsTranches)
.execute();
TestContext.INSTANCE.set(TestContextKey.LP1_INTEREST_FLAT_DAILY_RECALCULATION_SAR_MULTIDISB_EXPECT_TRANCHES,
responseLoanProductsRequestInterestFlatSaRRecalculationSameAsRepaymentMultiDisbursementExpectsTranches);
// LP1 with 12% Flat interest, interest period: Daily, Interest recalculation- Actual
// Multi-disbursement that expects tranches
PostLoanProductsRequest loanProductsRequestInterestFlatActualActualMultiDisbursementExpectsTranches = loanProductsRequestFactory
.defaultLoanProductsRequestLP1InterestFlat()//
.name(DefaultLoanProduct.LP1_INTEREST_FLAT_DAILY_ACTUAL_ACTUAL_MULTIDISB_EXPECT_TRANCHES.getName())//
.interestType(INTEREST_TYPE_FLAT)//
.interestCalculationPeriodType(InterestCalculationPeriodTime.DAILY.value)//
.allowPartialPeriodInterestCalcualtion(false)//
.recalculationRestFrequencyType(RecalculationRestFrequencyType.DAILY.value)//
.interestRecalculationCompoundingMethod(0)//
.recalculationRestFrequencyInterval(1)//
.installmentAmountInMultiplesOf(null)//
.multiDisburseLoan(true)//
.disallowExpectedDisbursements(false)//
.maxTrancheCount(10)//
.outstandingLoanBalance(10000.0);//
Response<PostLoanProductsResponse> responseLoanProductsRequestInterestFlatActualActualMultiDisbursementExpectsTranches = loanProductsApi
.createLoanProduct(loanProductsRequestInterestFlatActualActualMultiDisbursementExpectsTranches).execute();
TestContext.INSTANCE.set(TestContextKey.LP1_INTEREST_FLAT_DAILY_ACTUAL_ACTUAL_MULTIDISB_EXPECT_TRANCHES,
responseLoanProductsRequestInterestFlatActualActualMultiDisbursementExpectsTranches);
}
public static AdvancedPaymentData createPaymentAllocation(String transactionType, String futureInstallmentAllocationRule,
@@ -282,4 +282,6 @@ public abstract class TestContextKey {
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP1_NO_OVERRIDES = "loanProductCreateResponseLP1NoOverrides";
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_INTEREST_DAILY_EMI_ACTUAL_ACTUAL_INTEREST_RECALC_ZERO_CHARGE_OF_ACCRUAL = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyEmiActualInterestRecalcChargeOffAccruals";
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_CUSTOM_PMT_ALLOC_INTEREST_DAILY_EMI_ACTUAL_ACTUAL_INTEREST_RECALC_ZERO_CHARGE_OFF_ACCRUAL = "loanProductCreateResponseLP2AdvancedPaymentCustomAllocationInterestDailyEmiActualInterestRecalcChargeOffAccruals";
public static final String LP1_INTEREST_FLAT_DAILY_RECALCULATION_SAR_MULTIDISB_EXPECT_TRANCHES = "loanProductCreateResponseLP1InterestFlatDailyRecalculationSameAsRepaymentMultiDisbursementExpectTranches";
public static final String LP1_INTEREST_FLAT_DAILY_ACTUAL_ACTUAL_MULTIDISB_EXPECT_TRANCHES = "loanProductCreateResponseLP1InterestFlatDailyActualActualMultiDisbursementExpectTranches";
}