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
commit 3e2684c0d64e616f9bdbae2b28c0cf192da03cab Author: MarianaDmytrivBinariks <[email protected]> AuthorDate: Wed Jul 30 11:15:52 2025 +0300 FINERACT-2311: added e2e tests for buy down fees fetch amortization details --- .../apache/fineract/test/api/ApiConfiguration.java | 6 + .../fineract/test/helper/ErrorMessageHelper.java | 13 ++ .../fineract/test/stepdef/loan/LoanStepDef.java | 80 ++++++++ .../resources/features/LoanBuyDownFees.feature | 211 +++++++++++++++++++++ 4 files changed, 310 insertions(+) diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/api/ApiConfiguration.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/api/ApiConfiguration.java index 0cfaeb6232..b9f1aa7d2f 100644 --- a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/api/ApiConfiguration.java +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/api/ApiConfiguration.java @@ -39,6 +39,7 @@ import org.apache.fineract.client.services.GlobalConfigurationApi; import org.apache.fineract.client.services.InlineJobApi; import org.apache.fineract.client.services.JournalEntriesApi; import org.apache.fineract.client.services.LoanAccountLockApi; +import org.apache.fineract.client.services.LoanBuyDownFeesApi; import org.apache.fineract.client.services.LoanChargesApi; import org.apache.fineract.client.services.LoanCobCatchUpApi; import org.apache.fineract.client.services.LoanDisbursementDetailsApi; @@ -256,4 +257,9 @@ public class ApiConfiguration { public LoanDisbursementDetailsApi loanDisbursementDetailsApi() { return fineractClient.createService(LoanDisbursementDetailsApi.class); } + + @Bean + public LoanBuyDownFeesApi loanBuyDownFeesApi() { + return fineractClient.createService(LoanBuyDownFeesApi.class); + } } diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/helper/ErrorMessageHelper.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/helper/ErrorMessageHelper.java index 648516822c..e27b3856e0 100644 --- a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/helper/ErrorMessageHelper.java +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/helper/ErrorMessageHelper.java @@ -1005,4 +1005,17 @@ public final class ErrorMessageHelper { public static String updateApprovedLoanLessMinAllowedAmountFailure() { return "The parameter `amount` must be greater than 0."; } + + public static String wrongValueInLineInBuyDownFeeTab(String resourceId, int line, List<List<String>> actualList, + List<String> expected) { + String actual = actualList.stream().map(Object::toString).collect(Collectors.joining(System.lineSeparator())); + return String.format("%nWrong value in Buy Down Fee tab of resource %s line %s." // + + "%nActual values in line (with the same date) are: %n%s %nExpected values in line: %n%s", resourceId, line, actual, + expected); + } + + public static String nrOfLinesWrongInBuyDownFeeTab(String resourceId, int actual, int expected) { + return String.format("%nNumber of lines does not match in Buy Down Fee tab and expected datatable of resource %s." // + + "%nNumber of transaction tab lines: %s %nNumber of expected datatable lines: %s%n", resourceId, actual, expected); + } } 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 e61da4f54d..c29fa7821e 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 @@ -63,6 +63,7 @@ import org.apache.fineract.avro.loan.v1.LoanStatusEnumDataV1; import org.apache.fineract.avro.loan.v1.LoanTransactionDataV1; import org.apache.fineract.client.models.AdvancedPaymentData; import org.apache.fineract.client.models.BusinessDateResponse; +import org.apache.fineract.client.models.BuyDownFeeAmortizationDetails; import org.apache.fineract.client.models.DeleteLoansLoanIdResponse; import org.apache.fineract.client.models.DisbursementDetail; import org.apache.fineract.client.models.GetLoanProductsChargeOffReasonOptions; @@ -104,6 +105,7 @@ import org.apache.fineract.client.models.PutLoansApprovedAmountResponse; import org.apache.fineract.client.models.PutLoansLoanIdRequest; import org.apache.fineract.client.models.PutLoansLoanIdResponse; import org.apache.fineract.client.services.BusinessDateManagementApi; +import org.apache.fineract.client.services.LoanBuyDownFeesApi; import org.apache.fineract.client.services.LoanCobCatchUpApi; import org.apache.fineract.client.services.LoanDisbursementDetailsApi; import org.apache.fineract.client.services.LoanInterestPauseApi; @@ -184,6 +186,9 @@ public class LoanStepDef extends AbstractStepDef { @Autowired private LoansApi loansApi; + @Autowired + private LoanBuyDownFeesApi loanBuyDownFeesApi; + @Autowired private LoanCobCatchUpApi loanCobCatchUpApi; @@ -4140,6 +4145,34 @@ public class LoanStepDef extends AbstractStepDef { return actualValues; } + private List<String> fetchValuesOfBuyDownFees(List<String> header, BuyDownFeeAmortizationDetails t) { + List<String> actualValues = new ArrayList<>(); + for (String headerName : header) { + switch (headerName) { + case "Date" -> actualValues.add(t.getBuyDownFeeDate() == null ? null : FORMATTER.format(t.getBuyDownFeeDate())); + case "Fee Amount" -> actualValues + .add(t.getBuyDownFeeAmount() == null ? new Utils.DoubleFormatter(new BigDecimal("0.0").doubleValue()).format() + : new Utils.DoubleFormatter(t.getBuyDownFeeAmount().doubleValue()).format()); + // actualValues.add(new Utils.DoubleFormatter(t.getBuyDownFeeAmount().doubleValue()).format()); + // actualValues.add(MathUtil.nullToZero(t.getBuyDownFeeAmount().doubleValue()).format()); + case "Amortized Amount" -> actualValues + .add(t.getAmortizedAmount() == null ? new Utils.DoubleFormatter(new BigDecimal("0.0").doubleValue()).format() + : new Utils.DoubleFormatter(t.getAmortizedAmount().doubleValue()).format()); + case "Not Yet Amortized Amount" -> actualValues + .add(t.getNotYetAmortizedAmount() == null ? new Utils.DoubleFormatter(new BigDecimal("0.0").doubleValue()).format() + : new Utils.DoubleFormatter(t.getNotYetAmortizedAmount().doubleValue()).format()); + case "Adjusted Amount" -> + actualValues.add(t.getAdjustedAmount() == null ? new Utils.DoubleFormatter(new BigDecimal("0.0").doubleValue()).format() + : new Utils.DoubleFormatter(t.getAdjustedAmount().doubleValue()).format()); + case "Charged Off Amount" -> actualValues + .add(t.getChargedOffAmount() == null ? new Utils.DoubleFormatter(new BigDecimal("0.0").doubleValue()).format() + : new Utils.DoubleFormatter(t.getChargedOffAmount().doubleValue()).format()); + default -> throw new IllegalStateException(String.format("Header name %s cannot be found", headerName)); + } + } + return actualValues; + } + private List<String> fetchValuesOfDisbursementDetails(List<String> header, GetLoansLoanIdDisbursementDetails t) { List<String> actualValues = new ArrayList<>(); for (String headerName : header) { @@ -5028,6 +5061,53 @@ public class LoanStepDef extends AbstractStepDef { log.debug("BuyDown Fee Adjustment created: Transaction ID {}", adjustmentResponse.body().getResourceId()); } + @And("Buy down fee contains the following data:") + public void checkBuyDownFeeData(DataTable table) throws IOException { + Response<PostLoansResponse> loanCreateResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanCreateResponse.body().getLoanId(); + String resourceId = String.valueOf(loanId); + + final Response<List<BuyDownFeeAmortizationDetails>> buyDownFeesResponse = loanBuyDownFeesApi + .retrieveLoanBuyDownFeeAmortizationDetails(loanId).execute(); + ErrorHelper.checkSuccessfulApiCall(buyDownFeesResponse); + + List<BuyDownFeeAmortizationDetails> buyDownFees = buyDownFeesResponse.body(); + checkBuyDownFeeTransactionData(resourceId, buyDownFees, table); + } + + @And("Buy down fee by external-id contains the following data:") + public void checkBuyDownFeeByexternalIdData(DataTable table) throws IOException { + Response<PostLoansResponse> loanCreateResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanCreateResponse.body().getLoanId(); + String resourceId = String.valueOf(loanId); + String externalId = loanCreateResponse.body().getResourceExternalId(); + + final Response<List<BuyDownFeeAmortizationDetails>> buyDownFeesResponse = loanBuyDownFeesApi + .retrieveLoanBuyDownFeeAmortizationDetailsByExternalId(externalId).execute(); + ErrorHelper.checkSuccessfulApiCall(buyDownFeesResponse); + + List<BuyDownFeeAmortizationDetails> buyDownFees = buyDownFeesResponse.body(); + checkBuyDownFeeTransactionData(resourceId, buyDownFees, table); + } + + public void checkBuyDownFeeTransactionData(String resourceId, List<BuyDownFeeAmortizationDetails> buyDownFees, DataTable table) { + List<List<String>> data = table.asLists(); + for (int i = 1; i < data.size(); i++) { + List<String> expectedValues = data.get(i); + String buyDownFeeDateExpected = expectedValues.get(0); + List<List<String>> actualValuesList = buyDownFees.stream()// + .filter(t -> buyDownFeeDateExpected.equals(FORMATTER.format(t.getBuyDownFeeDate())))// + .map(t -> fetchValuesOfBuyDownFees(table.row(0), t))// + .collect(Collectors.toList());// + boolean containsExpectedValues = actualValuesList.stream()// + .anyMatch(actualValues -> actualValues.equals(expectedValues));// + assertThat(containsExpectedValues) + .as(ErrorMessageHelper.wrongValueInLineInBuyDownFeeTab(resourceId, i, actualValuesList, expectedValues)).isTrue(); + } + assertThat(buyDownFees.size()).as(ErrorMessageHelper.nrOfLinesWrongInBuyDownFeeTab(resourceId, buyDownFees.size(), data.size() - 1)) + .isEqualTo(data.size() - 1); + } + @Then("Update loan approved amount with new amount {string} value") public void updateLoanApprovedAmount(final String amount) throws IOException { final Response<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); diff --git a/fineract-e2e-tests-runner/src/test/resources/features/LoanBuyDownFees.feature b/fineract-e2e-tests-runner/src/test/resources/features/LoanBuyDownFees.feature index d9ad4e8a18..f61b5901eb 100644 --- a/fineract-e2e-tests-runner/src/test/resources/features/LoanBuyDownFees.feature +++ b/fineract-e2e-tests-runner/src/test/resources/features/LoanBuyDownFees.feature @@ -29,6 +29,9 @@ Feature:Feature: Buy Down Fees | Type | Account code | Account name | Debit | Credit | | EXPENSE | 450280 | Buy Down Expense | 50.0 | | | LIABILITY | 145024 | Deferred Capitalized Income | | 50.0 | + And Buy down fee contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 0.0 | 50.0 | 0.0 | 0.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" @@ -53,6 +56,9 @@ Feature:Feature: Buy Down Fees | 31 March 2024 | Buy Down Fee Amortization | 50.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | false | | 01 April 2024 | Repayment | 33.73 | 33.53 | 0.2 | 0.0 | 0.0 | 0.0 | false | | 01 April 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | @TestRailId:C3827 Scenario: Verify loan with Buy Down fees and full payment and daily amortization - UC1.2 @@ -83,6 +89,9 @@ Feature:Feature: Buy Down Fees | Type | Account code | Account name | Debit | Credit | | EXPENSE | 450280 | Buy Down Expense | 50.0 | | | LIABILITY | 145024 | Deferred Capitalized Income | | 50.0 | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 0.0 | 50.0 | 0.0 | 0.0 | When Admin sets the business date to "2 January 2024" When Admin runs inline COB job for Loan Then Loan Transactions tab has the following data: @@ -94,6 +103,9 @@ Feature:Feature: Buy Down Fees | Type | Account code | Account name | Debit | Credit | | INCOME | 450281 | Income From Buy Down | | 0.55 | | LIABILITY | 145024 | Deferred Capitalized Income | 0.55 | | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 0.55 | 49.45 | 0.0 | 0.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" @@ -286,6 +298,9 @@ Feature:Feature: Buy Down Fees | 01 April 2024 | Repayment | 33.73 | 33.53 | 0.2 | 0.0 | 0.0 | 0.0 | false | | 01 April 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | @TestRailId:C3771 Scenario: Verify loan with Buy Down fees and early payoff - UC2.1 @@ -315,6 +330,9 @@ Feature:Feature: Buy Down Fees | Type | Account code | Account name | Debit | Credit | | EXPENSE | 450280 | Buy Down Expense | 50.0 | | | LIABILITY | 145024 | Deferred Capitalized Income | | 50.0 | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 0.0 | 50.0 | 0.0 | 0.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" @@ -338,6 +356,9 @@ Feature:Feature: Buy Down Fees | Type | Account code | Account name | Debit | Credit | | INCOME | 450281 | Income From Buy Down | | 50.0 | | LIABILITY | 145024 | Deferred Capitalized Income | 50.0 | | + And Buy down fee contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | @TestRailId:C3828 Scenario: Verify loan with Buy Down fees and early payoff and daily amortization - UC2.2 @@ -367,6 +388,9 @@ Feature:Feature: Buy Down Fees | Type | Account code | Account name | Debit | Credit | | EXPENSE | 450280 | Buy Down Expense | 50.0 | | | LIABILITY | 145024 | Deferred Capitalized Income | | 50.0 | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 0.0 | 50.0 | 0.0 | 0.0 | When Admin sets the business date to "2 January 2024" When Admin runs inline COB job for Loan Then Loan Transactions tab has the following data: @@ -378,6 +402,9 @@ Feature:Feature: Buy Down Fees | Type | Account code | Account name | Debit | Credit | | INCOME | 450281 | Income From Buy Down | | 0.55 | | LIABILITY | 145024 | Deferred Capitalized Income | 0.55 | | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 0.55 | 49.45 | 0.0 | 0.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" @@ -518,6 +545,9 @@ Feature:Feature: Buy Down Fees | Type | Account code | Account name | Debit | Credit | | INCOME | 450281 | Income From Buy Down | | 17.03 | | LIABILITY | 145024 | Deferred Capitalized Income | 17.03 | | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | @TestRailId:C3772 Scenario: Verify loan with Buy Down fees and charge-off transaction - amortization in case of loan charge-off event - UC3.1 @@ -547,6 +577,9 @@ Feature:Feature: Buy Down Fees | Type | Account code | Account name | Debit | Credit | | EXPENSE | 450280 | Buy Down Expense | 50.0 | | | LIABILITY | 145024 | Deferred Capitalized Income | | 50.0 | + And Buy down fee contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 0.0 | 50.0 | 0.0 | 0.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" @@ -581,6 +614,9 @@ Feature:Feature: Buy Down Fees | LIABILITY | 145024 | Deferred Capitalized Income | 33.52 | | | EXPENSE | 744007 | Credit Loss/Bad Debt | | 16.48 | | LIABILITY | 145024 | Deferred Capitalized Income | 16.48 | | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 33.52 | 0.0 | 0.0 | 16.48 | When Loan Pay-off is made on "1 March 2024" Then Loan's all installments have obligations met @@ -613,6 +649,9 @@ Feature:Feature: Buy Down Fees | Type | Account code | Account name | Debit | Credit | | EXPENSE | 450280 | Buy Down Expense | 50.0 | | | LIABILITY | 145024 | Deferred Capitalized Income | | 50.0 | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 0.0 | 50.0 | 0.0 | 0.0 | When Admin sets the business date to "2 January 2024" When Admin runs inline COB job for Loan Then Loan Transactions tab has the following data: @@ -624,6 +663,9 @@ Feature:Feature: Buy Down Fees | Type | Account code | Account name | Debit | Credit | | INCOME | 450281 | Income From Buy Down | | 0.55 | | LIABILITY | 145024 | Deferred Capitalized Income | 0.55 | | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 0.55 | 49.45 | 0.0 | 0.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" @@ -775,6 +817,9 @@ Feature:Feature: Buy Down Fees | LIABILITY | 145024 | Deferred Capitalized Income | 0.55 | | | EXPENSE | 744007 | Credit Loss/Bad Debt | | 16.48 | | LIABILITY | 145024 | Deferred Capitalized Income | 16.48 | | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 33.52 | 0.0 | 0.0 | 16.48 | When Loan Pay-off is made on "1 March 2024" Then Loan's all installments have obligations met @@ -807,6 +852,9 @@ Feature:Feature: Buy Down Fees | Type | Account code | Account name | Debit | Credit | | EXPENSE | 450280 | Buy Down Expense | 50.0 | | | LIABILITY | 145024 | Deferred Capitalized Income | | 50.0 | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 0.0 | 50.0 | 0.0 | 0.0 | # --- charge-off ---# When Admin sets the business date to "1 February 2024" And Admin does charge-off the loan on "1 February 2024" @@ -835,6 +883,9 @@ Feature:Feature: Buy Down Fees | 01 February 2024 | Accrual | 0.58 | 0.0 | 0.58 | 0.0 | 0.0 | 0.0 | false | | 01 February 2024 | Charge-off | 101.17 | 100.0 | 1.17 | 0.0 | 0.0 | 0.0 | false | | 01 February 2024 | Buy Down Fee Amortization | 32.42 | 0.0 | 32.42 | 0.0 | 0.0 | 0.0 | false | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 17.58 | 0.0 | 0.0 | 32.42 | # --- check BDFA journal entries for before and after charge-off trn processed --- # And Loan Transactions tab has 2 a "BUY_DOWN_FEE_AMORTIZATION" transactions with date "01 February 2024" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | @@ -865,6 +916,9 @@ Feature:Feature: Buy Down Fees | Type | Account code | Account name | Debit | Credit | | INCOME | 450281 | Income From Buy Down | | 17.58 | | LIABILITY | 145024 | Deferred Capitalized Income | 17.58 | | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 17.58 | 32.42 | 0.0 | 0.0 | When Loan Pay-off is made on "1 February 2024" Then Loan's all installments have obligations met @@ -897,6 +951,9 @@ Feature:Feature: Buy Down Fees | Type | Account code | Account name | Debit | Credit | | EXPENSE | 450280 | Buy Down Expense | 50.0 | | | LIABILITY | 145024 | Deferred Capitalized Income | | 50.0 | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 0.0 | 50.0 | 0.0 | 0.0 | Then Admin can successfully set Fraud flag to the loan # --- charge-off ---# @@ -934,6 +991,9 @@ Feature:Feature: Buy Down Fees | LIABILITY | 145024 | Deferred Capitalized Income | 17.58 | | | EXPENSE | 744037 | Credit Loss/Bad Debt-Fraud | | 32.42 | | LIABILITY | 145024 | Deferred Capitalized Income | 32.42 | | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 17.58 | 0.0 | 0.0 | 32.42 | # --- charge-off undo ---# Then Admin does a charge-off undo the loan Then Loan Transactions tab has the following data: @@ -957,6 +1017,9 @@ Feature:Feature: Buy Down Fees | Type | Account code | Account name | Debit | Credit | | INCOME | 450281 | Income From Buy Down | | 17.58 | | LIABILITY | 145024 | Deferred Capitalized Income | 17.58 | | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 17.58 | 32.42 | 0.0 | 0.0 | When Loan Pay-off is made on "1 February 2024" Then Loan's all installments have obligations met @@ -988,6 +1051,10 @@ Feature:Feature: Buy Down Fees | Type | Account code | Account name | Debit | Credit | | EXPENSE | 450280 | Buy Down Expense | 50.0 | | | LIABILITY | 145024 | Deferred Capitalized Income | | 50.0 | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 0.0 | 50.0 | 0.0 | 0.0 | + Then Admin can successfully set Fraud flag to the loan When Admin sets the business date to "25 January 2024" And Admin does charge-off the loan with reason "DELINQUENT" on "25 January 2024" @@ -1012,6 +1079,9 @@ Feature:Feature: Buy Down Fees | LIABILITY | 145024 | Deferred Capitalized Income | 13.74 | | | EXPENSE | 744007 | Credit Loss/Bad Debt | | 36.26 | | LIABILITY | 145024 | Deferred Capitalized Income | 36.26 | | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 13.74 | 0.0 | 0.0 | 36.26 | When Loan Pay-off is made on "25 January 2024" Then Loan's all installments have obligations met @@ -1044,6 +1114,10 @@ Feature:Feature: Buy Down Fees | Type | Account code | Account name | Debit | Credit | | EXPENSE | 450280 | Buy Down Expense | 50.0 | | | LIABILITY | 145024 | Deferred Capitalized Income | | 50.0 | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 0.0 | 50.0 | 0.0 | 0.0 | + Then Admin can successfully set Fraud flag to the loan When Admin sets the business date to "25 January 2024" And Admin does charge-off the loan on "25 January 2024" @@ -1067,6 +1141,9 @@ Feature:Feature: Buy Down Fees | LIABILITY | 145024 | Deferred Capitalized Income | 13.74 | | | EXPENSE | 744037 | Credit Loss/Bad Debt-Fraud | | 36.26 | | LIABILITY | 145024 | Deferred Capitalized Income | 36.26 | | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 13.74 | 0.0 | 0.0 | 36.26 | When Loan Pay-off is made on "25 January 2024" Then Loan's all installments have obligations met @@ -1099,6 +1176,10 @@ Feature:Feature: Buy Down Fees | Type | Account code | Account name | Debit | Credit | | EXPENSE | 450280 | Buy Down Expense | 50.0 | | | LIABILITY | 145024 | Deferred Capitalized Income | | 50.0 | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 0.0 | 50.0 | 0.0 | 0.0 | + Then Admin can successfully set Fraud flag to the loan When Admin sets the business date to "25 January 2024" And Admin does charge-off the loan with reason "DELINQUENT" on "25 January 2024" @@ -1122,6 +1203,9 @@ Feature:Feature: Buy Down Fees | LIABILITY | 145024 | Deferred Capitalized Income | 13.74 | | | EXPENSE | 744007 | Credit Loss/Bad Debt | | 36.26 | | LIABILITY | 145024 | Deferred Capitalized Income | 36.26 | | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 13.74 | 0.0 | 0.0 | 36.26 | Then Admin does a charge-off undo the loan Then Loan Transactions tab has the following data: @@ -1145,10 +1229,97 @@ Feature:Feature: Buy Down Fees | Type | Account code | Account name | Debit | Credit | | INCOME | 450281 | Income From Buy Down | | 13.74 | | LIABILITY | 145024 | Deferred Capitalized Income | 13.74 | | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 13.74 | 36.26 | 0.0 | 0.0 | When Loan Pay-off is made on "25 January 2024" Then Loan's all installments have obligations met + @TestRailId:C3887 + Scenario: Verify loan with with a few Buy Down fees with adjustment and charge-off transaction - amortization in case of loan charge-off event - UC3.8 + 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 | DAILY | 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.2 | 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 Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | + And Loan Transactions tab has a "BUY_DOWN_FEE" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | EXPENSE | 450280 | Buy Down Expense | 50.0 | | + | LIABILITY | 145024 | Deferred Capitalized Income | | 50.0 | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 0.0 | 50.0 | 0.0 | 0.0 | +# --- add 2nd BuyDownFee - on Feb,1st 2024 --- # + When Admin sets the business date to "1 February 2024" + When Admin runs inline COB job for Loan + Then Loan status will be "ACTIVE" + When Admin adds buy down fee with "AUTOPAY" payment type to the loan on "1 February 2024" with "50" EUR transaction amount + 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 Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | + | 31 January 2024 | Accrual | 0.56 | 0.0 | 0.56 | 0.0 | 0.0 | 0.0 | false | + | 31 January 2024 | Buy Down Fee Amortization | 17.03 | 0.0 | 17.03 | 0.0 | 0.0 | 0.0 | false | + | 01 February 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 17.03 | 32.97 | 0.0 | 0.0 | + | 01 February 2024 | 50.0 | 0.0 | 50.0 | 0.0 | 0.0 | +# --- charge-off the loan --- # + When Admin sets the business date to "1 March 2024" + And Admin does charge-off the loan on "1 March 2024" + Then Loan status will be "ACTIVE" + And Loan marked as charged-off on "01 March 2024" + And Loan Transactions tab has a "CHARGE_OFF" transaction with date "01 March 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 100.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 1.36 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 100.0 | | + | INCOME | 404001 | Interest Income Charge Off | 1.36 | | + 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 Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | + | 31 January 2024 | Accrual | 0.56 | 0.0 | 0.56 | 0.0 | 0.0 | 0.0 | false | + | 31 January 2024 | Buy Down Fee Amortization | 17.03 | 0.0 | 17.03 | 0.0 | 0.0 | 0.0 | false | + | 01 February 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | + | 01 March 2024 | Buy Down Fee Amortization | 41.49 | 0.0 | 41.49 | 0.0 | 0.0 | 0.0 | false | + | 01 March 2024 | Accrual | 0.6 | 0.0 | 0.6 | 0.0 | 0.0 | 0.0 | false | + | 01 March 2024 | Charge-off | 101.36 | 100.0 | 1.36 | 0.0 | 0.0 | 0.0 | false | + | 01 March 2024 | Buy Down Fee Amortization | 41.48 | 0.0 | 41.48 | 0.0 | 0.0 | 0.0 | false | +# --- check BDF journal entries for before and after charge-off trn processed --- # + And Loan Transactions tab has 2 a "BUY_DOWN_FEE_AMORTIZATION" transactions with date "01 March 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | INCOME | 450281 | Income From Buy Down | | 41.49 | + | LIABILITY | 145024 | Deferred Capitalized Income | 41.49 | | + | EXPENSE | 744007 | Credit Loss/Bad Debt | | 41.48 | + | LIABILITY | 145024 | Deferred Capitalized Income | 41.48 | | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 33.52 | 0.0 | 0.0 | 16.48 | + | 01 February 2024 | 50.0 | 25.0 | 0.0 | 0.0 | 25.0 | + + When Loan Pay-off is made on "1 March 2024" + Then Loan's all installments have obligations met + @TestRailId:ะก3825 Scenario: Verify loan with Buy Down Fee adjustment trn and repayment trns - UC4 When Admin sets the business date to "1 January 2024" @@ -1177,6 +1348,9 @@ Feature:Feature: Buy Down Fees | Type | Account code | Account name | Debit | Credit | | EXPENSE | 450280 | Buy Down Expense | 50.0 | | | LIABILITY | 145024 | Deferred Capitalized Income | | 50.0 | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 0.0 | 50.0 | 0.0 | 0.0 | # --- 1st repayment on February,1 ---# 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 @@ -1217,6 +1391,9 @@ Feature:Feature: Buy Down Fees | Type | Account code | Account name | Debit | Credit | | EXPENSE | 450280 | Buy Down Expense | | 10.0 | | LIABILITY | 145024 | Deferred Capitalized Income | 10.0 | | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 0.0 | 40.0 | 10.0 | 0.0 | # --- 2nd repayment on April,1 ---# When Admin sets the business date to "1 April 2024" When Admin runs inline COB job for Loan @@ -1230,6 +1407,9 @@ Feature:Feature: Buy Down Fees | 31 March 2024 | Accrual | 1.35 | 0.0 | 1.35 | 0.0 | 0.0 | 0.0 | false | | 31 March 2024 | Buy Down Fee Amortization | 40.0 | 0.0 | 40.0 | 0.0 | 0.0 | 0.0 | false | | 01 April 2024 | Repayment | 33.73 | 33.34 | 0.39 | 0.0 | 0.0 | 33.52 | false | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 40.0 | 0.0 | 10.0 | 0.0 | When Loan Pay-off is made on "1 April 2024" Then Loan's all installments have obligations met @@ -1273,6 +1453,10 @@ Feature:Feature: Buy Down Fees | Type | Account code | Account name | Debit | Credit | | EXPENSE | 450280 | Buy Down Expense | 50.0 | | | LIABILITY | 145024 | Deferred Capitalized Income | | 50.0 | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 0.0 | 50.0 | 0.0 | 0.0 | + # --- 1st repayment on February,1 ---# 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 @@ -1304,6 +1488,9 @@ Feature:Feature: Buy Down Fees | Type | Account code | Account name | Debit | Credit | | EXPENSE | 450280 | Buy Down Expense | | 10.0 | | LIABILITY | 145024 | Deferred Capitalized Income | 10.0 | | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 0.0 | 40.0 | 10.0 | 0.0 | # --- 2nd BuyDownFee Adjustment trns on March,15 ---# When Admin sets the business date to "15 March 2024" And Admin adds buy down fee adjustment with "AUTOPAY" payment type to the loan on "15 March 2024" with "5" EUR transaction amount @@ -1318,6 +1505,9 @@ Feature:Feature: Buy Down Fees | Type | Account code | Account name | Debit | Credit | | EXPENSE | 450280 | Buy Down Expense | | 5.0 | | LIABILITY | 145024 | Deferred Capitalized Income | 5.0 | | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 0.0 | 35.0 | 15.0 | 0.0 | # --- 2nd repayment on April,1 ---# When Admin sets the business date to "1 April 2024" When Admin runs inline COB job for Loan @@ -1332,6 +1522,9 @@ Feature:Feature: Buy Down Fees | 31 March 2024 | Accrual | 1.35 | 0.0 | 1.35 | 0.0 | 0.0 | 0.0 | false | | 31 March 2024 | Buy Down Fee Amortization | 35.0 | 0.0 | 35.0 | 0.0 | 0.0 | 0.0 | false | | 01 April 2024 | Repayment | 33.73 | 33.34 | 0.39 | 0.0 | 0.0 | 33.52 | false | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 35.0 | 0.0 | 15.0 | 0.0 | When Loan Pay-off is made on "1 April 2024" Then Loan's all installments have obligations met @@ -1377,6 +1570,9 @@ Feature:Feature: Buy Down Fees | Type | Account code | Account name | Debit | Credit | | EXPENSE | 450280 | Buy Down Expense | 100.0 | | | LIABILITY | 145024 | Deferred Capitalized Income | | 100.0 | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 02 January 2024 | 100.0 | 0.0 | 100.0 | 0.0 | 0.0 | # --- make write-off --- # And Admin does write-off the loan on "02 January 2024" Then Loan status will be "CLOSED_WRITTEN_OFF" @@ -1399,6 +1595,9 @@ Feature:Feature: Buy Down Fees | Type | Account code | Account name | Debit | Credit | | EXPENSE | e4 | Written off | | 100.0 | | LIABILITY | 145024 | Deferred Capitalized Income | 100.0 | | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 02 January 2024 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | @TestRailId:C3881 Scenario: Verify loan with Buy Down Fee adjustment reversal scenario - UC7 @@ -1428,6 +1627,9 @@ Feature:Feature: Buy Down Fees | Type | Account code | Account name | Debit | Credit | | EXPENSE | 450280 | Buy Down Expense | 50.0 | | | LIABILITY | 145024 | Deferred Capitalized Income | | 50.0 | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 0.0 | 50.0 | 0.0 | 0.0 | When Admin sets the business date to "2 January 2024" When Admin runs inline COB job for Loan # --- 1st repayment on February,1 ---# @@ -1510,6 +1712,9 @@ Feature:Feature: Buy Down Fees | 31 January 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | | 01 February 2024 | Repayment | 33.72 | 33.14 | 0.58 | 0.0 | 0.0 | 66.86 | false | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 17.03 | 32.97 | 0.0 | 0.0 | # --- 2nd repayment on March,1 ---# 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 @@ -1797,6 +2002,9 @@ Feature:Feature: Buy Down Fees | Type | Account code | Account name | Debit | Credit | | EXPENSE | 450280 | Buy Down Expense | | 10.0 | | LIABILITY | 145024 | Deferred Capitalized Income | 10.0 | | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 33.19 | 6.81 | 10.0 | 0.0 | # --- BuyDownFee Adjustment reversal on March,1 ---# When Customer undo "1"th "Buy Down Fee Adjustment" transaction made on "01 March 2024" When Admin sets the business date to "3 March 2024" @@ -1939,6 +2147,9 @@ Feature:Feature: Buy Down Fees | LIABILITY | 145024 | Deferred Capitalized Income | 10.0 | | | EXPENSE | 450280 | Buy Down Expense | 10.0 | | | LIABILITY | 145024 | Deferred Capitalized Income | | 10.0 | + And Buy down fee by external-id contains the following data: + | Date | Fee Amount | Amortized Amount | Not Yet Amortized Amount | Adjusted Amount | Charged Off Amount | + | 01 January 2024 | 50.0 | 34.07 | 15.93 | 0.0 | 0.0 | @TestRailId:C3887 Scenario: Verify Buy Down Fee reversal - UC6
