Skip to content

Commit 1a8c3d3

Browse files
FINERACT-2354: e2e test scenarios for re-aging with payable and full interest handling options
1 parent 7686387 commit 1a8c3d3

File tree

5 files changed

+3128
-239
lines changed

5 files changed

+3128
-239
lines changed

fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/data/loanproduct/DefaultLoanProduct.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ public enum DefaultLoanProduct implements LoanProduct {
125125
LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_MULTIDISBURSE_EXPECT_TRANCHE, //
126126
LP2_ADV_PYMNT_INT_DAILY_EMI_360_30_INT_RECALC_DAILY_MULTIDISB_EXPECT_TRANCHE_APPROVED_OVER_APPLIED, //
127127
LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_MULTIDISBURSE, //
128+
LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_MULTIDISBURSE_EXPECT_TRANCHE_CHARGEBACK, //
129+
LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_MULTIDISBURSE_CHARGEBACK, //
128130
LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_CASH_ACCOUNTING_DISBURSEMENT_CHARGES, //
129131
LP2_ADV_PYMNT_INT_DAILY_EMI_ACTUAL_ACTUAL_INT_REFUND_FULL_ZERO_INT_CHARGE_OFF, //
130132
LP2_ADV_PYMNT_INT_DAILY_EMI_ACTUAL_ACTUAL_INT_REFUND_FULL_ACCELERATE_MATURITY_CHARGE_OFF, //

fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/initializer/global/LoanProductGlobalInitializerStep.java

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2220,6 +2220,79 @@ public void initialize() throws Exception {
22202220
TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_MULTIDISBURSE,
22212221
responseLoanProductsRequestLP2AdvancedpaymentInterestEmi36030InterestRecalcDailyMultiDisburseDisbursementCharge);
22222222

2223+
// LP2 with progressive loan schedule + horizontal + interest recalculation daily EMI + 360/30 +
2224+
// multidisbursement
2225+
// Frequency for recalculate Outstanding Principal: Daily, Frequency Interval for recalculation: 1
2226+
// chargeback - interest, fee, principal, penalty
2227+
String name150 = DefaultLoanProduct.LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_MULTIDISBURSE_EXPECT_TRANCHE_CHARGEBACK
2228+
.getName();
2229+
PostLoanProductsRequest loanProductsRequestLP2AdvancedpaymentInterestEmi36030InterestRecalcDailyMultiDisburseExpectTrancheChargeback = loanProductsRequestFactory
2230+
.defaultLoanProductsRequestLP2Emi()//
2231+
.name(name150)//
2232+
.daysInYearType(DaysInYearType.DAYS360.value)//
2233+
.daysInMonthType(DaysInMonthType.DAYS30.value)//
2234+
.isInterestRecalculationEnabled(true)//
2235+
.preClosureInterestCalculationStrategy(1)//
2236+
.rescheduleStrategyMethod(4)//
2237+
.interestRecalculationCompoundingMethod(0)//
2238+
.recalculationRestFrequencyType(2)//
2239+
.recalculationRestFrequencyInterval(1)//
2240+
.creditAllocation(List.of(//
2241+
createCreditAllocation("CHARGEBACK", List.of("INTEREST", "FEE", "PRINCIPAL", "PENALTY"))//
2242+
))//
2243+
.paymentAllocation(List.of(//
2244+
createPaymentAllocation("DEFAULT", "NEXT_INSTALLMENT"), //
2245+
createPaymentAllocation("GOODWILL_CREDIT", "LAST_INSTALLMENT"), //
2246+
createPaymentAllocation("MERCHANT_ISSUED_REFUND", "REAMORTIZATION"), //
2247+
createPaymentAllocation("PAYOUT_REFUND", "NEXT_INSTALLMENT")))//
2248+
.multiDisburseLoan(true)//
2249+
.disallowExpectedDisbursements(false)//
2250+
.maxTrancheCount(10)//
2251+
.outstandingLoanBalance(10000.0);//
2252+
Response<PostLoanProductsResponse> responseLoanProductsRequestLP2AdvancedpaymentInterestEmi36030InterestRecalcDailyMultiDisburseExpectTrancheChargeback = loanProductsApi
2253+
.createLoanProduct(
2254+
loanProductsRequestLP2AdvancedpaymentInterestEmi36030InterestRecalcDailyMultiDisburseExpectTrancheChargeback)
2255+
.execute();
2256+
TestContext.INSTANCE.set(
2257+
TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_MULTIDISBURSE_EXPECT_TRANCHE_CHARGEBACK,
2258+
responseLoanProductsRequestLP2AdvancedpaymentInterestEmi36030InterestRecalcDailyMultiDisburseExpectTrancheChargeback);
2259+
2260+
// LP2 with progressive loan schedule + horizontal + interest recalculation daily EMI + 360/30 +
2261+
// multidisbursement
2262+
// Frequency for recalculate Outstanding Principal: Daily, Frequency Interval for recalculation: 1
2263+
// chargeback - interest, fee, principal, penalty
2264+
String name151 = DefaultLoanProduct.LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_MULTIDISBURSE_CHARGEBACK
2265+
.getName();
2266+
PostLoanProductsRequest loanProductsRequestLP2AdvancedpaymentInterestEmi36030InterestRecalcDailyMultiDisburseChargeback = loanProductsRequestFactory
2267+
.defaultLoanProductsRequestLP2Emi()//
2268+
.name(name151)//
2269+
.daysInYearType(DaysInYearType.DAYS360.value)//
2270+
.daysInMonthType(DaysInMonthType.DAYS30.value)//
2271+
.isInterestRecalculationEnabled(true)//
2272+
.preClosureInterestCalculationStrategy(1)//
2273+
.rescheduleStrategyMethod(4)//
2274+
.interestRecalculationCompoundingMethod(0)//
2275+
.recalculationRestFrequencyType(2)//
2276+
.recalculationRestFrequencyInterval(1)//
2277+
.creditAllocation(List.of(//
2278+
createCreditAllocation("CHARGEBACK", List.of("INTEREST", "FEE", "PRINCIPAL", "PENALTY"))//
2279+
))//
2280+
.paymentAllocation(List.of(//
2281+
createPaymentAllocation("DEFAULT", "NEXT_INSTALLMENT"), //
2282+
createPaymentAllocation("GOODWILL_CREDIT", "LAST_INSTALLMENT"), //
2283+
createPaymentAllocation("MERCHANT_ISSUED_REFUND", "REAMORTIZATION"), //
2284+
createPaymentAllocation("PAYOUT_REFUND", "NEXT_INSTALLMENT")))//
2285+
.multiDisburseLoan(true)//
2286+
.disallowExpectedDisbursements(true)//
2287+
.maxTrancheCount(10)//
2288+
.outstandingLoanBalance(10000.0);//
2289+
Response<PostLoanProductsResponse> responseLoanProductsRequestLP2AdvancedpaymentInterestEmi36030InterestRecalcDailyMultiDisburseChargeback = loanProductsApi
2290+
.createLoanProduct(loanProductsRequestLP2AdvancedpaymentInterestEmi36030InterestRecalcDailyMultiDisburseChargeback)
2291+
.execute();
2292+
TestContext.INSTANCE.set(
2293+
TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_MULTIDISBURSE_CHARGEBACK,
2294+
responseLoanProductsRequestLP2AdvancedpaymentInterestEmi36030InterestRecalcDailyMultiDisburseDisbursementCharge);
2295+
22232296
// LP2 with progressive loan schedule + horizontal + interest recalculation daily EMI + 360/30 + cash based
22242297
// accounting
22252298
// Frequency for recalculate Outstanding Principal: Daily, Frequency Interval for recalculation: 1

fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2567,6 +2567,13 @@ public void loanInstallmentsObligationsMet() throws IOException {
25672567
assertThat(allInstallmentsObligationsMet).isTrue();
25682568
}
25692569

2570+
@Then("Loan is closed with zero outstanding balance and it's all installments have obligations met")
2571+
public void loanClosedAndInstallmentsObligationsMet() throws IOException {
2572+
loanInstallmentsObligationsMet();
2573+
loanOutstanding(0);
2574+
loanStatus("CLOSED_OBLIGATIONS_MET");
2575+
}
2576+
25702577
@Then("Loan closedon_date is {string}")
25712578
public void loanClosedonDate(String date) throws IOException {
25722579
Response<PostLoansResponse> loanCreateResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);

fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/support/TestContextKey.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ public abstract class TestContextKey {
155155
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_MULTIDISBURSE_EXPECT_TRANCHE = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyEmi36030InterestRecalculationDailyMultidisburseExpectTranche";
156156
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INT_DAILY_EMI_360_30_INT_RECALC_DAILY_MULTIDISB_EXPECT_TRANCHE_APPROVED_OVER_APPLIED = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyEmi36030InterestRecalculationDailyMultidisburseExpectTrancheApprovedOVerAppliedPercentage";
157157
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_MULTIDISBURSE = "loanProductCreateResponseLP2AdvancedPaymentInterestRecalculationDailyEmi36030Multidisburse";
158+
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_MULTIDISBURSE_EXPECT_TRANCHE_CHARGEBACK = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyEmi36030InterestRecalculationDailyMultidisburseExpectTrancheChargeback";
159+
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_MULTIDISBURSE_CHARGEBACK = "loanProductCreateResponseLP2AdvancedPaymentInterestRecalculationDailyEmi36030MultidisburseChargeback";
158160
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_CASH_ACCOUNTING_DISBURSEMENT_CHARGES = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyEmi36030InterestRecalculationDailyCashBasedDisbursementCharge";
159161
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_PROGRESSIVE_ADV_PYMNT_CAPITALIZED_INCOME = "loanProductCreateResponseLP2ProgressiveAdvancedPaymentCapitalizedIncome";
160162
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_PROGRESSIVE_ADV_PYMNT_BUYDOWN_FEES = "loanProductCreateResponseLP2ProgressiveAdvancedPaymentBuyDownFees";

0 commit comments

Comments
 (0)