FINERACT-2148: added e2e test covering charge-off after backdated repayment for cumulative loan
This commit is contained in:
committed by
Adam Saghy
parent
acabf16003
commit
65b74ee87b
+1
@@ -40,6 +40,7 @@ public enum DefaultLoanProduct implements LoanProduct {
|
||||
LP1_PAYMENT_STRATEGY_DUE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE_INTEREST_FLAT, //
|
||||
LP1_INTEREST_FLAT_OVERDUE_FROM_AMOUNT, //
|
||||
LP1_INTEREST_FLAT_OVERDUE_FROM_AMOUNT_INTEREST, //
|
||||
LP1_INTEREST_360_30_DECLINING_BALANCE_PERIOD_DAILY_INT_RECALC, //
|
||||
LP2_DOWNPAYMENT, //
|
||||
LP2_DOWNPAYMENT_AUTO, //
|
||||
LP2_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION, //
|
||||
|
||||
+12
@@ -1961,6 +1961,18 @@ public class LoanProductGlobalInitializerStep implements FineractGlobalInitializ
|
||||
.createLoanProduct(loanProductsRequestInterestDecliningPeriodDailyIntRecalc).execute();
|
||||
TestContext.INSTANCE.set(TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP1_INTEREST_DECLINING_PERIOD_DAILY_INT_RECALC,
|
||||
responseInterestDecliningPeriodDailyIntRecalc);
|
||||
|
||||
// LP1 with 12% DECLINING BALANCE interest, interest period: Daily, interest recalculation enabled, 360/30
|
||||
// (LP1_INTEREST_DECLINING_BALANCE_PERIOD_DAILY_INT_RECALC)
|
||||
final String name82 = DefaultLoanProduct.LP1_INTEREST_360_30_DECLINING_BALANCE_PERIOD_DAILY_INT_RECALC.getName();
|
||||
final PostLoanProductsRequest loanProductsRequestInterest36030DecliningPeriodDailyIntRecalc = loanProductsRequestFactory
|
||||
.defaultLoanProductsRequestLP1InterestDeclining().name(name82).isInterestRecalculationEnabled(false)
|
||||
.daysInYearType(DaysInYearType.DAYS360.value).daysInMonthType(DaysInMonthType.DAYS30.value)
|
||||
.interestCalculationPeriodType(InterestCalculationPeriodTime.DAILY.value).allowPartialPeriodInterestCalcualtion(false);
|
||||
final Response<PostLoanProductsResponse> responseInterest36030DecliningPeriodDailyIntRecalc = loanProductsApi
|
||||
.createLoanProduct(loanProductsRequestInterest36030DecliningPeriodDailyIntRecalc).execute();
|
||||
TestContext.INSTANCE.set(TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP1_INTEREST_360_30__DECLINING_PERIOD_DAILY_INT_RECALC,
|
||||
responseInterest36030DecliningPeriodDailyIntRecalc);
|
||||
}
|
||||
|
||||
public static AdvancedPaymentData createPaymentAllocation(String transactionType, String futureInstallmentAllocationRule,
|
||||
|
||||
+1
@@ -69,6 +69,7 @@ public abstract class TestContextKey {
|
||||
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP1_INTEREST_DECLINING_BALANCE_DAILY_RECALCULATION_COMPOUNDING_NONE_RESCHEDULE_NEXT_REPAYMENTS = "loanProductCreateResponseLP1InterestDecliningBalanceDailyRecalculationCompoundingNoneRescheduleNextRepayments";
|
||||
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP1_INTEREST_DECLINING_PERIOD_DAILY = "loanProductCreateResponseLP1InterestDecliningPeriodDaily";
|
||||
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP1_INTEREST_DECLINING_PERIOD_DAILY_INT_RECALC = "loanProductCreateResponseLP1InterestDecliningPeriodDailyIntRecalc";
|
||||
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP1_INTEREST_360_30__DECLINING_PERIOD_DAILY_INT_RECALC = "loanProductCreateResponseLP1Interest36030DecliningPeriodDailyIntRecalc";
|
||||
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP1_INTEREST_DECLINING_PERIOD_DAILY_ACCRUAL_ACTIVITY = "loanProductCreateResponseLP1InterestDecliningPeriodDailyAccrualActivity";
|
||||
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP1_INTEREST_DECLINING_BALANCE_DAILY_RECALCULATION_COMPOUNDING_NONE_ACCRUAL_ACTIVITY = "loanProductCreateResponseLP1InterestDecliningBalanceRecalculationCompoundingNoneAccrualActivity";
|
||||
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION = "loanProductCreateResponseLP2DownPaymentAutoAdvancedPaymentAllocation";
|
||||
|
||||
@@ -1311,6 +1311,7 @@ Feature: Charge-off
|
||||
| 04 January 2023 | Charge-off | 1010.19 | 1000.0 | 10.19 | 0.0 | 0.0 | 0.0 |
|
||||
| 06 January 2023 | Repayment | 1010.19 | 1000.0 | 10.19 | 0.0 | 0.0 | 0.0 |
|
||||
|
||||
@TestRailId:C3545
|
||||
Scenario: Accrual handling in case of charged-off loan when charge-off behavior is regular, interestRecalculation = true, cumulative loan
|
||||
When Admin sets the business date to "1 January 2024"
|
||||
And Admin creates a client with random data
|
||||
@@ -7449,3 +7450,95 @@ Feature: Charge-off
|
||||
| 14 February 2024 | Accrual Adjustment | 0.04 | 0.0 | 0.04 | 0.0 | 0.0 | 0.0 | false | false |
|
||||
| 14 February 2024 | Charge-off | 83.79 | 83.57 | 0.22 | 0.0 | 0.0 | 0.0 | false | true |
|
||||
Then LoanAccrualAdjustmentTransactionBusinessEvent is raised on "14 February 2024"
|
||||
|
||||
@TestRailId:C3559
|
||||
Scenario: Reverse-replay Charge-off with accrual adjustment due to backdated payment
|
||||
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 |
|
||||
| LP1_INTEREST_360_30_DECLINING_BALANCE_PERIOD_DAILY_INT_RECALC | 01 January 2024 | 1000 | 26 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 4 | MONTHS | 1 | MONTHS | 4 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER |
|
||||
And Admin successfully approves the loan on "1 January 2024" with "1000" amount and expected disbursement date on "1 January 2024"
|
||||
And Admin successfully disburse the loan on "1 January 2024" with "1000" EUR transaction amount
|
||||
Then Loan Repayment schedule has 4 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 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
|
||||
| 1 | 31 | 01 February 2024 | | 757.67 | 242.33 | 21.67 | 0.0 | 0.0 | 264.0 | 0.0 | 0.0 | 0.0 | 264.0 |
|
||||
| 2 | 29 | 01 March 2024 | | 510.09 | 247.58 | 16.42 | 0.0 | 0.0 | 264.0 | 0.0 | 0.0 | 0.0 | 264.0 |
|
||||
| 3 | 31 | 01 April 2024 | | 257.14 | 252.95 | 11.05 | 0.0 | 0.0 | 264.0 | 0.0 | 0.0 | 0.0 | 264.0 |
|
||||
| 4 | 30 | 01 May 2024 | | 0.0 | 257.14 | 5.57 | 0.0 | 0.0 | 262.71 | 0.0 | 0.0 | 0.0 | 262.71 |
|
||||
Then Loan Repayment schedule has the following data in Total row:
|
||||
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
|
||||
| 1000 | 54.71 | 0 | 0 | 1054.71 | 0.0 | 0.0 | 0.0 | 1054.71 |
|
||||
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 | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | false |
|
||||
# Run COB for each day from Jan 1 to Jan 19 to create accrual entries
|
||||
When Admin sets the business date to "3 January 2024"
|
||||
When Admin runs inline COB job for Loan
|
||||
Then Loan Repayment schedule has 4 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 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
|
||||
| 1 | 31 | 01 February 2024 | | 757.67 | 242.33 | 21.67 | 0.0 | 0.0 | 264.0 | 0.0 | 0.0 | 0.0 | 264.0 |
|
||||
| 2 | 29 | 01 March 2024 | | 510.09 | 247.58 | 16.42 | 0.0 | 0.0 | 264.0 | 0.0 | 0.0 | 0.0 | 264.0 |
|
||||
| 3 | 31 | 01 April 2024 | | 257.14 | 252.95 | 11.05 | 0.0 | 0.0 | 264.0 | 0.0 | 0.0 | 0.0 | 264.0 |
|
||||
| 4 | 30 | 01 May 2024 | | 0.0 | 257.14 | 5.57 | 0.0 | 0.0 | 262.71 | 0.0 | 0.0 | 0.0 | 262.71 |
|
||||
Then Loan Repayment schedule has the following data in Total row:
|
||||
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
|
||||
| 1000 | 54.71 | 0 | 0 | 1054.71 | 0.0 | 0.0 | 0.0 | 1054.71 |
|
||||
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 | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | false |
|
||||
| 02 January 2024 | Accrual | 0.7 | 0.0 | 0.7 | 0.0 | 0.0 | 0.0 | false | false |
|
||||
When Admin sets the business date to "20 January 2024"
|
||||
When Admin runs inline COB job for Loan
|
||||
When Admin sets the business date to "15 January 2024"
|
||||
And Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "15 January 2024" with 264 EUR transaction amount and system-generated Idempotency key and check external owner
|
||||
Then Loan Repayment schedule has 4 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 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
|
||||
| 1 | 31 | 01 February 2024 | 15 January 2024 | 757.67 | 242.33 | 21.67 | 0.0 | 0.0 | 264.0 | 264.0 | 264.0 | 0.0 | 0.0 |
|
||||
| 2 | 29 | 01 March 2024 | | 510.09 | 247.58 | 16.42 | 0.0 | 0.0 | 264.0 | 0.0 | 0.0 | 0.0 | 264.0 |
|
||||
| 3 | 31 | 01 April 2024 | | 257.14 | 252.95 | 11.05 | 0.0 | 0.0 | 264.0 | 0.0 | 0.0 | 0.0 | 264.0 |
|
||||
| 4 | 30 | 01 May 2024 | | 0.0 | 257.14 | 5.57 | 0.0 | 0.0 | 262.71 | 0.0 | 0.0 | 0.0 | 262.71 |
|
||||
Then Loan Repayment schedule has the following data in Total row:
|
||||
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
|
||||
| 1000 | 54.71 | 0 | 0 | 1054.71 | 264.0 | 264.0 | 0.0 | 790.71 |
|
||||
When Admin sets the business date to "20 January 2024"
|
||||
And Admin does charge-off the loan on "20 January 2024"
|
||||
Then Loan Repayment schedule has 4 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 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
|
||||
| 1 | 31 | 01 February 2024 | 15 January 2024 | 757.67 | 242.33 | 21.67 | 0.0 | 0.0 | 264.0 | 264.0 | 264.0 | 0.0 | 0.0 |
|
||||
| 2 | 29 | 01 March 2024 | | 510.09 | 247.58 | 16.42 | 0.0 | 0.0 | 264.0 | 0.0 | 0.0 | 0.0 | 264.0 |
|
||||
| 3 | 31 | 01 April 2024 | | 257.14 | 252.95 | 11.05 | 0.0 | 0.0 | 264.0 | 0.0 | 0.0 | 0.0 | 264.0 |
|
||||
| 4 | 30 | 01 May 2024 | | 0.0 | 257.14 | 5.57 | 0.0 | 0.0 | 262.71 | 0.0 | 0.0 | 0.0 | 262.71 |
|
||||
Then Loan Repayment schedule has the following data in Total row:
|
||||
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
|
||||
| 1000 | 54.71 | 0 | 0 | 1054.71 | 264.0 | 264.0 | 0.0 | 790.71 |
|
||||
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 | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | false |
|
||||
| 02 January 2024 | Accrual | 0.7 | 0.0 | 0.7 | 0.0 | 0.0 | 0.0 | false | false |
|
||||
| 03 January 2024 | Accrual | 0.7 | 0.0 | 0.7 | 0.0 | 0.0 | 0.0 | false | false |
|
||||
| 04 January 2024 | Accrual | 0.7 | 0.0 | 0.7 | 0.0 | 0.0 | 0.0 | false | false |
|
||||
| 05 January 2024 | Accrual | 0.7 | 0.0 | 0.7 | 0.0 | 0.0 | 0.0 | false | false |
|
||||
| 06 January 2024 | Accrual | 0.7 | 0.0 | 0.7 | 0.0 | 0.0 | 0.0 | false | false |
|
||||
| 07 January 2024 | Accrual | 0.69 | 0.0 | 0.69 | 0.0 | 0.0 | 0.0 | false | false |
|
||||
| 08 January 2024 | Accrual | 0.7 | 0.0 | 0.7 | 0.0 | 0.0 | 0.0 | false | false |
|
||||
| 09 January 2024 | Accrual | 0.7 | 0.0 | 0.7 | 0.0 | 0.0 | 0.0 | false | false |
|
||||
| 10 January 2024 | Accrual | 0.7 | 0.0 | 0.7 | 0.0 | 0.0 | 0.0 | false | false |
|
||||
| 11 January 2024 | Accrual | 0.7 | 0.0 | 0.7 | 0.0 | 0.0 | 0.0 | false | false |
|
||||
| 12 January 2024 | Accrual | 0.7 | 0.0 | 0.7 | 0.0 | 0.0 | 0.0 | false | false |
|
||||
| 13 January 2024 | Accrual | 0.7 | 0.0 | 0.7 | 0.0 | 0.0 | 0.0 | false | false |
|
||||
| 14 January 2024 | Accrual | 0.7 | 0.0 | 0.7 | 0.0 | 0.0 | 0.0 | false | false |
|
||||
| 15 January 2024 | Accrual | 0.7 | 0.0 | 0.7 | 0.0 | 0.0 | 0.0 | false | false |
|
||||
| 15 January 2024 | Repayment | 264.0 | 242.33 | 21.67 | 0.0 | 0.0 | 757.67 | false | false |
|
||||
| 16 January 2024 | Accrual | 0.7 | 0.0 | 0.7 | 0.0 | 0.0 | 0.0 | false | false |
|
||||
| 17 January 2024 | Accrual | 0.69 | 0.0 | 0.69 | 0.0 | 0.0 | 0.0 | false | false |
|
||||
| 18 January 2024 | Accrual | 0.7 | 0.0 | 0.7 | 0.0 | 0.0 | 0.0 | false | false |
|
||||
| 19 January 2024 | Accrual | 0.7 | 0.0 | 0.7 | 0.0 | 0.0 | 0.0 | false | false |
|
||||
| 20 January 2024 | Accrual Adjustment | 12.58 | 0.0 | 12.58 | 0.0 | 0.0 | 0.0 | false | false |
|
||||
| 20 January 2024 | Charge-off | 790.71 | 757.67 | 33.04 | 0.0 | 0.0 | 0.0 | false | false |
|
||||
Then Loan marked as charged-off on "20 January 2024"
|
||||
Then LoanAccrualAdjustmentTransactionBusinessEvent is raised on "20 January 2024"
|
||||
Reference in New Issue
Block a user