From 28fbaa920d508eee158323edffc9ff15f10e80e4 Mon Sep 17 00:00:00 2001 From: MarianaDmytrivBinariks Date: Fri, 20 Jun 2025 18:06:57 +0300 Subject: [PATCH] FINERACT-2311: add tests for buy down fees on product level --- .../test/factory/LoanRequestFactory.java | 5 - .../test/stepdef/loan/LoanStepDef.java | 124 ++++++++++++++---- .../src/test/resources/features/Loan.feature | 8 +- .../features/LoanBuyDownFees.feature | 100 -------------- .../features/LoanCapitalizedIncome.feature | 36 ++--- .../resources/features/LoanProduct.feature | 27 ++++ 6 files changed, 145 insertions(+), 155 deletions(-) delete mode 100644 fineract-e2e-tests-runner/src/test/resources/features/LoanBuyDownFees.feature diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/factory/LoanRequestFactory.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/factory/LoanRequestFactory.java index 10aa66786..4c7b0fc28 100644 --- a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/factory/LoanRequestFactory.java +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/factory/LoanRequestFactory.java @@ -309,11 +309,6 @@ public class LoanRequestFactory { return new PostLoansLoanIdRequest().note("Contract Termination Undo"); } - public static PostLoansLoanIdTransactionsRequest defaultBuyDownFeeIncomeRequest() { - return new PostLoansLoanIdTransactionsRequest().transactionDate(DEFAULT_TRANSACTION_DATE).dateFormat(DATE_FORMAT) - .locale(DEFAULT_LOCALE).note("Buy Down fee"); - } - public static PostLoansLoanIdRequest defaultLoanContractTerminationRequest() { return new PostLoansLoanIdRequest().dateFormat(DATE_FORMAT).locale(DEFAULT_LOCALE).note("Contract Termination"); } diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java index d3a1070f8..495695b75 100644 --- a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java @@ -154,6 +154,7 @@ import org.apache.fineract.test.messaging.event.loan.transaction.LoanTransaction import org.apache.fineract.test.messaging.store.EventStore; import org.apache.fineract.test.stepdef.AbstractStepDef; import org.apache.fineract.test.support.TestContextKey; +import org.assertj.core.api.SoftAssertions; import org.springframework.beans.factory.annotation.Autowired; import retrofit2.Response; @@ -4181,6 +4182,13 @@ public class LoanStepDef extends AbstractStepDef { @Then("Loan Product response contains interestRecognitionOnDisbursementDate flag with value {string}") public void verifyInterestRecognitionOnDisbursementDateFlag(final String expectedValue) throws IOException { + GetLoanProductsResponse targetProduct = getLoanProductResponse(); + + assertNotNull(targetProduct.getInterestRecognitionOnDisbursementDate()); + assertThat(targetProduct.getInterestRecognitionOnDisbursementDate().toString()).isEqualTo(expectedValue); + } + + public GetLoanProductsResponse getLoanProductResponse() throws IOException { final Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); assertNotNull(loanResponse.body()); final Long loanId = loanResponse.body().getLoanId(); @@ -4203,8 +4211,94 @@ public class LoanStepDef extends AbstractStepDef { return product.getId().equals(targetLoanProductId); }).findFirst().orElseThrow(() -> new AssertionError("Loan product with ID " + targetLoanProductId + " not found in response")); - assertNotNull(targetProduct.getInterestRecognitionOnDisbursementDate()); - assertThat(targetProduct.getInterestRecognitionOnDisbursementDate().toString()).isEqualTo(expectedValue); + return targetProduct; + } + + @Then("Loan Product response contains Buy Down Fees flag {string} with data:") + public void verifyLoanProductWithBuyDownFeesData(String expectedValue, DataTable table) throws IOException { + GetLoanProductsResponse targetProduct = getLoanProductResponse(); + + assertNotNull(targetProduct.getEnableBuyDownFee()); + assertThat(targetProduct.getEnableBuyDownFee().toString()).isEqualTo(expectedValue); + + List data = table.asLists().get(1); // skip header + String buyDownFeeCalculationType = data.get(0); + String buyDownFeeStrategy = data.get(1); + String buyDownFeeIncomeType = data.get(2); + + assertNotNull(targetProduct.getBuyDownFeeCalculationType()); + assertNotNull(targetProduct.getBuyDownFeeStrategy()); + assertNotNull(targetProduct.getBuyDownFeeIncomeType()); + + SoftAssertions assertions = new SoftAssertions(); + assertions.assertThat(buyDownFeeCalculationType).isEqualTo(targetProduct.getBuyDownFeeCalculationType().getValue()); + assertions.assertThat(buyDownFeeStrategy).isEqualTo(targetProduct.getBuyDownFeeStrategy().getValue()); + assertions.assertThat(buyDownFeeIncomeType).isEqualTo(targetProduct.getBuyDownFeeIncomeType().getValue()); + assertions.assertAll(); + } + + @Then("Loan Product response contains Buy Down Fees flag {string}") + public void verifyLoanProductWithBuyDownFeesFlag(String expectedValue) throws IOException { + GetLoanProductsResponse targetProduct = getLoanProductResponse(); + + assertNotNull(targetProduct.getEnableBuyDownFee()); + assertThat(targetProduct.getEnableBuyDownFee().toString()).isEqualTo(expectedValue); + } + + public Response getLoanDetailsResponse() throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + + long loanId = loanResponse.body().getLoanId(); + + Optional> loanDetailsResponseOptional = Optional + .of(loansApi.retrieveLoan(loanId, false, "", "", "").execute()); + Response loanDetailsResponse = loanDetailsResponseOptional + .orElseThrow(() -> new RuntimeException("Failed to retrieve loan details - response is null")); + + ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); + testContext().set(TestContextKey.LOAN_RESPONSE, loanDetailsResponse); + return loanDetailsResponse; + } + + @Then("Loan Details response contains Buy Down Fees flag {string} and data:") + public void verifyBuyDownFeeDataInLoanResponse(final String expectedValue, DataTable table) throws IOException { + Response loanDetailsResponse = getLoanDetailsResponse(); + + ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); + testContext().set(TestContextKey.LOAN_RESPONSE, loanDetailsResponse); + + GetLoansLoanIdResponse loanDetails = loanDetailsResponse.body(); + + assertNotNull(loanDetails.getEnableBuyDownFee()); + assertThat(loanDetails.getEnableBuyDownFee().toString()).isEqualTo(expectedValue); + + List data = table.asLists().get(1); // skip header + String buyDownFeeCalculationType = data.get(0); + String buyDownFeeStrategy = data.get(1); + String buyDownFeeIncomeType = data.get(2); + + assertNotNull(loanDetails.getBuyDownFeeCalculationType()); + assertNotNull(loanDetails.getBuyDownFeeStrategy()); + assertNotNull(loanDetails.getBuyDownFeeIncomeType()); + + SoftAssertions assertions = new SoftAssertions(); + assertions.assertThat(buyDownFeeCalculationType).isEqualTo(loanDetails.getBuyDownFeeCalculationType().getValue()); + assertions.assertThat(buyDownFeeStrategy).isEqualTo(loanDetails.getBuyDownFeeStrategy().getValue()); + assertions.assertThat(buyDownFeeIncomeType).isEqualTo(loanDetails.getBuyDownFeeIncomeType().getValue()); + assertions.assertAll(); + } + + @Then("Loan Details response contains Buy Down Fees flag {string}") + public void verifyBuyDownFeeFlagInLoanResponse(final String expectedValue) throws IOException { + Response loanDetailsResponse = getLoanDetailsResponse(); + + ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); + testContext().set(TestContextKey.LOAN_RESPONSE, loanDetailsResponse); + + GetLoansLoanIdResponse loanDetails = loanDetailsResponse.body(); + + assertNotNull(loanDetails.getEnableBuyDownFee()); + assertThat(loanDetails.getEnableBuyDownFee().toString()).isEqualTo(expectedValue); } @Then("Loan Details response contains chargedOffOnDate set to {string}") @@ -4283,23 +4377,6 @@ public class LoanStepDef extends AbstractStepDef { return capitalizedIncomeResponse; } - public Response addBuyDownFeeToTheLoanOnWithEURTransactionAmount( - final String transactionPaymentType, final String transactionDate, final String amount) throws IOException { - final Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); - final long loanId = loanResponse.body().getLoanId(); - - final DefaultPaymentType paymentType = DefaultPaymentType.valueOf(transactionPaymentType); - final Long paymentTypeValue = paymentTypeResolver.resolve(paymentType); - - final PostLoansLoanIdTransactionsRequest buyDownFeeRequest = LoanRequestFactory.defaultBuyDownFeeIncomeRequest() - .transactionDate(transactionDate).transactionAmount(Double.valueOf(amount)).paymentTypeId(paymentTypeValue) - .externalId("EXT-BUY-DOWN-FEES" + UUID.randomUUID()); - - final Response buyDownFeeResponse = loanTransactionsApi - .executeLoanTransaction(loanId, buyDownFeeRequest, "buyDownFee").execute(); - return buyDownFeeResponse; - } - @And("Admin adds capitalized income with {string} payment type to the loan on {string} with {string} EUR transaction amount") public void adminAddsCapitalizedIncomeToTheLoanOnWithEURTransactionAmount(final String transactionPaymentType, final String transactionDate, final String amount) throws IOException { @@ -4309,15 +4386,6 @@ public class LoanStepDef extends AbstractStepDef { ErrorHelper.checkSuccessfulApiCall(capitalizedIncomeResponse); } - @And("Admin adds buy down fee with {string} payment type to the loan on {string} with {string} EUR transaction amount") - public void adminAddsBuyDownFeesToTheLoanOnWithEURTransactionAmount(final String transactionPaymentType, final String transactionDate, - final String amount) throws IOException { - final Response buyDownFeesIncomeResponse = addBuyDownFeeToTheLoanOnWithEURTransactionAmount( - transactionPaymentType, transactionDate, amount); - testContext().set(TestContextKey.LOAN_BUY_DOWN_FEE_RESPONSE, buyDownFeesIncomeResponse); - ErrorHelper.checkSuccessfulApiCall(buyDownFeesIncomeResponse); - } - public Response adjustCapitalizedIncome(final String transactionPaymentType, final String transactionDate, final String amount, final Long transactionId) throws IOException { diff --git a/fineract-e2e-tests-runner/src/test/resources/features/Loan.feature b/fineract-e2e-tests-runner/src/test/resources/features/Loan.feature index 59203c14d..4ef8ad67d 100644 --- a/fineract-e2e-tests-runner/src/test/resources/features/Loan.feature +++ b/fineract-e2e-tests-runner/src/test/resources/features/Loan.feature @@ -104,8 +104,8 @@ Feature: Loan 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 | charge calculation type | charge amount % | - | LP2_ADV_PYMNT_INTEREST_DAILY_RECALC_EMI_360_30_APPROVED_OVER_APPLIED_FLAT_CAPITALIZED_INCOME | 01 January 2024 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | LOAN_DISBURSEMENT_CHARGE | 2 | + | 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_DAILY_RECALC_EMI_360_30_APPROVED_OVER_APPLIED_FLAT_CAPITALIZED_INCOME | 01 January 2024 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | Then Admin fails to approve the loan on "1 January 2024" with "2001" amount and expected disbursement date on "1 January 2024" because of wrong amount And Admin successfully rejects the loan on "1 January 2024" @@ -116,8 +116,8 @@ Feature: Loan 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 | charge calculation type | charge amount % | - | LP2_ADV_CUSTOM_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 January 2024 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | LOAN_DISBURSEMENT_CHARGE | 2 | + | 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_CUSTOM_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 January 2024 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | And Admin successfully approves the loan on "1 January 2024" with "9000" amount and expected disbursement date on "1 January 2024" And Admin successfully disburse the loan on "1 January 2024" with "9900" EUR transaction amount Then Admin fails to disburse the loan on "1 January 2024" with "1200" EUR transaction amount because of wrong amount diff --git a/fineract-e2e-tests-runner/src/test/resources/features/LoanBuyDownFees.feature b/fineract-e2e-tests-runner/src/test/resources/features/LoanBuyDownFees.feature deleted file mode 100644 index 936891fd5..000000000 --- a/fineract-e2e-tests-runner/src/test/resources/features/LoanBuyDownFees.feature +++ /dev/null @@ -1,100 +0,0 @@ -@BuyDownFeeFeature -Feature:Feature: Buy Down Fees - - #TODO Waiting for the implementation of the feature PS-2569 - @Skip - @TestRailId:C3770 - Scenario: Simple loan with Buy Down fees and full payment - UC1 - 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 | - | LP2_PROGRESSIVE_ADVANCED_PAYMENT_ALLOCATION_BUYDOWN_FEES | 1 January 2024 | 100 | 7 | DECLINING_BALANCE | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | - And Admin successfully approves the loan on "1 January 2024" with "100" amount and expected disbursement date on "1 January 2024" - And Admin successfully disburse the loan on "1 January 2024" with "100" EUR transaction amount - Then Loan status will be "ACTIVE" - When Admin adds buy down fee with "AUTOPAY" payment type to the loan on "1 January 2024" with "50" EUR transaction amount - Then Loan Repayment schedule has 3 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 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 31 | 01 February 2024 | | 66.86 | 33.14 | 0.58 | 0.0 | 0.0 | 33.72 | 0.0 | 0.0 | 0.0 | 33.72 | - | 2 | 29 | 01 March 2024 | | 33.53 | 33.33 | 0.39 | 0.0 | 0.0 | 33.72 | 0.0 | 0.0 | 0.0 | 33.72 | - | 3 | 31 | 01 April 2024 | | 0.0 | 33.53 | 0.20 | 0.0 | 0.0 | 33.73 | 0.0 | 0.0 | 0.0 | 33.73 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 100.0 | 1.17 | 0.0 | 0.0 | 101.17 | 0.0 | 0.0 | 0.0 | 101.17 | - And Loan Transactions tab has the following data: - | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | - | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | - | 01 January 2024 | Buy Down fees | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | - And Loan Transactions tab has a "BUY_DOWN_FEES" transaction with date "01 January 2024" which has the following Journal entries: - | Type | Account code | Account name | Debit | Credit | - | EXPENSE | 51001 | BuyDown Expense | 50.0 | | - | LIABILITY | 22001 | Deferred Income | | 50.0 | - When Admin sets the business date to "1 February 2024" - And Customer makes "AUTOPAY" repayment on "01 February 2024" with 33.72 EUR transaction amount - Then Loan status will be "ACTIVE" - Then Loan Transactions tab has the following data: - | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | - | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | - | 01 January 2024 | Buy Down fees | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | - | 01 February 2024 | Repayment | 33.72 | 33.14 | 0.58 | 0.0 | 0.0 | 66.86 | false | - When Admin sets the business date to "1 March 2024" - And Customer makes "AUTOPAY" repayment on "01 March 2024" with 33.72 EUR transaction amount - When Admin sets the business date to "1 April 2024" - And Customer makes "AUTOPAY" repayment on "01 April 2024" with 33.72 EUR transaction amount - Then Loan status will be "CLOSED_OBLIGATIONS_MET" - And Loan Transactions tab has the following data: - | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | - | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | - | 01 January 2024 | Buy Down fees | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | - | 01 February 2024 | Repayment | 33.72 | 33.14 | 0.58 | 0.0 | 0.0 | 66.86 | false | - | 01 March 2024 | Repayment | 33.72 | 33.33 | 0.39 | 0.0 | 0.0 | 33.53 | false | - | 01 April 2024 | Repayment | 33.73 | 33.53 | 0.20 | 0.0 | 0.0 | 0.0 | false | - - #TODO Waiting for the implementation of the feature PS-2569 - #TODO test should be extended with checks for repayment schedule and transactions list after implementation of PS-2572 - @Skip - @TestRailId:C3771 - Scenario: Loan with Buy Down fees and early payoff - UC2 - 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 | - | LP2_PROGRESSIVE_ADVANCED_PAYMENT_ALLOCATION_BUYDOWN_FEES | 1 January 2024 | 100 | 7 | DECLINING_BALANCE | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | - And Admin successfully approves the loan on "1 January 2024" with "100" amount and expected disbursement date on "1 January 2024" - And Admin successfully disburse the loan on "1 January 2024" with "100" EUR transaction amount - Then Loan status will be "ACTIVE" - When Admin adds buy down fee with "AUTOPAY" payment type to the loan on "1 January 2024" with "50" EUR transaction amount - When Admin sets the business date to "15 January 2024" - And Customer makes "AUTOPAY" repayment on "15 January 2024" with 100.58 EUR transaction amount - Then Loan status will be "CLOSED_OBLIGATIONS_MET" - And Loan Transactions tab has the following data: - | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | - | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | - | 01 January 2024 | Buy Down fees | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | - | 15 January 2024 | Repayment | 100.58 | 100.0 | 0.58 | 0.0 | 0.0 | 0.0 | false | - - #TODO Waiting for the implementation of the feature PS-2569 - #TODO test should be extended with checks for repayment schedule and transactions list after implementation of PS-2572 - @Skip - @TestRailId:C3772 - Scenario: Loan with Buy Down fees and charge-off - UC3 - 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 | - | LP_PROGRESSIVE_BUYDOWN_FEES_ENABLED | 1 January 2024 | 100 | 7 | DECLINING_BALANCE | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | - And Admin successfully approves the loan on "1 January 2024" with "100" amount and expected disbursement date on "1 January 2024" - And Admin successfully disburse the loan on "1 January 2024" with "100" EUR transaction amount - Then Loan status will be "ACTIVE" - When Admin adds buy down fee with "AUTOPAY" payment type to the loan on "1 January 2024" with "50" EUR transaction amount - When Admin sets the business date to "1 May 2024" - And Admin does charge-off the loan on "1 May 2024" - Then Loan status will be "ACTIVE" - And Loan marked as charged-off on "1 May 2024" - And Loan Transactions tab has a "CHARGE_OFF" transaction with date "01 May 2024" which has the following Journal entries: - | Type | Account code | Account name | Debit | Credit | - | EXPENSE | 61002 | Credit Loss-Bad Debt | 101.17 | | - | ASSET | 12002 | Loans Receivable | | 100.0 | - | ASSET | 12003 | Interest Receivable | | 1.17 | \ No newline at end of file diff --git a/fineract-e2e-tests-runner/src/test/resources/features/LoanCapitalizedIncome.feature b/fineract-e2e-tests-runner/src/test/resources/features/LoanCapitalizedIncome.feature index fad29b77f..d52aaecf1 100644 --- a/fineract-e2e-tests-runner/src/test/resources/features/LoanCapitalizedIncome.feature +++ b/fineract-e2e-tests-runner/src/test/resources/features/LoanCapitalizedIncome.feature @@ -66,8 +66,8 @@ Feature: Capitalized Income When Admin sets the business date to "1 January 2024" And 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 | charge calculation type | charge amount % | - | LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_MULTIDISBURSAL_CAPITALIZED_INCOME | 01 January 2024 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | LOAN_DISBURSEMENT_CHARGE | 2 | + | 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_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_MULTIDISBURSAL_CAPITALIZED_INCOME | 01 January 2024 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | 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 "600" EUR transaction amount Then Loan status will be "ACTIVE" @@ -181,8 +181,8 @@ Feature: Capitalized Income 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 | charge calculation type | charge amount % | - | LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_MULTIDISBURSAL_CAPITALIZED_INCOME | 01 January 2024 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | LOAN_DISBURSEMENT_CHARGE | 2 | + | 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_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_MULTIDISBURSAL_CAPITALIZED_INCOME | 01 January 2024 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | 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 "600" EUR transaction amount Then Loan status will be "ACTIVE" @@ -251,8 +251,8 @@ Feature: Capitalized Income 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 | charge calculation type | charge amount % | - | LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_MULTIDISBURSAL_CAPITALIZED_INCOME | 01 January 2024 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | LOAN_DISBURSEMENT_CHARGE | 2 | + | 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_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_MULTIDISBURSAL_CAPITALIZED_INCOME | 01 January 2024 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | 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 "700" EUR transaction amount Then Loan status will be "ACTIVE" @@ -290,8 +290,8 @@ Feature: Capitalized Income 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 | charge calculation type | charge amount % | - | LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_MULTIDISBURSAL_CAPITALIZED_INCOME | 01 January 2024 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | LOAN_DISBURSEMENT_CHARGE | 2 | + | 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_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_MULTIDISBURSAL_CAPITALIZED_INCOME | 01 January 2024 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | 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 "500" EUR transaction amount Then Loan status will be "ACTIVE" @@ -371,8 +371,8 @@ Feature: Capitalized Income 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 | charge calculation type | charge amount % | - | LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_MULTIDISBURSAL_CAPITALIZED_INCOME | 01 January 2024 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | LOAN_DISBURSEMENT_CHARGE | 2 | + | 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_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_MULTIDISBURSAL_CAPITALIZED_INCOME | 01 January 2024 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | 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 "500" EUR transaction amount Then Loan status will be "ACTIVE" @@ -510,8 +510,8 @@ Feature: Capitalized Income 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 | charge calculation type | charge amount % | - | LP2_ADV_PYMNT_INTEREST_DAILY_RECALC_EMI_360_30_MULTIDISB_OVER_APPLIED_FLAT_CAPITALIZED_INCOME | 01 January 2024 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | LOAN_DISBURSEMENT_CHARGE | 2 | + | 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_DAILY_RECALC_EMI_360_30_MULTIDISB_OVER_APPLIED_FLAT_CAPITALIZED_INCOME | 01 January 2024 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | And Admin successfully approves the loan on "1 January 2024" with "1500" 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 status will be "ACTIVE" @@ -576,8 +576,8 @@ Feature: Capitalized Income 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 | charge calculation type | charge amount % | - | LP2_ADV_PYMNT_INTEREST_DAILY_RECALC_EMI_360_30_APPROVED_OVER_APPLIED_PERCENTAGE_CAPITALIZED_INCOME | 01 January 2024 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | LOAN_DISBURSEMENT_CHARGE | 2 | + | 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_DAILY_RECALC_EMI_360_30_APPROVED_OVER_APPLIED_PERCENTAGE_CAPITALIZED_INCOME | 01 January 2024 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | And Admin successfully approves the loan on "1 January 2024" with "1500" 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 status will be "ACTIVE" @@ -638,8 +638,8 @@ Feature: Capitalized Income 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 | charge calculation type | charge amount % | - | LP2_ADV_PYMNT_INTEREST_DAILY_RECALC_EMI_360_30_APPROVED_OVER_APPLIED_FLAT_CAPITALIZED_INCOME | 01 January 2024 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | LOAN_DISBURSEMENT_CHARGE | 2 | + | 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_DAILY_RECALC_EMI_360_30_APPROVED_OVER_APPLIED_FLAT_CAPITALIZED_INCOME | 01 January 2024 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | And Admin successfully approves the loan on "1 January 2024" with "2000" amount and expected disbursement date on "1 January 2024" And Admin successfully disburse the loan on "1 January 2024" with "1500" EUR transaction amount Then Loan status will be "ACTIVE" @@ -684,8 +684,8 @@ Feature: Capitalized Income 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 | charge calculation type | charge amount % | - | LP2_ADV_PYMNT_INTEREST_DAILY_RECALC_EMI_360_30_MULTIDISB_OVER_APPLIED_PERCENTAGE_CAPITALIZED_INCOME | 01 January 2024 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | LOAN_DISBURSEMENT_CHARGE | 2 | + | 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_DAILY_RECALC_EMI_360_30_MULTIDISB_OVER_APPLIED_PERCENTAGE_CAPITALIZED_INCOME | 01 January 2024 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | And Admin successfully approves the loan on "1 January 2024" with "1300" 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 status will be "ACTIVE" diff --git a/fineract-e2e-tests-runner/src/test/resources/features/LoanProduct.feature b/fineract-e2e-tests-runner/src/test/resources/features/LoanProduct.feature index 9a02ca0cb..5c9efe144 100644 --- a/fineract-e2e-tests-runner/src/test/resources/features/LoanProduct.feature +++ b/fineract-e2e-tests-runner/src/test/resources/features/LoanProduct.feature @@ -224,3 +224,30 @@ Feature: LoanProduct | 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_360_30_ACCRUAL_ACTIVITY | 01 January 2025 | 1000 | 26 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 4 | MONTHS | 1 | MONTHS | 4 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | Then Loan Product response contains interestRecognitionOnDisbursementDate flag with value "true" + + @TestRailId:C3780 + Scenario: As a user I would like to verify BuyDownFees enabled in loan product response + When Admin sets the business date to "01 January 2025" + When Admin creates a client with random data + 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 | + | LP2_PROGRESSIVE_ADVANCED_PAYMENT_ALLOCATION_BUYDOWN_FEES | 01 January 2025 | 1000 | 26 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 4 | MONTHS | 1 | MONTHS | 4 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + Then Loan Product response contains Buy Down Fees flag "true" with data: + | buyDownFeeCalculationType | buyDownFeeStrategy | buyDownFeeIncomeType | + | Flat | Equal amortization | Interest | + Then Loan Details response contains Buy Down Fees flag "true" and data: + | buyDownFeeCalculationType | buyDownFeeStrategy | buyDownFeeIncomeType | + | Flat | Equal amortization | Interest | + + @TestRailId:C3781 + Scenario: As a user I would like to verify BuyDownFees disabled in loan product response + When Admin sets the business date to "01 January 2025" + When Admin creates a client with random data + 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 | + | LP2_ADV_PYMNT_INTEREST_RECOGNITION_DISBURSEMENT_DAILY_EMI_360_30_ACCRUAL_ACTIVITY | 01 January 2025 | 1000 | 26 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 4 | MONTHS | 1 | MONTHS | 4 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + Then Loan Product response contains Buy Down Fees flag "false" + Then Loan Details response contains Buy Down Fees flag "false" +