This is an automated email from the ASF dual-hosted git repository.

adamsaghy 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 37f60ad8dc FINERACT-2174: Added tests for validation of calculation of 
fraction period in case if interestRecognitionFromDisbursementDate is set to 
true
37f60ad8dc is described below

commit 37f60ad8dc49dce6f63bb2a951fbd330707654e7
Author: Rustam Zeinalov <[email protected]>
AuthorDate: Mon Feb 24 14:43:25 2025 +0100

    FINERACT-2174: Added tests for validation of calculation of fraction period 
in case if interestRecognitionFromDisbursementDate is set to true
---
 .../test/data/loanproduct/DefaultLoanProduct.java  |  1 +
 .../global/LoanProductGlobalInitializerStep.java   | 29 +++++++++++++++
 .../fineract/test/support/TestContextKey.java      |  1 +
 .../resources/features/LoanAccrualActivity.feature | 42 ++++++++++++++++++++++
 4 files changed, 73 insertions(+)

diff --git 
a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/data/loanproduct/DefaultLoanProduct.java
 
b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/data/loanproduct/DefaultLoanProduct.java
index 75737b4516..6b28a04e1e 100644
--- 
a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/data/loanproduct/DefaultLoanProduct.java
+++ 
b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/data/loanproduct/DefaultLoanProduct.java
@@ -68,6 +68,7 @@ public enum DefaultLoanProduct implements LoanProduct {
     LP2_ADV_PYMNT_INTEREST_DAILY_EMI_ACTUAL_ACTUAL_INTEREST_REFUND_FULL, //
     LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_MULTIDISBURSE, //
     
LP2_ADV_PYMNT_INTEREST_RECOGNITION_DISBURSEMENT_DAILY_EMI_360_30_ACCRUAL_ACTIVITY,
 //
+    
LP2_ADV_PYMNT_INTEREST_RECOGNITION_DISBURSEMENT_DAILY_EMI_ACTUAL_ACTUAL_ACCRUAL_ACTIVITY,
 //
     
LP2_ADV_PAYMENT_ALLOC_INTEREST_RECALCULATION_DAILY_NO_CALC_ON_PAST_DUE_EMI_360_30_MULTIDISBURSE,
 //
     LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_MULTIDISBURSE_DOWNPAYMENT, //
     LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_DOWNPAYMENT, //
diff --git 
a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/initializer/global/LoanProductGlobalInitializerStep.java
 
b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/initializer/global/LoanProductGlobalInitializerStep.java
index 1f1b97bf67..ddbee9a013 100644
--- 
a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/initializer/global/LoanProductGlobalInitializerStep.java
+++ 
b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/initializer/global/LoanProductGlobalInitializerStep.java
@@ -1832,6 +1832,35 @@ public class LoanProductGlobalInitializerStep implements 
FineractGlobalInitializ
         TestContext.INSTANCE.set(
                 
TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_RECOGNITION_DISBURSEMENT_DAILY_EMI_360_30_ACCRUAL_ACTIVITY,
                 
responseLoanProductsRequestLP2AdvancedPaymentInterestInterestRecognitionOnDisbursementEmi36030AccrualActivity);
+
+        // LP2 with progressive loan schedule + horizontal + interest EMI + 
interestRecognitionOnDisbursementDate = true
+        // + 360/30 + accrual activity
+        String name77 = 
DefaultLoanProduct.LP2_ADV_PYMNT_INTEREST_RECOGNITION_DISBURSEMENT_DAILY_EMI_ACTUAL_ACTUAL_ACCRUAL_ACTIVITY
+                .getName();
+        PostLoanProductsRequest 
loanProductsRequestLP2AdvancedPaymentInterestRecognitionOnDisbursementEmiActualActual30AccrualActivity
 = loanProductsRequestFactory
+                .defaultLoanProductsRequestLP2Emi()//
+                .name(name77)//
+                .enableAccrualActivityPosting(true)//
+                .daysInYearType(DaysInYearType.ACTUAL.value)//
+                .daysInMonthType(DaysInMonthType.ACTUAL.value)//
+                .isInterestRecalculationEnabled(true)//
+                .preClosureInterestCalculationStrategy(1)//
+                .rescheduleStrategyMethod(4)//
+                .interestRecalculationCompoundingMethod(0)//
+                .recalculationRestFrequencyType(2)//
+                .recalculationRestFrequencyInterval(1)//
+                .interestRecognitionOnDisbursementDate(true)//
+                .paymentAllocation(List.of(//
+                        createPaymentAllocation("DEFAULT", 
"NEXT_INSTALLMENT"), //
+                        createPaymentAllocation("GOODWILL_CREDIT", 
"LAST_INSTALLMENT"), //
+                        createPaymentAllocation("MERCHANT_ISSUED_REFUND", 
"REAMORTIZATION"), //
+                        createPaymentAllocation("PAYOUT_REFUND", 
"NEXT_INSTALLMENT")));//
+        Response<PostLoanProductsResponse> 
responseLoanProductsRequestLP2AdvancedPaymentInterestInterestRecognitionOnDisbursementEmiActualActualAccrualActivity
 = loanProductsApi
+                
.createLoanProduct(loanProductsRequestLP2AdvancedPaymentInterestRecognitionOnDisbursementEmiActualActual30AccrualActivity)
+                .execute();
+        TestContext.INSTANCE.set(
+                
TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_RECOGNITION_DISBURSEMENT_DAILY_EMI_ACTUAL_ACTUAL_ACCRUAL_ACTIVITY,
+                
responseLoanProductsRequestLP2AdvancedPaymentInterestInterestRecognitionOnDisbursementEmiActualActualAccrualActivity);
     }
 
     public static AdvancedPaymentData createPaymentAllocation(String 
transactionType, String futureInstallmentAllocationRule,
diff --git 
a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/support/TestContextKey.java
 
b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/support/TestContextKey.java
index 113dd1e1d1..96bbae8ec2 100644
--- 
a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/support/TestContextKey.java
+++ 
b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/support/TestContextKey.java
@@ -122,6 +122,7 @@ public abstract class TestContextKey {
     public static final String 
DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_ACCRUAL_ACTIVITY
 = 
"loanProductCreateResponseLP2AdvancedPaymentInterestDailyEmi36030AccrualActivity";
     public static final String 
DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_ACCELERATE_MATURITY_CHARGE_OFF_BEHAVIOUR
 = 
"loanProductCreateResponseLP2AdvancedPaymentAccelerateMaturityChargeOffBehaviour";
     public static final String 
DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_RECOGNITION_DISBURSEMENT_DAILY_EMI_360_30_ACCRUAL_ACTIVITY
 = 
"loanProductCreateResponseLP2AdvancedPaymentInterestRecognitionDisbursementDailyEmi36030AccrualActivity";
+    public static final String 
DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_RECOGNITION_DISBURSEMENT_DAILY_EMI_ACTUAL_ACTUAL_ACCRUAL_ACTIVITY
 = 
"loanProductCreateResponseLP2AdvancedPaymentInterestRecognitionDisbursementDailyEmiActualActualAccrualActivity";
     public static final String 
DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_INTEREST_RECALC_EMI_360_30_CHARGEBACK_INTEREST_PENALTY_FEE_PRINCIPAL
 = 
"loanProductCreateResponseLP2AdvancedPaymentInterestDailyInterestRecalcEmi36030ChargebackInterestPenaltyFeePrincipal";
     public static final String 
DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_INTEREST_RECALC_EMI_360_30_CHARGEBACK_INTEREST_FEE_PRINCIPAL
 = 
"loanProductCreateResponseLP2AdvancedPaymentInterestDailyInterestRecalcEmi36030ChargebackInterestFeePrincipal";
     public static final String 
DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_INTEREST_RECALC_EMI_360_30_CHARGEBACK_PRINCIPAL_INTEREST_FEE
 = 
"loanProductCreateResponseLP2AdvancedPaymentInterestDailyInterestRecalcEmi36030ChargebackPrincipalInterestFee";
diff --git 
a/fineract-e2e-tests-runner/src/test/resources/features/LoanAccrualActivity.feature
 
b/fineract-e2e-tests-runner/src/test/resources/features/LoanAccrualActivity.feature
index 68ba023506..2e8f17d92a 100644
--- 
a/fineract-e2e-tests-runner/src/test/resources/features/LoanAccrualActivity.feature
+++ 
b/fineract-e2e-tests-runner/src/test/resources/features/LoanAccrualActivity.feature
@@ -4998,3 +4998,45 @@ Feature: LoanAccrualActivity
       | NSF fee | true      | Specified due date | 10 January 2025  | Flat     
        | 20.0 | 20.0  | 0.0    | 0.0        |
     When Global config "charge-accrual-date" value set to "due-date"
 
+  @TestRailId:C3507
+  Scenario: Verify calculation of fraction period in case 
`interestRecognitionFromDisbursementDate` is true
+    When Admin sets the business date to "13 November 2023"
+    When Admin creates a client with random data
+    When 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_RECOGNITION_DISBURSEMENT_DAILY_EMI_ACTUAL_ACTUAL_ACCRUAL_ACTIVITY
 | 13 November 2023  | 5000           | 9.99                   | 
DECLINING_BALANCE | DAILY                       | EQUAL_INSTALLMENTS | 6        
         | MONTHS                | 1              | MONTHS                 | 6  
                | 0                       | 0                      | 0          
          | ADVANCED_PAYMENT_ALLOCATION |
+    And Admin successfully approves the loan on "13 November 2023" with "5000" 
amount and expected disbursement date on "13 November 2023"
+    When Admin successfully disburse the loan on "13 November 2023" with 
"5000" 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 |
+      |    |      | 13 November 2023 |           | 5000.0          |           
    |          | 0.0  |           | 0.0    | 0.0  |            |      |         
    |
+      | 1  | 30   | 13 December 2023 |           | 4183.33            | 816.67 
       | 41.05    | 0.0  | 0.0       | 857.72 | 0.0  | 0.0        | 0.0  | 
857.72      |
+      | 2  | 31   | 13 January 2024  |           | 3361.07         | 822.26    
    | 35.46    | 0.0  | 0.0       | 857.72 | 0.0  | 0.0        | 0.0  | 857.72  
    |
+      | 3  | 31   | 13 February 2024 |           | 2531.79         | 829.28    
    | 28.44       | 0.0  | 0.0       | 857.72 | 0.0  | 0.0        | 0.0  | 
857.72      |
+      | 4  | 29   | 13 March 2024    |           | 1694.11            | 837.68 
       | 20.04    | 0.0  | 0.0       | 857.72 | 0.0  | 0.0        | 0.0  | 
857.72      |
+      | 5  | 31   | 13 April 2024    |           | 850.72             | 843.39 
       | 14.33    | 0.0  | 0.0       | 857.72 | 0.0  | 0.0        | 0.0  | 
857.72      |
+      | 6  | 30   | 13 May 2024      |           | 0.0             | 850.72    
    | 6.97        | 0.0  | 0.0       | 857.69 | 0.0  | 0.0        | 0.0  | 
857.69      |
+    Then Loan Repayment schedule has the following data in Total row:
+      | Principal due | Interest | Fees | Penalties | Due     | Paid | In 
advance | Late | Outstanding |
+      | 5000.0        | 146.29   | 0.0  | 0.0      | 5146.29 | 0.0  | 0.0      
 | 0.0  | 5146.29     |
+    Then Loan Transactions tab has the following data:
+      | Transaction date | Transaction Type | Amount | Principal | Interest | 
Fees | Penalties | Loan Balance | Reverted | Replayed |
+      | 13 November 2023 | Disbursement     | 5000.0 | 0.0       | 0.0      | 
0.0  | 0.0       | 5000.0       | false    | false    |
+    When Admin sets the business date to "10 December 2023"
+    And Customer makes "AUTOPAY" repayment on "10 December 2023" with 857.72 
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 |
+      |    |      | 13 November 2023 |                  | 5000.0          |    
           |          | 0.0  |           | 0.0    | 0.0    |            |      
|             |
+      | 1  | 30   | 13 December 2023 | 10 December 2023 | 4179.23         | 
820.77        | 36.95    | 0.0  | 0.0       | 857.72 | 857.72 |  857.72    | 
0.0  | 0.0         |
+      | 2  | 31   | 13 January 2024  |                  | 3360.36         | 
818.87        | 38.85    | 0.0  | 0.0       | 857.72 | 0.0    | 0.0        | 
0.0  | 857.72      |
+      | 3  | 31   | 13 February 2024 |                  | 2531.07         | 
829.29        | 28.43    | 0.0  | 0.0       | 857.72 | 0.0    | 0.0        | 
0.0  | 857.72      |
+      | 4  | 29   | 13 March 2024    |                  | 1693.38         | 
837.69        | 20.03    | 0.0  | 0.0       | 857.72 | 0.0    | 0.0        | 
0.0  | 857.72      |
+      | 5  | 31   | 13 April 2024    |                  | 849.99          | 
843.39        | 14.33    | 0.0  | 0.0       | 857.72 | 0.0    | 0.0        | 
0.0  | 857.72      |
+      | 6  | 30   | 13 May 2024      |                  | 0.0             | 
849.99        | 6.96     | 0.0  | 0.0       | 856.95 | 0.0    | 0.0        | 
0.0  | 856.95      |
+    Then Loan Repayment schedule has the following data in Total row:
+      | Principal due | Interest | Fees | Penalties | Due     | Paid   | In 
advance | Late | Outstanding |
+      | 5000.0        | 145.55   | 0.0  | 0.0       | 5145.55 | 857.72 | 
857.72     | 0.0  | 4287.83     |
+    Then Loan Transactions tab has the following data:
+      | Transaction date  | Transaction Type | Amount | Principal | Interest | 
Fees | Penalties | Loan Balance | Reverted | Replayed |
+      | 13 November 2023  | Disbursement     | 5000.0 | 0.0       | 0.0      | 
0.0  | 0.0       | 5000.0       | false    | false    |
+      | 10 December 2023  | Repayment        | 857.72 | 820.77    | 36.95    | 
0.0  | 0.0       | 4179.23      | false    | false    |
\ No newline at end of file

Reply via email to