Skip to content

Commit ccc36cf

Browse files
peter-kovacs-dpcadamsaghy
authored andcommitted
FINERACT-2326: Loan contract termination same disbursement date - E2E tests
1 parent fa9a06f commit ccc36cf

File tree

4 files changed

+85
-0
lines changed

4 files changed

+85
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ public enum DefaultLoanProduct implements LoanProduct {
146146
LP2_ADV_PYMNT_ZERO_INTEREST_CHARGE_OFF_DELINQUENT_REASON_INTEREST_RECALC_CAPITALIZED_INCOME, //
147147
LP2_ADV_PYMNT_360_30_INTEREST_RECALCULATION_ZERO_INTEREST_CHARGE_OFF_ACCRUAL_ACTIVITY, //
148148
LP2_ADV_PYMNT_INTEREST_DAILY_INTEREST_RECALCULATION_CONTRACT_TERMINATION, //
149+
LP2_ADV_PYMNT_INTEREST_DAILY_INTEREST_RECALCULATION_CONTRACT_TERMINATION_INT_RECOGNITION, //
149150
LP2_ADV_PYMNT_INTEREST_DAILY_RECALC_EMI_360_30_MULTIDISB_OVER_APPLIED_PERCENTAGE_CAPITALIZED_INCOME, //
150151
LP2_ADV_PYMNT_INTEREST_DAILY_RECALC_EMI_360_30_MULTIDISB_OVER_APPLIED_FLAT_CAPITALIZED_INCOME, //
151152
LP2_ADV_PYMNT_INTEREST_DAILY_RECALC_EMI_360_30_APPROVED_OVER_APPLIED_PERCENTAGE_CAPITALIZED_INCOME, //

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

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4056,6 +4056,39 @@ public void initialize() throws Exception {
40564056
TestContext.INSTANCE.set(
40574057
TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_CUSTOM_PMT_ALLOC_PROGRESSIVE_INTEREST_DAILY_EMI_360_30_INTEREST_RECALCULATION_DAILY,
40584058
responseLoanProductsResponseAdvCustomPaymentAllocationProgressiveLoanInterestDailyEmi36030InterestRecalculationDaily);
4059+
4060+
// LP2 with progressive loan schedule + horizontal + interest EMI + 360/30 + multidisbursement +
4061+
// contract termination + interest recognition on disbursement date
4062+
// (LP2_ADV_PYMNT_INTEREST_DAILY_INTEREST_RECALCULATION_CONTRACT_TERMINATION_INT_RECOGNITION)
4063+
final String name148 = DefaultLoanProduct.LP2_ADV_PYMNT_INTEREST_DAILY_INTEREST_RECALCULATION_CONTRACT_TERMINATION_INT_RECOGNITION
4064+
.getName();
4065+
4066+
final PostLoanProductsRequest loanProductsRequestAdvCustomContractTerminationProgressiveLoanScheduleIntRecalcIntRecognition = loanProductsRequestFactory
4067+
.defaultLoanProductsRequestLP2InterestDailyRecalculation()//
4068+
.name(name148)//
4069+
.paymentAllocation(List.of(//
4070+
createPaymentAllocation("DEFAULT", "NEXT_INSTALLMENT",
4071+
LoanProductPaymentAllocationRule.AllocationTypesEnum.PAST_DUE_PENALTY, //
4072+
LoanProductPaymentAllocationRule.AllocationTypesEnum.PAST_DUE_FEE, //
4073+
LoanProductPaymentAllocationRule.AllocationTypesEnum.PAST_DUE_INTEREST, //
4074+
LoanProductPaymentAllocationRule.AllocationTypesEnum.PAST_DUE_PRINCIPAL, //
4075+
LoanProductPaymentAllocationRule.AllocationTypesEnum.DUE_PENALTY, //
4076+
LoanProductPaymentAllocationRule.AllocationTypesEnum.DUE_FEE, //
4077+
LoanProductPaymentAllocationRule.AllocationTypesEnum.DUE_PRINCIPAL, //
4078+
LoanProductPaymentAllocationRule.AllocationTypesEnum.DUE_INTEREST, //
4079+
LoanProductPaymentAllocationRule.AllocationTypesEnum.IN_ADVANCE_PENALTY, //
4080+
LoanProductPaymentAllocationRule.AllocationTypesEnum.IN_ADVANCE_FEE, //
4081+
LoanProductPaymentAllocationRule.AllocationTypesEnum.IN_ADVANCE_PRINCIPAL, //
4082+
LoanProductPaymentAllocationRule.AllocationTypesEnum.IN_ADVANCE_INTEREST), //
4083+
createPaymentAllocation("GOODWILL_CREDIT", "LAST_INSTALLMENT"), //
4084+
createPaymentAllocation("MERCHANT_ISSUED_REFUND", "REAMORTIZATION"), //
4085+
createPaymentAllocation("PAYOUT_REFUND", "NEXT_INSTALLMENT")))//
4086+
.interestRecognitionOnDisbursementDate(true);
4087+
final Response<PostLoanProductsResponse> responseLoanProductsRequestAdvCustomContractTerminationProgressiveLoanScheduleIntRecalcIntRecognition = loanProductsApi
4088+
.createLoanProduct(loanProductsRequestAdvCustomContractTerminationProgressiveLoanScheduleIntRecalcIntRecognition).execute();
4089+
TestContext.INSTANCE.set(
4090+
TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_INTEREST_RECALCULATION_CONTRACT_TERMINATION_INT_RECOGNITION,
4091+
responseLoanProductsRequestAdvCustomContractTerminationProgressiveLoanScheduleIntRecalcIntRecognition);
40594092
}
40604093

40614094
public static AdvancedPaymentData createPaymentAllocation(String transactionType, String futureInstallmentAllocationRule,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ public abstract class TestContextKey {
257257
public static final String LOAN_CAPITALIZED_INCOME_ADJUSTMENT_RESPONSE = "loanCapitalizedIncomeAdjustmentResponse";
258258
public static final String LOAN_INTEREST_REFUND_RESPONSE = "loanInterestRefundResponse";
259259
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_INTEREST_RECALCULATION_CONTRACT_TERMINATION = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyInterestRecalculationContractTermination";
260+
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_INTEREST_RECALCULATION_CONTRACT_TERMINATION_INT_RECOGNITION = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyInterestRecalculationContractTerminationIntRecognition";
260261
public static final String LOAN_CONTRACT_TERMINATION_RESPONSE = "loanContractTerminationResponse";
261262
public static final String LOAN_UNDO_CONTRACT_TERMINATION_RESPONSE = "loanUndoContractTerminationResponse";
262263
public static final String LOAN_BUY_DOWN_FEE_RESPONSE = "loanBuyDownFeeResponse";

fineract-e2e-tests-runner/src/test/resources/features/LoanContractTermination.feature

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,3 +1317,53 @@ Feature: Contract Termination
13171317
| 31 March 2024 | Accrual Adjustment | 0.15 | 0.0 | 0.15 | 0.0 | 0.0 | 0.0 | false | false |
13181318
| 31 March 2024 | Contract Termination | 57.37 | 57.05 | 0.32 | 0.0 | 0.0 | 0.0 | true | true |
13191319
And Global configuration "is-principal-compounding-disabled-for-overdue-loans" is disabled
1320+
1321+
@TestRailId:C4133
1322+
Scenario: Contract termination on disbursement date
1323+
When Admin sets the business date to "01 January 2025"
1324+
And Admin creates a client with random data
1325+
And Admin creates a fully customized loan with the following data:
1326+
| LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy |
1327+
| LP2_ADV_PYMNT_INTEREST_DAILY_INTEREST_RECALCULATION_CONTRACT_TERMINATION | 01 January 2025 | 100 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 4 | MONTHS | 1 | MONTHS | 4 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION |
1328+
And Admin successfully approves the loan on "01 January 2025" with "100" amount and expected disbursement date on "01 January 2025"
1329+
And Admin successfully disburse the loan on "01 January 2025" with "100" EUR transaction amount
1330+
And Admin successfully terminates loan contract
1331+
Then Loan Repayment schedule has 4 periods, with the following data for periods:
1332+
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
1333+
| | | 01 January 2025 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
1334+
| 1 | 31 | 01 February 2025 | | 75.21 | 24.79 | 0.58 | 0.0 | 0.0 | 25.37 | 0.0 | 0.0 | 0.0 | 25.37 |
1335+
| 2 | 28 | 01 March 2025 | | 50.28 | 24.93 | 0.44 | 0.0 | 0.0 | 25.37 | 0.0 | 0.0 | 0.0 | 25.37 |
1336+
| 3 | 31 | 01 April 2025 | | 25.2 | 25.08 | 0.29 | 0.0 | 0.0 | 25.37 | 0.0 | 0.0 | 0.0 | 25.37 |
1337+
| 4 | 30 | 01 May 2025 | | 0.0 | 25.2 | 0.15 | 0.0 | 0.0 | 25.35 | 0.0 | 0.0 | 0.0 | 25.35 |
1338+
And Loan Repayment schedule has the following data in Total row:
1339+
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
1340+
| 100.0 | 1.46 | 0.0 | 0.0 | 101.46 | 0.0 | 0.0 | 0.0 | 101.46 |
1341+
And Loan Transactions tab has the following data:
1342+
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
1343+
| 01 January 2025 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false |
1344+
| 01 January 2025 | Contract Termination | 101.46 | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | false |
1345+
1346+
@TestRailId:C4134
1347+
Scenario: Contract termination on disbursement date with interest recognition
1348+
When Admin sets the business date to "01 January 2025"
1349+
And Admin creates a client with random data
1350+
And Admin creates a fully customized loan with the following data:
1351+
| LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy |
1352+
| LP2_ADV_PYMNT_INTEREST_DAILY_INTEREST_RECALCULATION_CONTRACT_TERMINATION_INT_RECOGNITION | 01 January 2025 | 100 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 4 | MONTHS | 1 | MONTHS | 4 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION |
1353+
And Admin successfully approves the loan on "01 January 2025" with "100" amount and expected disbursement date on "01 January 2025"
1354+
And Admin successfully disburse the loan on "01 January 2025" with "100" EUR transaction amount
1355+
And Admin successfully terminates loan contract
1356+
Then Loan Repayment schedule has 4 periods, with the following data for periods:
1357+
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
1358+
| | | 01 January 2025 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
1359+
| 1 | 31 | 01 February 2025 | | 75.21 | 24.79 | 0.58 | 0.0 | 0.0 | 25.37 | 0.0 | 0.0 | 0.0 | 25.37 |
1360+
| 2 | 28 | 01 March 2025 | | 50.28 | 24.93 | 0.44 | 0.0 | 0.0 | 25.37 | 0.0 | 0.0 | 0.0 | 25.37 |
1361+
| 3 | 31 | 01 April 2025 | | 25.2 | 25.08 | 0.29 | 0.0 | 0.0 | 25.37 | 0.0 | 0.0 | 0.0 | 25.37 |
1362+
| 4 | 30 | 01 May 2025 | | 0.0 | 25.2 | 0.15 | 0.0 | 0.0 | 25.35 | 0.0 | 0.0 | 0.0 | 25.35 |
1363+
And Loan Repayment schedule has the following data in Total row:
1364+
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
1365+
| 100.0 | 1.46 | 0.0 | 0.0 | 101.46 | 0.0 | 0.0 | 0.0 | 101.46 |
1366+
And Loan Transactions tab has the following data:
1367+
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
1368+
| 01 January 2025 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false |
1369+
| 01 January 2025 | Contract Termination | 101.46 | 100.0 | 1.46 | 0.0 | 0.0 | 0.0 | false | false |

0 commit comments

Comments
 (0)