Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FINERACT-2174: Added tests for validation of calculation of fraction period in case if interestRecognitionFromDisbursementDate is set to true #4375

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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, //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1832,6 +1832,35 @@ public void initialize() throws Exception {
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4999,3 +4999,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 |
Loading