This is an automated email from the ASF dual-hosted git repository.
arnold pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git
The following commit(s) were added to refs/heads/develop by this push:
new 69fed07e5 FINERACT-2152: Backdated and multiple interest pauses
69fed07e5 is described below
commit 69fed07e5c3de552d547121e6b90519ddb0d6d35
Author: Oleksii Novikov <[email protected]>
AuthorDate: Fri Jan 24 18:20:52 2025 +0200
FINERACT-2152: Backdated and multiple interest pauses
---
.../stepdef/loan/LoanInterestPauseStepDef.java | 2 +-
.../resources/features/LoanInterestPause.feature | 140 ++++++++++++++++++++-
.../service/AccountTransfersService.java | 27 ++++
.../InterestPauseWritePlatformServiceImpl.java | 16 ++-
.../AccountTransfersWritePlatformService.java | 6 +-
.../starter/LoanAccountConfiguration.java | 8 +-
6 files changed, 189 insertions(+), 10 deletions(-)
diff --git
a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanInterestPauseStepDef.java
b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanInterestPauseStepDef.java
index 39932fdaf..86ee0ea1a 100644
---
a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanInterestPauseStepDef.java
+++
b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanInterestPauseStepDef.java
@@ -35,7 +35,7 @@ public class LoanInterestPauseStepDef extends AbstractStepDef
{
@Autowired
private LoanInterestPauseApi loanInterestPauseApi;
- @And("Customer creates interest pause with start date {string} and end
date {string}")
+ @And("Create interest pause period 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;
diff --git
a/fineract-e2e-tests-runner/src/test/resources/features/LoanInterestPause.feature
b/fineract-e2e-tests-runner/src/test/resources/features/LoanInterestPause.feature
index 311e7ba25..74065dd8b 100644
---
a/fineract-e2e-tests-runner/src/test/resources/features/LoanInterestPause.feature
+++
b/fineract-e2e-tests-runner/src/test/resources/features/LoanInterestPause.feature
@@ -23,7 +23,7 @@ Feature: Loan interest pause on repayment schedule
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"
+ And Create interest pause period 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 | | |
|
@@ -59,7 +59,7 @@ Feature: Loan interest pause on repayment schedule
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"
+ And Create interest pause period 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 | | |
|
@@ -72,3 +72,139 @@ Feature: Loan interest pause on repayment schedule
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 |
+
+ Scenario: Backdated pause after the repayment
+ 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_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALCULATION_DAILY_TILL_PRECLOSE
| 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 March 2024"
+ And Customer makes "AUTOPAY" repayment on "01 February 2024" with 17.01
EUR transaction amount
+ And Customer makes "AUTOPAY" repayment on "01 March 2024" with 17.01 EUR
transaction amount
+ 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 | 01 March 2024 | 67.05 |
16.52 | 0.49 | 0.0 | 0.0 | 17.01 | 17.01 | 0.0 | 0.0
| 0.0 |
+ | 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 | 34.02 | 0
| 0 | 68.03 |
+ Then Loan Transactions tab has the following data:
+ | Transaction date | Transaction Type | Amount | Principal | Interest |
Fees | Penalties | Loan Balance | Reverted | Replayed |
+ | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 |
0.0 | 0.0 | 100.0 | false | false |
+ | 01 February 2024 | Repayment | 17.01 | 16.43 | 0.58 |
0.0 | 0.0 | 83.57 | false | false |
+ | 01 March 2024 | Repayment | 17.01 | 16.52 | 0.49 |
0.0 | 0.0 | 67.05 | false | false |
+ And Create interest pause period 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 | 01 March 2024 | 66.95 |
16.62 | 0.39 | 0.0 | 0.0 | 17.01 | 17.01 | 0.0 | 0.0
| 0.0 |
+ | 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 | 34.02 | 0
| 0 | 67.93 |
+ Then Loan Transactions tab has the following data:
+ | Transaction date | Transaction Type | Amount | Principal | Interest |
Fees | Penalties | Loan Balance | Reverted | Replayed |
+ | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 |
0.0 | 0.0 | 100.0 | false | false |
+ | 01 February 2024 | Repayment | 17.01 | 16.43 | 0.58 |
0.0 | 0.0 | 83.57 | false | false |
+ | 01 March 2024 | Repayment | 17.01 | 16.62 | 0.39 |
0.0 | 0.0 | 66.95 | false | true |
+
+ Scenario: Multiple pause
+ 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_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALCULATION_DAILY_TILL_PRECLOSE
| 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 March 2024"
+ And Customer makes "AUTOPAY" repayment on "01 February 2024" with 17.01
EUR transaction amount
+ And Customer makes "AUTOPAY" repayment on "01 March 2024" with 17.01 EUR
transaction amount
+ 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 | 01 March 2024 | 67.05 |
16.52 | 0.49 | 0.0 | 0.0 | 17.01 | 17.01 | 0.0 | 0.0
| 0.0 |
+ | 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 | 34.02 | 0
| 0 | 68.03 |
+ Then Loan Transactions tab has the following data:
+ | Transaction date | Transaction Type | Amount | Principal | Interest |
Fees | Penalties | Loan Balance | Reverted | Replayed |
+ | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 |
0.0 | 0.0 | 100.0 | false | false |
+ | 01 February 2024 | Repayment | 17.01 | 16.43 | 0.58 |
0.0 | 0.0 | 83.57 | false | false |
+ | 01 March 2024 | Repayment | 17.01 | 16.52 | 0.49 |
0.0 | 0.0 | 67.05 | false | false |
+ And Create interest pause period 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 | 01 March 2024 | 66.95 |
16.62 | 0.39 | 0.0 | 0.0 | 17.01 | 17.01 | 0.0 | 0.0
| 0.0 |
+ | 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 | 34.02 | 0
| 0 | 67.93 |
+ Then Loan Transactions tab has the following data:
+ | Transaction date | Transaction Type | Amount | Principal | Interest |
Fees | Penalties | Loan Balance | Reverted | Replayed |
+ | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 |
0.0 | 0.0 | 100.0 | false | false |
+ | 01 February 2024 | Repayment | 17.01 | 16.43 | 0.58 |
0.0 | 0.0 | 83.57 | false | false |
+ | 01 March 2024 | Repayment | 17.01 | 16.62 | 0.39 |
0.0 | 0.0 | 66.95 | false | true |
+ And Create interest pause period with start date "10 March 2024" and end
date "20 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 | 01 March 2024 | 66.95 |
16.62 | 0.39 | 0.0 | 0.0 | 17.01 | 17.01 | 0.0 | 0.0
| 0.0 |
+ | 3 | 31 | 01 April 2024 | | 50.19 |
16.76 | 0.25 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0
| 17.01 |
+ | 4 | 30 | 01 May 2024 | | 33.47 |
16.72 | 0.29 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0
| 17.01 |
+ | 5 | 31 | 01 June 2024 | | 16.66 |
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.66 | 0.1 | 0.0 | 0.0 | 16.76 | 0.0 | 0.0 | 0.0
| 16.76 |
+ Then Loan Repayment schedule has the following data in Total row:
+ | Principal due | Interest | Fees | Penalties | Due | Paid | In
advance | Late | Outstanding |
+ | 100 | 1.81 | 0 | 0 | 101.81 | 34.02 | 0
| 0 | 67.79 |
+ Then Loan Transactions tab has the following data:
+ | Transaction date | Transaction Type | Amount | Principal | Interest |
Fees | Penalties | Loan Balance | Reverted | Replayed |
+ | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 |
0.0 | 0.0 | 100.0 | false | false |
+ | 01 February 2024 | Repayment | 17.01 | 16.43 | 0.58 |
0.0 | 0.0 | 83.57 | false | false |
+ | 01 March 2024 | Repayment | 17.01 | 16.62 | 0.39 |
0.0 | 0.0 | 66.95 | false | true |
\ No newline at end of file
diff --git
a/fineract-loan/src/main/java/org/apache/fineract/portfolio/interestpauses/service/AccountTransfersService.java
b/fineract-loan/src/main/java/org/apache/fineract/portfolio/interestpauses/service/AccountTransfersService.java
new file mode 100644
index 000000000..fd9672db6
--- /dev/null
+++
b/fineract-loan/src/main/java/org/apache/fineract/portfolio/interestpauses/service/AccountTransfersService.java
@@ -0,0 +1,27 @@
+/**
+ * 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.portfolio.interestpauses.service;
+
+import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction;
+
+public interface AccountTransfersService {
+
+ void updateLoanTransaction(Long loanTransactionId, LoanTransaction
newLoanTransaction);
+
+}
diff --git
a/fineract-loan/src/main/java/org/apache/fineract/portfolio/interestpauses/service/InterestPauseWritePlatformServiceImpl.java
b/fineract-loan/src/main/java/org/apache/fineract/portfolio/interestpauses/service/InterestPauseWritePlatformServiceImpl.java
index b7e1ec1fa..884ec8417 100644
---
a/fineract-loan/src/main/java/org/apache/fineract/portfolio/interestpauses/service/InterestPauseWritePlatformServiceImpl.java
+++
b/fineract-loan/src/main/java/org/apache/fineract/portfolio/interestpauses/service/InterestPauseWritePlatformServiceImpl.java
@@ -40,11 +40,15 @@ import
org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
import org.apache.fineract.infrastructure.core.domain.ExternalId;
import
org.apache.fineract.infrastructure.core.exception.GeneralPlatformDomainRuleException;
import
org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
+import
org.apache.fineract.portfolio.loanaccount.domain.ChangedTransactionDetail;
import org.apache.fineract.portfolio.loanaccount.domain.Loan;
+import
org.apache.fineract.portfolio.loanaccount.domain.LoanAccountDomainService;
import org.apache.fineract.portfolio.loanaccount.domain.LoanRepositoryWrapper;
import org.apache.fineract.portfolio.loanaccount.domain.LoanTermVariations;
+import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction;
import
org.apache.fineract.portfolio.loanaccount.rescheduleloan.domain.LoanTermVariationsRepository;
import org.apache.fineract.portfolio.loanaccount.service.LoanAssembler;
+import
org.apache.fineract.portfolio.loanaccount.service.ReplayedTransactionBusinessEventService;
import org.springframework.transaction.annotation.Transactional;
@AllArgsConstructor
@@ -54,6 +58,9 @@ public class InterestPauseWritePlatformServiceImpl implements
InterestPauseWrite
private final LoanTermVariationsRepository loanTermVariationsRepository;
private final LoanRepositoryWrapper loanRepositoryWrapper;
private final LoanAssembler loanAssembler;
+ private final LoanAccountDomainService loanAccountDomainService;
+ private final AccountTransfersService accountTransfersService;
+ private final ReplayedTransactionBusinessEventService
replayedTransactionBusinessEventService;
@Override
public CommandProcessingResult createInterestPause(final ExternalId
loanExternalId, final String startDateString,
@@ -146,7 +153,14 @@ public class InterestPauseWritePlatformServiceImpl
implements InterestPauseWrite
final LoanTermVariations savedVariation =
loanTermVariationsRepository.saveAndFlush(variation);
loan.getLoanTermVariations().add(savedVariation);
- loan.reprocessTransactions();
+ final ChangedTransactionDetail changedTransactionDetail =
loan.reprocessTransactions();
+ if (changedTransactionDetail != null) {
+ for (final Map.Entry<Long, LoanTransaction> mapEntry :
changedTransactionDetail.getNewTransactionMappings().entrySet()) {
+
loanAccountDomainService.saveLoanTransactionWithDataIntegrityViolationChecks(mapEntry.getValue());
+
accountTransfersService.updateLoanTransaction(mapEntry.getKey(),
mapEntry.getValue());
+ }
+
replayedTransactionBusinessEventService.raiseTransactionReplayedEvents(changedTransactionDetail);
+ }
return new
CommandProcessingResultBuilder().withEntityId(savedVariation.getId()).build();
}
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/service/AccountTransfersWritePlatformService.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/service/AccountTransfersWritePlatformService.java
index 19765cd8d..db0e759d1 100644
---
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/service/AccountTransfersWritePlatformService.java
+++
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/service/AccountTransfersWritePlatformService.java
@@ -24,9 +24,9 @@ import
org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.portfolio.account.PortfolioAccountType;
import org.apache.fineract.portfolio.account.data.AccountTransferDTO;
import org.apache.fineract.portfolio.account.domain.AccountTransferDetails;
-import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction;
+import
org.apache.fineract.portfolio.interestpauses.service.AccountTransfersService;
-public interface AccountTransfersWritePlatformService {
+public interface AccountTransfersWritePlatformService extends
AccountTransfersService {
CommandProcessingResult create(JsonCommand command);
@@ -36,8 +36,6 @@ public interface AccountTransfersWritePlatformService {
void reverseAllTransactions(Long accountId, PortfolioAccountType
accountTypeId);
- void updateLoanTransaction(Long loanTransactionId, LoanTransaction
newLoanTransaction);
-
CommandProcessingResult refundByTransfer(JsonCommand command);
void reverseTransfersWithFromAccountTransactions(Collection<Long>
fromTransactionIds, PortfolioAccountType accountTypeId);
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/starter/LoanAccountConfiguration.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/starter/LoanAccountConfiguration.java
index 1c1e75fe7..d8c12f781 100644
---
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/starter/LoanAccountConfiguration.java
+++
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/starter/LoanAccountConfiguration.java
@@ -64,6 +64,7 @@ import
org.apache.fineract.portfolio.fund.domain.FundRepository;
import org.apache.fineract.portfolio.fund.service.FundReadPlatformService;
import org.apache.fineract.portfolio.group.domain.GroupRepositoryWrapper;
import org.apache.fineract.portfolio.group.service.GroupReadPlatformService;
+import
org.apache.fineract.portfolio.interestpauses.service.AccountTransfersService;
import
org.apache.fineract.portfolio.interestpauses.service.InterestPauseReadPlatformService;
import
org.apache.fineract.portfolio.interestpauses.service.InterestPauseReadPlatformServiceImpl;
import
org.apache.fineract.portfolio.interestpauses.service.InterestPauseWritePlatformService;
@@ -471,7 +472,10 @@ public class LoanAccountConfiguration {
@Bean
@ConditionalOnMissingBean(InterestPauseWritePlatformService.class)
public InterestPauseWritePlatformService
interestPauseWritePlatformService(LoanTermVariationsRepository
loanTermVariationsRepository,
- LoanRepositoryWrapper loanRepositoryWrapper, LoanAssembler
loanAssembler) {
- return new
InterestPauseWritePlatformServiceImpl(loanTermVariationsRepository,
loanRepositoryWrapper, loanAssembler);
+ LoanRepositoryWrapper loanRepositoryWrapper, LoanAssembler
loanAssembler, LoanAccountDomainService loanAccountDomainService,
+ AccountTransfersService accountTransfersService,
+ ReplayedTransactionBusinessEventService
replayedTransactionBusinessEventService) {
+ return new
InterestPauseWritePlatformServiceImpl(loanTermVariationsRepository,
loanRepositoryWrapper, loanAssembler,
+ loanAccountDomainService, accountTransfersService,
replayedTransactionBusinessEventService);
}
}