-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FINERACT-2152: Interest pause during one period and between two periods
- Loading branch information
1 parent
a9d76ef
commit af37e07
Showing
18 changed files
with
414 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...ts-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanInterestPauseStepDef.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.fineract.test.stepdef.loan; | ||
|
||
import io.cucumber.java.en.And; | ||
import java.io.IOException; | ||
import org.apache.fineract.client.models.CommandProcessingResult; | ||
import org.apache.fineract.client.models.InterestPauseRequestDto; | ||
import org.apache.fineract.client.models.PostLoansResponse; | ||
import org.apache.fineract.client.services.LoanInterestPauseApi; | ||
import org.apache.fineract.test.helper.ErrorHelper; | ||
import org.apache.fineract.test.stepdef.AbstractStepDef; | ||
import org.apache.fineract.test.support.TestContextKey; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import retrofit2.Response; | ||
|
||
public class LoanInterestPauseStepDef extends AbstractStepDef { | ||
|
||
@Autowired | ||
private LoanInterestPauseApi loanInterestPauseApi; | ||
|
||
@And("Customer creates interest pause with start date {string} and end date {string}") | ||
public void createInterestPause(final String startDate, final String endDate) throws IOException { | ||
final Response<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); | ||
assert loanResponse.body() != null; | ||
final long loanId = loanResponse.body().getLoanId(); | ||
|
||
final InterestPauseRequestDto request = new InterestPauseRequestDto()// | ||
.startDate(startDate)// | ||
.endDate(endDate)// | ||
.dateFormat("dd MMMM yyyy")// | ||
.locale("en");// | ||
|
||
final Response<CommandProcessingResult> createResponse = loanInterestPauseApi.createInterestPause(loanId, request).execute(); | ||
ErrorHelper.checkSuccessfulApiCall(createResponse); | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
fineract-e2e-tests-runner/src/test/resources/features/LoanInterestPause.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
@InterestPauseFeature | ||
Feature: Loan interest pause on repayment schedule | ||
|
||
Scenario: S1 - pause calculation within same period, interestRecalculation = true | ||
When Admin sets the business date to "1 January 2024" | ||
And Admin creates a client with random data | ||
And Admin creates a fully customized loan with the following data: | ||
| 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 | | ||
| LP2_ADV_CUSTOM_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 January 2024 | 100 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | | ||
Then Loan Repayment schedule has 6 periods, with the following data for periods: | ||
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | | ||
| | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | | | | 0.0 | | ||
| 1 | 31 | 01 February 2024 | | 83.57 | 16.43 | 0.58 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | | ||
| 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | | ||
| 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | | ||
| 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | | ||
| 5 | 31 | 01 June 2024 | | 16.9 | 16.81 | 0.2 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | | ||
| 6 | 30 | 01 July 2024 | | 0.0 | 16.9 | 0.1 | 0.0 | 0.0 | 17.0 | 0.0 | 0.0 | 0.0 | 17.0 | | ||
Then Loan Repayment schedule has the following data in Total row: | ||
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | | ||
| 100 | 2.05 | 0 | 0 | 102.05 | 0 | 0 | 0 | 102.05 | | ||
And Admin successfully approves the loan on "1 January 2024" with "100" amount and expected disbursement date on "1 January 2024" | ||
And Admin successfully disburse the loan on "1 January 2024" with "100" EUR transaction amount | ||
When Admin sets the business date to "1 February 2024" | ||
And Customer makes "AUTOPAY" repayment on "01 February 2024" with 17.01 EUR transaction amount | ||
And Customer creates interest pause with start date "05 February 2024" and end date "10 February 2024" | ||
Then Loan Repayment schedule has 6 periods, with the following data for periods: | ||
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | | ||
| | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | | ||
| 1 | 31 | 01 February 2024 | 01 February 2024 | 83.57 | 16.43 | 0.58 | 0.0 | 0.0 | 17.01 | 17.01 | 0.0 | 0.0 | 0.0 | | ||
| 2 | 29 | 01 March 2024 | | 66.95 | 16.62 | 0.39 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | | ||
| 3 | 31 | 01 April 2024 | | 50.33 | 16.62 | 0.39 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | | ||
| 4 | 30 | 01 May 2024 | | 33.61 | 16.72 | 0.29 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | | ||
| 5 | 31 | 01 June 2024 | | 16.8 | 16.81 | 0.2 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | | ||
| 6 | 30 | 01 July 2024 | | 0.0 | 16.8 | 0.1 | 0.0 | 0.0 | 16.9 | 0.0 | 0.0 | 0.0 | 16.9 | | ||
Then Loan Repayment schedule has the following data in Total row: | ||
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | | ||
| 100 | 1.95 | 0 | 0 | 101.95 | 17.01 | 0 | 0 | 84.94 | | ||
|
||
Scenario: S2 - pause calculation between two periods, interestRecalculation = true | ||
When Admin sets the business date to "1 January 2024" | ||
And Admin creates a client with random data | ||
And Admin creates a fully customized loan with the following data: | ||
| 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 | | ||
| LP2_ADV_CUSTOM_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 January 2024 | 100 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | | ||
Then Loan Repayment schedule has 6 periods, with the following data for periods: | ||
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | | ||
| | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | | | | 0.0 | | ||
| 1 | 31 | 01 February 2024 | | 83.57 | 16.43 | 0.58 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | | ||
| 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | | ||
| 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | | ||
| 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | | ||
| 5 | 31 | 01 June 2024 | | 16.9 | 16.81 | 0.2 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | | ||
| 6 | 30 | 01 July 2024 | | 0.0 | 16.9 | 0.1 | 0.0 | 0.0 | 17.0 | 0.0 | 0.0 | 0.0 | 17.0 | | ||
Then Loan Repayment schedule has the following data in Total row: | ||
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | | ||
| 100 | 2.05 | 0 | 0 | 102.05 | 0 | 0 | 0 | 102.05 | | ||
And Admin successfully approves the loan on "1 January 2024" with "100" amount and expected disbursement date on "1 January 2024" | ||
And Admin successfully disburse the loan on "1 January 2024" with "100" EUR transaction amount | ||
When Admin sets the business date to "1 February 2024" | ||
And Customer makes "AUTOPAY" repayment on "01 February 2024" with 17.01 EUR transaction amount | ||
And Customer creates interest pause with start date "10 February 2024" and end date "10 March 2024" | ||
Then Loan Repayment schedule has 6 periods, with the following data for periods: | ||
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | | ||
| | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | | ||
| 1 | 31 | 01 February 2024 | 01 February 2024 | 83.57 | 16.43 | 0.58 | 0.0 | 0.0 | 17.01 | 17.01 | 0.0 | 0.0 | 0.0 | | ||
| 2 | 29 | 01 March 2024 | | 66.69 | 16.88 | 0.13 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | | ||
| 3 | 31 | 01 April 2024 | | 49.96 | 16.73 | 0.28 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | | ||
| 4 | 30 | 01 May 2024 | | 33.24 | 16.72 | 0.29 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | | ||
| 5 | 31 | 01 June 2024 | | 16.42 | 16.82 | 0.19 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 | | ||
| 6 | 30 | 01 July 2024 | | 0.0 | 16.42 | 0.1 | 0.0 | 0.0 | 16.52 | 0.0 | 0.0 | 0.0 | 16.52 | | ||
Then Loan Repayment schedule has the following data in Total row: | ||
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | | ||
| 100 | 1.57 | 0 | 0 | 101.57 | 17.01 | 0 | 0 | 84.56 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.