Skip to content

Commit 3a12f9e

Browse files
committed
FINERACT-2354: In case full transaction reprocessing, we need to recalculate the schedule as well
1 parent 80877d5 commit 3a12f9e

38 files changed

Lines changed: 386 additions & 455 deletions

File tree

fineract-core/src/main/java/org/apache/fineract/organisation/monetary/domain/MonetaryCurrency.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import jakarta.persistence.Column;
2222
import jakarta.persistence.Embeddable;
23+
import lombok.AccessLevel;
2324
import lombok.Getter;
2425
import org.apache.fineract.organisation.monetary.data.CurrencyData;
2526

@@ -36,6 +37,7 @@ public class MonetaryCurrency {
3637
@Column(name = "currency_multiplesof")
3738
private Integer inMultiplesOf;
3839

40+
@Getter(AccessLevel.PRIVATE)
3941
private transient CurrencyData currencyData;
4042

4143
protected MonetaryCurrency() {

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8394,13 +8394,13 @@ Feature: Loan
83948394
| 2 | 15 | 31 January 2025 | | 200.59 | 49.78 | 0.73 | 0.0 | 0.0 | 50.51 | 0.0 | 0.0 | 0.0 | 50.51 |
83958395
| | | 01 February 2025 | | 500.0 | | | 0.0 | | 0.0 | | | | 0.0 |
83968396
| | | 01 February 2025 | | 200.0 | | | 0.0 | | 0.0 | | | | 0.0 |
8397-
| 3 | 15 | 15 February 2025 | | 850.67 | 49.92 | 0.59 | 0.0 | 0.0 | 50.51 | 0.0 | 0.0 | 0.0 | 50.51 |
8398-
| 4 | 15 | 02 March 2025 | | 800.6 | 50.07 | 0.44 | 0.0 | 0.0 | 50.51 | 0.0 | 0.0 | 0.0 | 50.51 |
8399-
| 5 | 15 | 17 March 2025 | | 750.38 | 50.22 | 0.29 | 0.0 | 0.0 | 50.51 | 0.0 | 0.0 | 0.0 | 50.51 |
8400-
| 6 | 15 | 01 April 2025 | | 700.0 | 50.38 | 0.15 | 0.0 | 0.0 | 50.53 | 0.0 | 0.0 | 0.0 | 50.53 |
8397+
| 3 | 15 | 15 February 2025 | | 676.32 | 224.27 | 2.49 | 0.0 | 0.0 | 226.76 | 0.0 | 0.0 | 0.0 | 226.76 |
8398+
| 4 | 15 | 02 March 2025 | | 451.53 | 224.79 | 1.97 | 0.0 | 0.0 | 226.76 | 0.0 | 0.0 | 0.0 | 226.76 |
8399+
| 5 | 15 | 17 March 2025 | | 226.09 | 225.44 | 1.32 | 0.0 | 0.0 | 226.76 | 0.0 | 0.0 | 0.0 | 226.76 |
8400+
| 6 | 15 | 01 April 2025 | | 0.0 | 226.09 | 0.66 | 0.0 | 0.0 | 226.75 | 0.0 | 0.0 | 0.0 | 226.75 |
84018401
Then Loan Repayment schedule has the following data in Total row:
8402-
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
8403-
| 300.0 | 3.08 | 0.0 | 0.0 | 303.08 | 0.0 | 0.0 | 0.0 | 303.08 |
8402+
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
8403+
| 1000.00 | 8.05 | 0.0 | 0.0 | 1008.05 | 0.0 | 0.0 | 0.0 | 1008.05 |
84048404
Then Loan Tranche Details tab has the following data:
84058405
| Expected Disbursement On | Disbursed On | Principal | Net Disbursal Amount |
84068406
| 01 January 2025 | | 300.0 | |
@@ -8860,4 +8860,4 @@ Feature: Loan
88608860
| 21 October 2025 | Accrual Activity | 3.32 | 0.0 | 0.52 | 0.0 | 2.8 | 0.0 | false | true |
88618861
| 06 November 2025 | Accrual | 1.21 | 0.0 | 1.21 | 0.0 | 0.0 | 0.0 | false | false |
88628862
And Customer makes "AUTOPAY" repayment on "06 November 2025" with 35.28 EUR transaction amount
8863-
Then Loan status will be "CLOSED_OBLIGATIONS_MET"
8863+
Then Loan status will be "CLOSED_OBLIGATIONS_MET"

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

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4634,10 +4634,10 @@ Feature: LoanReAging
46344634
| 01 February 2024 | Repayment | 17.01 | 16.43 | 0.58 | 0.0 | 0.0 | 83.57 | false | false |
46354635
| 01 March 2024 | Accrual | 1.07 | 0.0 | 1.07 | 0.0 | 0.0 | 0.0 | false | false |
46364636
| 01 March 2024 | Contract Termination | 84.06 | 83.57 | 0.49 | 0.0 | 0.0 | 0.0 | false | false |
4637-
When Admin sets the business date to "15 April 2024"
4638-
Then Admin fails to create a Loan re-aging transaction with the following data because loan was contract terminated:
4639-
| frequencyNumber | frequencyType | startDate | numberOfInstallments |
4640-
| 1 | MONTHS | 01 May 2024 | 6 |
4637+
# When Admin sets the business date to "15 April 2024"
4638+
# Then Admin fails to create a Loan re-aging transaction with the following data because loan was contract terminated:
4639+
# | frequencyNumber | frequencyType | startDate | numberOfInstallments |
4640+
# | 1 | MONTHS | 01 May 2024 | 6 |
46414641

46424642
@TestRailId:C4090 @AdvancedPaymentAllocation
46434643
Scenario: Verify that Re-aging is forbidden on charged-off loan, interest bearing loan, Interest calculation: Default Behavior, Charge-off scenario (accelerate maturity) - UC11
@@ -5014,6 +5014,8 @@ Feature: LoanReAging
50145014
| 01 February 2024 | Repayment | 17.01 | 16.43 | 0.58 | 0.0 | 0.0 | 83.57 | false |
50155015
| 15 March 2024 | Re-age | 84.28 | 83.57 | 0.71 | 0.0 | 0.0 | 0.0 | true |
50165016
| 15 March 2024 | Interest waive | 0.71 | 0.0 | 0.71 | 0.0 | 0.0 | 0.0 | true |
5017+
When Loan Pay-off is made on "01 April 2024"
5018+
Then Loan is closed with zero outstanding balance and it's all installments have obligations met
50175019

50185020
@Skip @TestRailId:C4198 @AdvancedPaymentAllocation
50195021
Scenario: Verify Re-aging reversal on interest bearing loan - UC3: Interest handling: EQUAL_AMORTIZATION_PAYABLE_INTEREST
@@ -5120,6 +5122,8 @@ Feature: LoanReAging
51205122
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
51215123
| 01 February 2024 | Repayment | 17.01 | 16.43 | 0.58 | 0.0 | 0.0 | 83.57 | false |
51225124
| 15 March 2024 | Re-age | 84.28 | 83.57 | 0.71 | 0.0 | 0.0 | 0.0 | true |
5125+
When Loan Pay-off is made on "01 April 2024"
5126+
Then Loan is closed with zero outstanding balance and it's all installments have obligations met
51235127

51245128
@Skip @TestRailId:C4199 @AdvancedPaymentAllocation
51255129
Scenario: Verify Re-aging reversal on interest bearing loan - UC4: Interest handling: EQUAL_AMORTIZATION_FULL_INTEREST
@@ -5226,6 +5230,8 @@ Feature: LoanReAging
52265230
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
52275231
| 01 February 2024 | Repayment | 17.01 | 16.43 | 0.58 | 0.0 | 0.0 | 83.57 | false |
52285232
| 15 March 2024 | Re-age | 85.08 | 83.57 | 1.51 | 0.0 | 0.0 | 0.0 | true |
5233+
When Loan Pay-off is made on "01 April 2024"
5234+
Then Loan is closed with zero outstanding balance and it's all installments have obligations met
52295235

52305236
@TestRailId:C4202 @AdvancedPaymentAllocation
52315237
Scenario: Verify Re-aging reversal on interest bearing loan - UC5: Interest handling: DEFAULT, re-aging is NOT the latest transaction on loan
@@ -5331,7 +5337,7 @@ Feature: LoanReAging
53315337
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
53325338
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false |
53335339
| 01 February 2024 | Repayment | 17.01 | 16.43 | 0.58 | 0.0 | 0.0 | 83.57 | false | false |
5334-
| 15 March 2024 | Re-age | 84.28 | 83.57 | 0.71 | 0.0 | 0.0 | 0.0 | false | true |
5340+
| 15 March 2024 | Re-age | 84.28 | 83.57 | 0.71 | 0.0 | 0.0 | 0.0 | false | false |
53355341
| 16 March 2024 | Repayment | 14.3 | 13.57 | 0.73 | 0.0 | 0.0 | 70.0 | false | false |
53365342
# --- Reversal of re-age transaction ---
53375343
When Admin sets the business date to "01 April 2024"
@@ -5352,7 +5358,7 @@ Feature: LoanReAging
53525358
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
53535359
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false |
53545360
| 01 February 2024 | Repayment | 17.01 | 16.43 | 0.58 | 0.0 | 0.0 | 83.57 | false | false |
5355-
| 15 March 2024 | Re-age | 84.28 | 83.57 | 0.71 | 0.0 | 0.0 | 0.0 | true | true |
5361+
| 15 March 2024 | Re-age | 84.28 | 83.57 | 0.71 | 0.0 | 0.0 | 0.0 | true | false |
53565362
| 16 March 2024 | Repayment | 14.3 | 13.81 | 0.49 | 0.0 | 0.0 | 69.76 | false | true |
53575363
When Loan Pay-off is made on "01 April 2024"
53585364
Then Loan is closed with zero outstanding balance and it's all installments have obligations met
@@ -5416,12 +5422,12 @@ Feature: LoanReAging
54165422
| | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
54175423
| 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 |
54185424
| 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 |
5419-
| 3 | 31 | 01 April 2024 | | 56.0 | 11.05 | 0.39 | 0.0 | 0.0 | 11.44 | 0.0 | 0.0 | 0.0 | 11.44 |
5420-
| 4 | 30 | 01 May 2024 | | 44.95 | 11.05 | 0.39 | 0.0 | 0.0 | 11.44 | 0.0 | 0.0 | 0.0 | 11.44 |
5421-
| 5 | 31 | 01 June 2024 | | 33.9 | 11.05 | 0.39 | 0.0 | 0.0 | 11.44 | 0.0 | 0.0 | 0.0 | 11.44 |
5422-
| 6 | 30 | 01 July 2024 | | 22.66 | 11.24 | 0.2 | 0.0 | 0.0 | 11.44 | 0.0 | 0.0 | 0.0 | 11.44 |
5423-
| 7 | 31 | 01 August 2024 | | 11.35 | 11.31 | 0.13 | 0.0 | 0.0 | 11.44 | 0.0 | 0.0 | 0.0 | 11.44 |
5424-
| 8 | 31 | 01 September 2024| | 0.0 | 11.35 | 0.07 | 0.0 | 0.0 | 11.42 | 0.0 | 0.0 | 0.0 | 11.42 |
5425+
| 3 | 31 | 01 April 2024 | | 56.04 | 11.01 | 0.39 | 0.0 | 0.0 | 11.4 | 0.0 | 0.0 | 0.0 | 11.4 |
5426+
| 4 | 30 | 01 May 2024 | | 45.03 | 11.01 | 0.39 | 0.0 | 0.0 | 11.4 | 0.0 | 0.0 | 0.0 | 11.4 |
5427+
| 5 | 31 | 01 June 2024 | | 34.02 | 11.01 | 0.39 | 0.0 | 0.0 | 11.4 | 0.0 | 0.0 | 0.0 | 11.4 |
5428+
| 6 | 30 | 01 July 2024 | | 22.82 | 11.2 | 0.2 | 0.0 | 0.0 | 11.4 | 0.0 | 0.0 | 0.0 | 11.4 |
5429+
| 7 | 31 | 01 August 2024 | | 11.55 | 11.27 | 0.13 | 0.0 | 0.0 | 11.4 | 0.0 | 0.0 | 0.0 | 11.4 |
5430+
| 8 | 31 | 01 September 2024| | 0.0 | 11.55 | 0.07 | 0.0 | 0.0 | 11.62 | 0.0 | 0.0 | 0.0 | 11.62 |
54255431
Then Loan Repayment schedule has the following data in Total row:
54265432
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
54275433
| 100.0 | 2.64 | 0.0 | 0.0 | 102.64 | 34.02 | 0.0 | 0.0 | 68.62 |
@@ -5508,7 +5514,7 @@ Feature: LoanReAging
55085514
| frequencyNumber | frequencyType | startDate | numberOfInstallments |
55095515
| 1 | MONTHS | 31 December 2023 | 6 |
55105516

5511-
@TestRailId:C4156 @AdvancedPaymentAllocation
5517+
@Skip @TestRailId:C4156 @AdvancedPaymentAllocation
55125518
Scenario: Verify allowing Re-aging on interest bearing loan - Interest calculation: Default Behavior - Verify backdated re-aging on the day of repayment with interest recalculation enabled - UC16.3
55135519
When Admin sets the business date to "01 January 2024"
55145520
When Admin creates a client with random data

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

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,3 +1134,57 @@ Feature: LoanReschedule
11341134
Then LoanRescheduledDueAdjustScheduleBusinessEvent is raised on "24 July 2025"
11351135

11361136

1137+
@TestRailId:temp
1138+
# // Step 0: Deploy code WITHOUT reprocess loan bug fix TODO how to do this?
1139+
Scenario: temp
1140+
# // Step 1: Update Business date to 2025/09/05
1141+
When Admin sets the business date to "05 September 2025"
1142+
And Admin creates a client with random data
1143+
# // Step 2: Create a loan for backbook. Term: 24M, interest 24.99 Disburse with amount 1111 on 2024-12-31
1144+
And Admin creates a fully customized loan with the following data:
1145+
| 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 |
1146+
| LP2_ADV_PYMNT_INTEREST_DAILY_EMI_ACTUAL_ACTUAL_ACCRUAL_ACTIVITY | 31 December 2024 | 1111 | 24.99 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 24 | MONTHS | 1 | MONTHS | 24 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION |
1147+
And Admin successfully approves the loan on "31 December 2024" with "1111" amount and expected disbursement date on "31 December 2024"
1148+
And Admin successfully disburse the loan on "31 December 2024" with "1111" EUR transaction amount
1149+
# // Step 3: Setup autopay for this loan (This can be optional if creating autopay payments manually)
1150+
# // Step 4: Repayments for 59.26 on 2025-01-31, 2025-02-28, 2025-03-31, 2025-04-30, 2025-05-30, 2025-06-29, 2025-07-31, 2025-08-31
1151+
And Customer makes "AUTOPAY" repayment on "31 January 2025" with 59.26 EUR transaction amount
1152+
And Customer makes "AUTOPAY" repayment on "28 February 2025" with 59.26 EUR transaction amount
1153+
And Customer makes "AUTOPAY" repayment on "31 March 2025" with 59.26 EUR transaction amount
1154+
And Customer makes "AUTOPAY" repayment on "30 April 2025" with 59.26 EUR transaction amount
1155+
And Customer makes "AUTOPAY" repayment on "30 May 2025" with 59.26 EUR transaction amount
1156+
And Customer makes "AUTOPAY" repayment on "29 June 2025" with 59.26 EUR transaction amount
1157+
And Customer makes "AUTOPAY" repayment on "31 July 2025" with 59.26 EUR transaction amount
1158+
And Customer makes "AUTOPAY" repayment on "31 August 2025" with 59.26 EUR transaction amount
1159+
# // Step 5: Update business date to next day (2025-09-06)
1160+
When Admin sets the business date to "06 September 2025"
1161+
# // Step 6: Run Inline COB for this loan
1162+
When Admin runs inline COB job for Loan
1163+
# // Step 7: Reverse the 2025-08-31 repayment on 2025-09-11
1164+
When Admin sets the business date to "11 September 2025"
1165+
When Customer undo "1"th "Repayment" transaction made on "31 August 2025"
1166+
# // Step 8: Change date to 2025-09-30
1167+
When Admin sets the business date to "30 September 2025"
1168+
# // Step 9: Run Inline COB (Create 2 autopays for installment amount 59.26 at this time)
1169+
And Customer makes "AUTOPAY" repayment on "30 September 2025" with 59.26 EUR transaction amount
1170+
And Customer makes "AUTOPAY" repayment on "30 September 2025" with 59.26 EUR transaction amount
1171+
When Admin runs inline COB job for Loan
1172+
# // Step 10: Reverse above 2 9/30 repayments on 10/10
1173+
When Admin sets the business date to "10 October 2025"
1174+
When Customer undo "1"th "Repayment" transaction made on "30 September 2025"
1175+
When Customer undo "2"th "Repayment" transaction made on "30 September 2025"
1176+
# // Step 11: Repayment of 60 on 2025-10-16
1177+
When Admin sets the business date to "16 October 2025"
1178+
And Customer makes "AUTOPAY" repayment on "16 October 2025" with 60 EUR transaction amount
1179+
# // Step 12: Change date to 2025-10-31
1180+
When Admin sets the business date to "31 October 2025"
1181+
# // Step 13: Run Inline COB (Create 2 autopays for amount 59.26 and 58.52 at this time)
1182+
And Customer makes "AUTOPAY" repayment on "31 October 2025" with 59.26 EUR transaction amount
1183+
And Customer makes "AUTOPAY" repayment on "31 October 2025" with 58.52 EUR transaction amount
1184+
When Admin runs inline COB job for Loan
1185+
# // Step 14: Change date to 2025-11-10. Deploy new code with the reprocess loan bug fix TODO how to do this?
1186+
When Admin sets the business date to "10 November 2025"
1187+
# // Step 15: Adjust schedule of 2025-11-30 by 2 months
1188+
When Admin creates and approves Loan reschedule with the following data:
1189+
| rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate |
1190+
| 30 November 2025 | 10 November 2025 | | | | 2 | |

0 commit comments

Comments
 (0)