Skip to content

Commit 4c66151

Browse files
oleksii-novikov-onixadamsaghy
authored andcommitted
FINERACT-1981: Charge-off on progressive loan when accounting is none
1 parent 710ba39 commit 4c66151

File tree

4 files changed

+72
-0
lines changed

4 files changed

+72
-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
@@ -69,6 +69,7 @@ public enum DefaultLoanProduct implements LoanProduct {
6969
LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_MULTIDISBURSE, //
7070
LP2_ADV_PYMNT_INTEREST_RECOGNITION_DISBURSEMENT_DAILY_EMI_360_30_ACCRUAL_ACTIVITY, //
7171
LP2_ADV_PYMNT_INTEREST_RECOGNITION_DISBURSEMENT_DAILY_EMI_ACTUAL_ACTUAL_ACCRUAL_ACTIVITY, //
72+
LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALCULATION_ACCOUNTING_RULE_NONE, //
7273
LP2_ADV_PAYMENT_ALLOC_INTEREST_RECALCULATION_DAILY_NO_CALC_ON_PAST_DUE_EMI_360_30_MULTIDISBURSE, //
7374
LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_MULTIDISBURSE_DOWNPAYMENT, //
7475
LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_DOWNPAYMENT, //

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import static org.apache.fineract.test.factory.LoanProductsRequestFactory.INTEREST_CALCULATION_PERIOD_TYPE_SAME_AS_REPAYMENT;
2323
import static org.apache.fineract.test.factory.LoanProductsRequestFactory.INTEREST_RATE_FREQUENCY_TYPE_MONTH;
2424
import static org.apache.fineract.test.factory.LoanProductsRequestFactory.INTEREST_RATE_FREQUENCY_TYPE_WHOLE_TERM;
25+
import static org.apache.fineract.test.factory.LoanProductsRequestFactory.LOAN_ACCOUNTING_RULE_NONE;
2526
import static org.apache.fineract.test.factory.LoanProductsRequestFactory.REPAYMENT_FREQUENCY_TYPE_MONTHS;
2627

2728
import java.math.BigDecimal;
@@ -1861,6 +1862,34 @@ public void initialize() throws Exception {
18611862
TestContext.INSTANCE.set(
18621863
TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_RECOGNITION_DISBURSEMENT_DAILY_EMI_ACTUAL_ACTUAL_ACCRUAL_ACTIVITY,
18631864
responseLoanProductsRequestLP2AdvancedPaymentInterestInterestRecognitionOnDisbursementEmiActualActualAccrualActivity);
1865+
1866+
// LP2 with progressive loan schedule + horizontal + interest EMI + 360/30
1867+
// + interest recalculation, preClosureInterestCalculationStrategy= till preclose, accountingRule = NONE
1868+
// interestRecalculationCompoundingMethod = none
1869+
// Frequency for recalculate Outstanding Principal: Daily, Frequency Interval for recalculation: 1
1870+
// (LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALCULATION_ACCOUNTING_RULE_NONE)
1871+
String name78 = DefaultLoanProduct.LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALCULATION_ACCOUNTING_RULE_NONE.getName();
1872+
PostLoanProductsRequest loanProductsRequestLP2AdvancedpaymentInterestEmi36030InterestRecalcAccountingRuleNone = loanProductsRequestFactory
1873+
.defaultLoanProductsRequestLP2Emi()//
1874+
.name(name78)//
1875+
.daysInYearType(DaysInYearType.DAYS360.value)//
1876+
.daysInMonthType(DaysInMonthType.DAYS30.value)//
1877+
.isInterestRecalculationEnabled(true)//
1878+
.preClosureInterestCalculationStrategy(1)//
1879+
.rescheduleStrategyMethod(4)//
1880+
.interestRecalculationCompoundingMethod(0)//
1881+
.recalculationRestFrequencyType(2)//
1882+
.recalculationRestFrequencyInterval(1)//
1883+
.accountingRule(LOAN_ACCOUNTING_RULE_NONE).chargeOffBehaviour("REGULAR").paymentAllocation(List.of(//
1884+
createPaymentAllocation("DEFAULT", "NEXT_INSTALLMENT"), //
1885+
createPaymentAllocation("GOODWILL_CREDIT", "LAST_INSTALLMENT"), //
1886+
createPaymentAllocation("MERCHANT_ISSUED_REFUND", "REAMORTIZATION"), //
1887+
createPaymentAllocation("PAYOUT_REFUND", "NEXT_INSTALLMENT")));//
1888+
Response<PostLoanProductsResponse> responseLoanProductsRequestLP2AdvancedpaymentInterest36030InterestRecalcAccountingRuleNone = loanProductsApi
1889+
.createLoanProduct(loanProductsRequestLP2AdvancedpaymentInterestEmi36030InterestRecalcAccountingRuleNone).execute();
1890+
TestContext.INSTANCE.set(
1891+
TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALCULATION_ACCOUNTING_RULE_NONE,
1892+
responseLoanProductsRequestLP2AdvancedpaymentInterest36030InterestRecalcAccountingRuleNone);
18641893
}
18651894

18661895
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
@@ -90,6 +90,7 @@ public abstract class TestContextKey {
9090
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_EMI_ACTUAL_ACTUAL_ACCRUAL_ACTIVITY = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyEmiActualActualAccrualActivity";
9191
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30 = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyEmi36030";
9292
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALCULATION_DAILY_TILL_PRECLOSE = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyEmi36030InterestRecalculationDailyTillPreClose";
93+
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALCULATION_ACCOUNTING_RULE_NONE = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyEmi36030InterestRecalculationAccountingRuleNone";
9394
public static final String temp = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyEmi36030InterestRecalculationDailyNoCalcOnPastDueTillPreClose";
9495
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALCULATION_DAILY_TILL_PRECLOSE_LAST_INSTALLMENT = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyEmi36030InterestRecalculationDailyTillPreCloseLastInstallment";
9596
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALCULATION_DAILY_TILL_PRECLOSE_PMT_ALLOC_1 = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyEmi36030InterestRecalculationDailyTillPreClosePmtAlloc1";

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

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6433,3 +6433,44 @@ Feature: Charge-off
64336433
| 16 January 2024 | Accrual | 0.53 | 0.0 | 0.53 | 0.0 | 0.0 | 0.0 | false | false |
64346434
| 17 January 2024 | Accrual | 0.52 | 0.0 | 0.52 | 0.0 | 0.0 | 0.0 | false | false |
64356435
| 17 January 2024 | Charge-off | 787.64 | 746.09 | 41.55 | 0.0 | 0.0 | 0.0 | false | false |
6436+
6437+
@TestRailId:C3519
6438+
Scenario: Charge-off on progressive loan when accounting is none
6439+
When Admin sets the business date to "1 January 2024"
6440+
And Admin creates a client with random data
6441+
And Admin creates a fully customized loan with the following data:
6442+
| 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 |
6443+
| LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALCULATION_ACCOUNTING_RULE_NONE | 01 January 2024 | 100 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION |
6444+
Then Loan Repayment schedule has 6 periods, with the following data for periods:
6445+
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
6446+
| | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | | | | 0.0 |
6447+
| 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 |
6448+
| 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 |
6449+
| 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 |
6450+
| 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 |
6451+
| 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 |
6452+
| 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 |
6453+
Then Loan Repayment schedule has the following data in Total row:
6454+
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
6455+
| 100 | 2.05 | 0 | 0 | 102.05 | 0 | 0 | 0 | 102.05 |
6456+
And Admin successfully approves the loan on "1 January 2024" with "100" amount and expected disbursement date on "1 January 2024"
6457+
And Admin successfully disburse the loan on "1 January 2024" with "100" EUR transaction amount
6458+
When Admin sets the business date to "15 January 2024"
6459+
And Customer makes "AUTOPAY" repayment on "15 January 2024" with 17.01 EUR transaction amount
6460+
When Admin sets the business date to "01 March 2024"
6461+
And Admin does charge-off the loan on "01 March 2024"
6462+
Then Loan Repayment schedule has 6 periods, with the following data for periods:
6463+
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
6464+
| | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
6465+
| 1 | 31 | 01 February 2024 | 15 January 2024 | 83.25 | 16.75 | 0.26 | 0.0 | 0.0 | 17.01 | 17.01 | 17.01 | 0.0 | 0.0 |
6466+
| 2 | 29 | 01 March 2024 | | 67.0 | 16.25 | 0.76 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
6467+
| 3 | 31 | 01 April 2024 | | 50.38 | 16.62 | 0.39 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
6468+
| 4 | 30 | 01 May 2024 | | 33.66 | 16.72 | 0.29 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
6469+
| 5 | 31 | 01 June 2024 | | 16.85 | 16.81 | 0.2 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
6470+
| 6 | 30 | 01 July 2024 | | 0.0 | 16.85 | 0.1 | 0.0 | 0.0 | 16.95 | 0.0 | 0.0 | 0.0 | 16.95 |
6471+
And Loan Transactions tab has the following data:
6472+
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
6473+
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false |
6474+
| 01 January 2024 | Accrual | 2.05 | 0.0 | 2.05 | 0.0 | 0.0 | 0.0 | false | false |
6475+
| 15 January 2024 | Repayment | 17.01 | 16.75 | 0.26 | 0.0 | 0.0 | 83.25 | false | false |
6476+
| 01 March 2024 | Charge-off | 84.99 | 83.25 | 1.74 | 0.0 | 0.0 | 0.0 | false | false |

0 commit comments

Comments
 (0)