From ed5098b5a58d124b100222e669920d59ffefc628 Mon Sep 17 00:00:00 2001 From: Arnold Galovics Date: Tue, 26 Mar 2024 11:31:43 +0100 Subject: [PATCH] FINERACT-2070: Further test cases --- fineract-e2e-tests-core/build.gradle | 2 + .../fineract/test/service/JobService.java | 75 + .../AssetExternalizationStepDef.java | 771 +++ .../stepdef/common/BusinessDateStepDef.java | 64 + .../stepdef/common/BusinessStepStepDef.java | 152 + .../test/stepdef/common/ClientStepDef.java | 10 + .../test/stepdef/common/EventStepDef.java | 73 + .../stepdef/common/JournalEntriesStepDef.java | 225 + .../test/stepdef/common/SchedulerStepDef.java | 59 + .../test/stepdef/common/UserStepDef.java | 87 + .../test/stepdef/loan/InlineCOBStepDef.java | 89 + .../test/stepdef/loan/LoanCOBStepDef.java | 113 + .../loan/LoanChargeAdjustmentStepDef.java | 188 + .../stepdef/loan/LoanChargeBackStepDef.java | 174 + .../test/stepdef/loan/LoanChargeStepDef.java | 296 + .../stepdef/loan/LoanDelinquencyStepDef.java | 771 +++ .../test/stepdef/loan/LoanReAgingStepDef.java | 107 + .../loan/LoanReAmortizationStepDef.java | 89 + .../stepdef/loan/LoanRepaymentStepDef.java | 564 ++ .../stepdef/loan/LoanRescheduleStepDef.java | 144 + .../test/stepdef/loan/LoanStepDef.java | 2093 +++++++ .../features/AssetExternalization.feature | 1768 ++++++ .../resources/features/BusinessDate.feature | 28 + .../src/test/resources/features/COB.feature | 232 + .../test/resources/features/InlineCOB.feature | 143 + .../src/test/resources/features/Loan.feature | 5510 +++++++++++++++++ .../features/LoanAccrualTransaction.feature | 844 +++ .../test/resources/features/LoanCBR.feature | 1540 +++++ .../resources/features/LoanCharge.feature | 1676 +++++ .../resources/features/LoanChargeOff.feature | 1583 +++++ .../resources/features/LoanChargeback.feature | 2846 +++++++++ .../features/LoanDelinquency.feature | 1260 ++++ .../features/LoanDownPayment.feature | 2577 ++++++++ .../resources/features/LoanProduct.feature | 183 + .../resources/features/LoanReAging.feature | 572 ++ .../features/LoanReAmortization.feature | 377 ++ .../resources/features/LoanRepayment.feature | 3168 ++++++++++ .../resources/features/LoanReschedule.feature | 681 ++ .../resources/features/LoanWriteOff.feature | 67 + 39 files changed, 31201 insertions(+) create mode 100644 fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/service/JobService.java create mode 100644 fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/assetexternalization/AssetExternalizationStepDef.java create mode 100644 fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/BusinessDateStepDef.java create mode 100644 fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/BusinessStepStepDef.java create mode 100644 fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/EventStepDef.java create mode 100644 fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/JournalEntriesStepDef.java create mode 100644 fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/SchedulerStepDef.java create mode 100644 fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/UserStepDef.java create mode 100644 fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/InlineCOBStepDef.java create mode 100644 fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanCOBStepDef.java create mode 100644 fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanChargeAdjustmentStepDef.java create mode 100644 fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanChargeBackStepDef.java create mode 100644 fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanChargeStepDef.java create mode 100644 fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanDelinquencyStepDef.java create mode 100644 fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanReAgingStepDef.java create mode 100644 fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanReAmortizationStepDef.java create mode 100644 fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanRepaymentStepDef.java create mode 100644 fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanRescheduleStepDef.java create mode 100644 fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java create mode 100644 fineract-e2e-tests-runner/src/test/resources/features/AssetExternalization.feature create mode 100644 fineract-e2e-tests-runner/src/test/resources/features/BusinessDate.feature create mode 100644 fineract-e2e-tests-runner/src/test/resources/features/COB.feature create mode 100644 fineract-e2e-tests-runner/src/test/resources/features/InlineCOB.feature create mode 100644 fineract-e2e-tests-runner/src/test/resources/features/Loan.feature create mode 100644 fineract-e2e-tests-runner/src/test/resources/features/LoanAccrualTransaction.feature create mode 100644 fineract-e2e-tests-runner/src/test/resources/features/LoanCBR.feature create mode 100644 fineract-e2e-tests-runner/src/test/resources/features/LoanCharge.feature create mode 100644 fineract-e2e-tests-runner/src/test/resources/features/LoanChargeOff.feature create mode 100644 fineract-e2e-tests-runner/src/test/resources/features/LoanChargeback.feature create mode 100644 fineract-e2e-tests-runner/src/test/resources/features/LoanDelinquency.feature create mode 100644 fineract-e2e-tests-runner/src/test/resources/features/LoanDownPayment.feature create mode 100644 fineract-e2e-tests-runner/src/test/resources/features/LoanProduct.feature create mode 100644 fineract-e2e-tests-runner/src/test/resources/features/LoanReAging.feature create mode 100644 fineract-e2e-tests-runner/src/test/resources/features/LoanReAmortization.feature create mode 100644 fineract-e2e-tests-runner/src/test/resources/features/LoanRepayment.feature create mode 100644 fineract-e2e-tests-runner/src/test/resources/features/LoanReschedule.feature create mode 100644 fineract-e2e-tests-runner/src/test/resources/features/LoanWriteOff.feature diff --git a/fineract-e2e-tests-core/build.gradle b/fineract-e2e-tests-core/build.gradle index ff966ae345d..802d90072a6 100644 --- a/fineract-e2e-tests-core/build.gradle +++ b/fineract-e2e-tests-core/build.gradle @@ -33,6 +33,8 @@ dependencies { implementation 'org.springframework:spring-test' testImplementation 'org.springframework:spring-jms' + testImplementation 'com.github.spotbugs:spotbugs-annotations' + testImplementation 'com.squareup.retrofit2:retrofit:2.9.0' testImplementation 'commons-httpclient:commons-httpclient:3.1' testImplementation 'org.apache.commons:commons-lang3:3.14.0' diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/service/JobService.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/service/JobService.java new file mode 100644 index 00000000000..23b43ebc769 --- /dev/null +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/service/JobService.java @@ -0,0 +1,75 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.test.service; + +import static org.awaitility.Awaitility.await; + +import java.io.IOException; +import java.time.Duration; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.BooleanUtils; +import org.apache.fineract.client.models.ExecuteJobRequest; +import org.apache.fineract.client.models.GetJobsResponse; +import org.apache.fineract.client.services.SchedulerJobApi; +import org.apache.fineract.test.data.job.Job; +import org.apache.fineract.test.data.job.JobResolver; +import org.apache.fineract.test.helper.ErrorHelper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import retrofit2.Response; + +@Component +@RequiredArgsConstructor +@Slf4j +public class JobService { + + @Autowired + private SchedulerJobApi schedulerJobApi; + + private final JobResolver jobResolver; + + public void execute(Job job) { + try { + Long jobId = jobResolver.resolve(job); + Response response = schedulerJobApi.executeJob(jobId, "executeJob", new ExecuteJobRequest()).execute(); + ErrorHelper.checkSuccessfulApiCall(response); + } catch (IOException e) { + throw new RuntimeException("Exception while executing job %s".formatted(job.getName()), e); + } + } + + public void executeAndWait(Job job) { + execute(job); + waitUntilJobIsFinished(job); + } + + private void waitUntilJobIsFinished(Job job) { + String jobName = job.getName(); + await().atMost(Duration.ofMinutes(2)).alias("%s didn't finish on time".formatted(jobName)).pollInterval(Duration.ofSeconds(10)) + .until(() -> { + log.info("Waiting for job {} to finish", jobName); + Long jobId = jobResolver.resolve(job); + Response getJobsResponse = schedulerJobApi.retrieveOne5(jobId).execute(); + ErrorHelper.checkSuccessfulApiCall(getJobsResponse); + Boolean currentlyRunning = getJobsResponse.body().getCurrentlyRunning(); + return BooleanUtils.isFalse(currentlyRunning); + }); + } +} diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/assetexternalization/AssetExternalizationStepDef.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/assetexternalization/AssetExternalizationStepDef.java new file mode 100644 index 00000000000..24a5828c1e0 --- /dev/null +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/assetexternalization/AssetExternalizationStepDef.java @@ -0,0 +1,771 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.test.stepdef.assetexternalization; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.google.gson.Gson; +import io.cucumber.datatable.DataTable; +import io.cucumber.java.en.Then; +import io.cucumber.java.en.When; +import java.io.IOException; +import java.math.RoundingMode; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; +import lombok.extern.slf4j.Slf4j; +import org.apache.fineract.client.models.ExternalOwnerJournalEntryData; +import org.apache.fineract.client.models.ExternalOwnerTransferJournalEntryData; +import org.apache.fineract.client.models.ExternalTransferData; +import org.apache.fineract.client.models.JournalEntryData; +import org.apache.fineract.client.models.PageExternalTransferData; +import org.apache.fineract.client.models.PostInitiateTransferRequest; +import org.apache.fineract.client.models.PostInitiateTransferResponse; +import org.apache.fineract.client.models.PostLoansResponse; +import org.apache.fineract.client.services.ExternalAssetOwnersApi; +import org.apache.fineract.client.util.JSON; +import org.apache.fineract.test.data.AssetExternalizationErrorMessage; +import org.apache.fineract.test.helper.ErrorHelper; +import org.apache.fineract.test.helper.ErrorMessageHelper; +import org.apache.fineract.test.helper.ErrorResponse; +import org.apache.fineract.test.helper.Utils; +import org.apache.fineract.test.messaging.event.EventCheckHelper; +import org.apache.fineract.test.stepdef.AbstractStepDef; +import org.apache.fineract.test.support.TestContextKey; +import org.springframework.beans.factory.annotation.Autowired; +import retrofit2.Response; + +@Slf4j +public class AssetExternalizationStepDef extends AbstractStepDef { + + public static final String OWNER_EXTERNAL_ID_PREFIX = "TestOwner-"; + public static final String DATE_FORMAT_ASSET_EXT = "yyyy-MM-dd"; + public static final String DEFAULT_LOCALE = "en"; + public static final String TRANSACTION_TYPE_SALE = "sale"; + public static final String TRANSACTION_TYPE_BUYBACK = "buyback"; + public static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern(DATE_FORMAT_ASSET_EXT); + private static final Gson GSON = new JSON().getGson(); + + @Autowired + private ExternalAssetOwnersApi externalAssetOwnersApi; + + @Autowired + private EventCheckHelper eventCheckHelper; + + @When("Admin makes asset externalization request by Loan ID with unique ownerExternalId, user-generated transferExternalId and the following data:") + public void createAssetExternalizationRequestByLoanIdUserGeneratedExtId(DataTable table) throws IOException { + // if user created transferExternalId previously, it will use that, otherwise create a new one + String transferExternalId = testContext().get(TestContextKey.ASSET_EXTERNALIZATION_TRANSFER_EXTERNAL_ID_USER_GENERATED); + if (transferExternalId == null) { + transferExternalId = Utils.randomNameGenerator("TestTransferExtId_", 3); + testContext().set(TestContextKey.ASSET_EXTERNALIZATION_TRANSFER_EXTERNAL_ID_USER_GENERATED, transferExternalId); + } + + createAssetExternalizationRequestByLoanId(table, transferExternalId); + } + + @When("Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data:") + public void createAssetExternalizationRequestByLoanIdSystemGeneratedExtId(DataTable table) throws IOException { + createAssetExternalizationRequestByLoanId(table, null); + } + + private void createAssetExternalizationRequestByLoanId(DataTable table, String transferExternalId) throws IOException { + createAssetExternalizationRequestByLoanId(table, transferExternalId, true); + } + + private void createAssetExternalizationRequestByLoanId(DataTable table, String transferExternalId, boolean regenerateOwner) + throws IOException { + List> data = table.asLists(); + List transferData = data.get(1); + + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + PostInitiateTransferRequest request = new PostInitiateTransferRequest(); + if (transferData.get(0).equals(TRANSACTION_TYPE_BUYBACK)) { + request.settlementDate(transferData.get(1))// + .transferExternalId(transferExternalId)// + .dateFormat(DATE_FORMAT_ASSET_EXT)// + .locale(DEFAULT_LOCALE);// + + Response response = externalAssetOwnersApi + .transferRequestWithLoanId(loanId, request, transferData.get(0)).execute(); + testContext().set(TestContextKey.ASSET_EXTERNALIZATION_RESPONSE, response); + testContext().set(TestContextKey.ASSET_EXTERNALIZATION_BUYBACK_TRANSFER_EXTERNAL_ID_FROM_RESPONSE, + response.body().getResourceExternalId()); + ErrorHelper.checkSuccessfulApiCall(response); + + } else if (transferData.get(0).equals(TRANSACTION_TYPE_SALE)) { + String ownerExternalId; + if (regenerateOwner) { + ownerExternalId = Utils.randomNameGenerator(OWNER_EXTERNAL_ID_PREFIX, 3); + } else { + ownerExternalId = testContext().get(TestContextKey.ASSET_EXTERNALIZATION_OWNER_EXTERNAL_ID); + } + + request.settlementDate(transferData.get(1))// + .ownerExternalId(ownerExternalId)// + .transferExternalId(transferExternalId)// + .purchasePriceRatio(transferData.get(2))// + .dateFormat(DATE_FORMAT_ASSET_EXT)// + .locale(DEFAULT_LOCALE);// + + Response response = externalAssetOwnersApi + .transferRequestWithLoanId(loanId, request, transferData.get(0)).execute(); + testContext().set(TestContextKey.ASSET_EXTERNALIZATION_RESPONSE, response); + testContext().set(TestContextKey.ASSET_EXTERNALIZATION_SALES_TRANSFER_EXTERNAL_ID_FROM_RESPONSE, + response.body().getResourceExternalId()); + testContext().set(TestContextKey.ASSET_EXTERNALIZATION_OWNER_EXTERNAL_ID, ownerExternalId); + ErrorHelper.checkSuccessfulApiCall(response); + + } else { + throw new IllegalStateException(String.format("%s is not supported Asset externalization transaction", transferData.get(0))); + } + } + + @When("Admin makes asset externalization BUYBACK request with ownerExternalId = null and settlement date {string} by Loan ID with system-generated transferExternalId") + public void createAssetExternalizationBuybackRequestOwnerNullByLoanIdSystemGeneratedExtId(String settlementDate) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + PostInitiateTransferRequest request = new PostInitiateTransferRequest()// + .settlementDate(settlementDate)// + .ownerExternalId(null)// + .transferExternalId(testContext().get(TestContextKey.ASSET_EXTERNALIZATION_TRANSFER_EXTERNAL_ID_FROM_RESPONSE))// + .dateFormat(DATE_FORMAT_ASSET_EXT)// + .locale(DEFAULT_LOCALE);// + + Response response = externalAssetOwnersApi + .transferRequestWithLoanId(loanId, request, TRANSACTION_TYPE_BUYBACK).execute(); + testContext().set(TestContextKey.ASSET_EXTERNALIZATION_RESPONSE, response); + testContext().set(TestContextKey.ASSET_EXTERNALIZATION_BUYBACK_TRANSFER_EXTERNAL_ID_FROM_RESPONSE, + response.body().getResourceExternalId()); + ErrorHelper.checkSuccessfulApiCall(response); + } + + @When("Admin makes asset externalization request by Loan external ID with unique ownerExternalId, user-generated transferExternalId and the following data:") + public void createAssetExternalizationRequestByLoanExternalIdUserGeneratedExtId(DataTable table) throws IOException { + // if user created transferExternalId previously, it will use that, otherwise create a new one + String transferExternalId = testContext().get(TestContextKey.ASSET_EXTERNALIZATION_TRANSFER_EXTERNAL_ID_USER_GENERATED); + if (transferExternalId == null) { + transferExternalId = Utils.randomNameGenerator("TestTransferExtId_", 3); + testContext().set(TestContextKey.ASSET_EXTERNALIZATION_TRANSFER_EXTERNAL_ID_USER_GENERATED, transferExternalId); + } + + createAssetExternalizationRequestByLoanExternalId(table, transferExternalId); + } + + @When("Admin makes asset externalization request by Loan external ID with unique ownerExternalId, system-generated transferExternalId and the following data:") + public void createAssetExternalizationRequestByLoanExternalIdSystemGeneratedExtId(DataTable table) throws IOException { + createAssetExternalizationRequestByLoanExternalId(table, null); + } + + private void createAssetExternalizationRequestByLoanExternalId(DataTable table, String transferExternalId) throws IOException { + List> data = table.asLists(); + List transferData = data.get(1); + + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + String loanExternalId = loanResponse.body().getResourceExternalId(); + + PostInitiateTransferRequest request = new PostInitiateTransferRequest(); + if (transferData.get(0).equals(TRANSACTION_TYPE_BUYBACK)) { + request.settlementDate(transferData.get(1))// + .transferExternalId(transferExternalId)// + .dateFormat(DATE_FORMAT_ASSET_EXT)// + .locale(DEFAULT_LOCALE);// + + Response response = externalAssetOwnersApi + .transferRequestWithLoanExternalId(loanExternalId, request, transferData.get(0)).execute(); + testContext().set(TestContextKey.ASSET_EXTERNALIZATION_RESPONSE, response); + testContext().set(TestContextKey.ASSET_EXTERNALIZATION_BUYBACK_TRANSFER_EXTERNAL_ID_FROM_RESPONSE, + response.body().getResourceExternalId()); + ErrorHelper.checkSuccessfulApiCall(response); + + } else if (transferData.get(0).equals(TRANSACTION_TYPE_SALE)) { + String ownerExternalId = Utils.randomNameGenerator(OWNER_EXTERNAL_ID_PREFIX, 3); + + request.settlementDate(transferData.get(1))// + .ownerExternalId(ownerExternalId)// + .transferExternalId(transferExternalId)// + .purchasePriceRatio(transferData.get(2))// + .dateFormat(DATE_FORMAT_ASSET_EXT)// + .locale(DEFAULT_LOCALE);// + + Response response = externalAssetOwnersApi + .transferRequestWithLoanExternalId(loanExternalId, request, transferData.get(0)).execute(); + testContext().set(TestContextKey.ASSET_EXTERNALIZATION_RESPONSE, response); + testContext().set(TestContextKey.ASSET_EXTERNALIZATION_SALES_TRANSFER_EXTERNAL_ID_FROM_RESPONSE, + response.body().getResourceExternalId()); + testContext().set(TestContextKey.ASSET_EXTERNALIZATION_OWNER_EXTERNAL_ID, ownerExternalId); + ErrorHelper.checkSuccessfulApiCall(response); + + } else { + throw new IllegalStateException(String.format("%s is not supported Asset externalization transaction", transferData.get(0))); + } + } + + @Then("Asset externalization response has the correct Loan ID, transferExternalId") + public void checkAssetExternalizationResponse() { + String ownerExternalIdStored = testContext().get(TestContextKey.ASSET_EXTERNALIZATION_OWNER_EXTERNAL_ID); + + String transferExternalIdExpected = testContext().get(TestContextKey.ASSET_EXTERNALIZATION_TRANSFER_EXTERNAL_ID_USER_GENERATED); + + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Response response = testContext().get(TestContextKey.ASSET_EXTERNALIZATION_RESPONSE); + PostInitiateTransferResponse body = response.body(); + Long loanIdActual = body.getSubResourceId(); + String transferExternalIdActual = body.getResourceExternalId(); + + log.info("loanId: {}", loanId); + log.info("ownerExternalIdStored: {}", ownerExternalIdStored); + log.info("transferExternalId generated by user: {}", transferExternalIdExpected); + log.info("transferExternalIdActual: {}", transferExternalIdActual); + + assertThat(loanIdActual).as(ErrorMessageHelper.wrongDataInAssetExternalizationResponse(loanIdActual, loanId)).isEqualTo(loanId); + assertThat(body.getResourceId()).isNotNull(); + if (transferExternalIdExpected != null) { + assertThat(transferExternalIdActual) + .as(ErrorMessageHelper.wrongDataInAssetExternalizationResponse(transferExternalIdActual, transferExternalIdExpected)) + .isEqualTo(transferExternalIdExpected); + } else { + assertThat(transferExternalIdActual).isNotEmpty(); + } + } + + @Then("Fetching Asset externalization details by loan id gives numberOfElements: {int} with correct ownerExternalId and the following data:") + public void checkAssetExternalizationDetailsByLoanId(int numberOfElements, DataTable table) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Response response = externalAssetOwnersApi.getTransfers(null, loanId, null, null, null).execute(); + ErrorHelper.checkSuccessfulApiCall(response); + + checkExternalAssetDetails(loanId, null, response, numberOfElements, table); + } + + @Then("Fetching Asset externalization details by loan external id gives numberOfElements: {int} with correct ownerExternalId and the following data:") + public void checkAssetExternalizationDetailsByLoanExternalId(int numberOfElements, DataTable table) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + String loanExternalId = loanResponse.body().getResourceExternalId(); + + Response response = externalAssetOwnersApi.getTransfers(null, null, loanExternalId, null, null).execute(); + ErrorHelper.checkSuccessfulApiCall(response); + + checkExternalAssetDetails(null, loanExternalId, response, numberOfElements, table); + } + + @Then("Fetching Asset externalization details by transfer external id gives numberOfElements: {int} with correct ownerExternalId and the following data:") + public void checkAssetExternalizationDetailsByTransferExternalId(int numberOfElements, DataTable table) throws IOException { + String transferExternalId = testContext().get(TestContextKey.ASSET_EXTERNALIZATION_SALES_TRANSFER_EXTERNAL_ID_FROM_RESPONSE); + + Response response = externalAssetOwnersApi.getTransfers(transferExternalId, null, null, null, null) + .execute(); + ErrorHelper.checkSuccessfulApiCall(response); + + checkExternalAssetDetails(null, null, response, numberOfElements, table); + } + + @Then("Asset externalization details has the generated transferExternalId") + public void checkGeneratedTransferExternalId() throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Response assetExtResponse = testContext().get(TestContextKey.ASSET_EXTERNALIZATION_RESPONSE); + String transferExternalIdExpected = assetExtResponse.body().getResourceExternalId(); + + Response response = externalAssetOwnersApi.getTransfers(null, loanId, null, null, null).execute(); + ErrorHelper.checkSuccessfulApiCall(response); + List content = response.body().getContent(); + + content.forEach(e -> { + assertThat(e.getTransferExternalId()).as(ErrorMessageHelper + .wrongDataInAssetExternalizationTransferExternalId(e.getTransferExternalId(), transferExternalIdExpected)) + .isEqualTo(transferExternalIdExpected); + }); + } + + private void checkExternalAssetDetails(Long loanId, String loanExternalId, Response response, + int numberOfElements, DataTable table) { + PageExternalTransferData body = response.body(); + Integer numberOfElementsActual = body.getNumberOfElements(); + List content = body.getContent(); + + String ownerExternalIdStored = testContext().get(TestContextKey.ASSET_EXTERNALIZATION_OWNER_EXTERNAL_ID); + String transferExternalId; + + List> data = table.asLists(); + for (int i = 1; i < data.size(); i++) { + List expectedValues = data.get(i); + + String transactionType = expectedValues.get(5); + if (transactionType.equals(ExternalTransferData.StatusEnum.BUYBACK.getValue())) { + transferExternalId = testContext().get(TestContextKey.ASSET_EXTERNALIZATION_BUYBACK_TRANSFER_EXTERNAL_ID_FROM_RESPONSE); + } else { + transferExternalId = testContext().get(TestContextKey.ASSET_EXTERNALIZATION_SALES_TRANSFER_EXTERNAL_ID_FROM_RESPONSE); + } + + expectedValues.add(ownerExternalIdStored); + expectedValues.add(loanId == null ? null : String.valueOf(loanId)); + expectedValues.add(loanExternalId); + expectedValues.add(transferExternalId); + + List> actualValuesList = content.stream().map(t -> { + List actualValues = new ArrayList<>(); + actualValues.add(t.getSettlementDate() == null ? null : FORMATTER.format(t.getSettlementDate())); + actualValues.add(t.getPurchasePriceRatio() == null ? null : t.getPurchasePriceRatio()); + actualValues.add(t.getStatus() == null ? null : String.valueOf(t.getStatus())); + actualValues.add(t.getEffectiveFrom() == null ? null : FORMATTER.format(t.getEffectiveFrom())); + actualValues.add(t.getEffectiveTo() == null ? null : FORMATTER.format(t.getEffectiveTo())); + actualValues.add(transactionType); + actualValues.add(t.getOwner().getExternalId() == null ? null : t.getOwner().getExternalId()); + actualValues.add(loanId == null ? null : String.valueOf(t.getLoan().getLoanId())); + actualValues.add(loanExternalId == null ? null : t.getLoan().getExternalId()); + actualValues.add(t.getTransferExternalId()); + return actualValues; + }).collect(Collectors.toList()); + + boolean containsExpectedValues = actualValuesList.stream().anyMatch(actualValues -> actualValues.equals(expectedValues)); + + assertThat(numberOfElementsActual) + .as(ErrorMessageHelper.wrongTotalFilteredRecordsInAssetExternalizationDetails(numberOfElementsActual, numberOfElements)) + .isEqualTo(numberOfElements); + assertThat(containsExpectedValues).as(ErrorMessageHelper.wrongValueInExternalAssetDetails(i, actualValuesList, expectedValues)) + .isTrue(); + } + } + + @Then("BUYBACK transaction results a {int} error and proper error message when its settlementDate is earlier than the original settlementDate") + public void buybackDateError(int errorCodeExpected, DataTable table) throws IOException { + List> data = table.asLists(); + List transferData = data.get(1); + + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + String transferExternalId = testContext().get(TestContextKey.ASSET_EXTERNALIZATION_TRANSFER_EXTERNAL_ID_FROM_RESPONSE); + + PostInitiateTransferRequest request = new PostInitiateTransferRequest()// + .settlementDate(transferData.get(1))// + .transferExternalId(transferExternalId)// + .dateFormat(DATE_FORMAT_ASSET_EXT)// + .locale(DEFAULT_LOCALE);// + + Response response = externalAssetOwnersApi + .transferRequestWithLoanId(loanId, request, transferData.get(0)).execute(); + + PageExternalTransferData transfers = externalAssetOwnersApi.getTransfers(null, loanId, null, null, null).execute().body(); + String settlementDateOriginal = FORMATTER.format(transfers.getContent().get(0).getSettlementDate()); + String errorMessageExpected = String.format( + "This loan cannot be bought back, settlement date is earlier than effective transfer settlement date: %s", + settlementDateOriginal); + + String errorToString = response.errorBody().string(); + ErrorResponse errorResponse = GSON.fromJson(errorToString, ErrorResponse.class); + String errorMessageActual = errorResponse.getDeveloperMessage(); + int errorCodeActual = response.code(); + + assertThat(errorCodeActual).as(ErrorMessageHelper.wrongErrorCode(errorCodeActual, errorCodeExpected)).isEqualTo(errorCodeExpected); + assertThat(errorMessageActual).as(ErrorMessageHelper.wrongErrorMessage(errorMessageActual, errorMessageExpected)) + .isEqualTo(errorMessageExpected); + + log.info("ERROR CODE: {}", errorCodeActual); + log.info("ERROR MESSAGE: {}", errorMessageActual); + } + + @Then("Asset externalization transaction with the following data results a {int} error and {string} error message") + public void transactionError(int errorCodeExpected, String errorMessageType, DataTable table) throws IOException { + List> data = table.asLists(); + List transferData = data.get(1); + + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + PostInitiateTransferRequest request = new PostInitiateTransferRequest(); + if (transferData.get(0).equals(TRANSACTION_TYPE_BUYBACK)) { + request.settlementDate(transferData.get(1))// + .transferExternalId(null)// + .dateFormat(DATE_FORMAT_ASSET_EXT)// + .locale(DEFAULT_LOCALE);// + } else if (transferData.get(0).equals(TRANSACTION_TYPE_SALE)) { + String ownerExternalId = Utils.randomNameGenerator(OWNER_EXTERNAL_ID_PREFIX, 3); + + request.settlementDate(transferData.get(1))// + .ownerExternalId(ownerExternalId)// + .transferExternalId(null)// + .purchasePriceRatio(transferData.get(2))// + .dateFormat(DATE_FORMAT_ASSET_EXT)// + .locale(DEFAULT_LOCALE);// + + testContext().set(TestContextKey.ASSET_EXTERNALIZATION_OWNER_EXTERNAL_ID, ownerExternalId); + } else { + throw new IllegalStateException(String.format("%s is not supported Asset externalization transaction", transferData.get(0))); + } + + Response response = externalAssetOwnersApi + .transferRequestWithLoanId(loanId, request, transferData.get(0)).execute(); + + AssetExternalizationErrorMessage errorMsgType = AssetExternalizationErrorMessage.valueOf(errorMessageType); + String errorMessageExpected = errorMsgType.getValue(); + + String errorToString = response.errorBody().string(); + ErrorResponse errorResponse = GSON.fromJson(errorToString, ErrorResponse.class); + String errorMessageActual = errorResponse.getDeveloperMessage(); + int errorCodeActual = response.code(); + + assertThat(errorCodeActual).as(ErrorMessageHelper.wrongErrorCode(errorCodeActual, errorCodeExpected)).isEqualTo(errorCodeExpected); + assertThat(errorMessageActual).as(ErrorMessageHelper.wrongErrorMessage(errorMessageActual, errorMessageExpected)) + .isEqualTo(errorMessageExpected); + + log.info("ERROR CODE: {}", errorCodeActual); + log.info("ERROR MESSAGE: {}", errorMessageActual); + } + + @Then("Asset externalization SALES transaction with ownerExternalId = null and the following data results a {int} error and {string} error message") + public void transactionErrorSalesOwnerNull(int errorCodeExpected, String errorMessageType, DataTable table) throws IOException { + List> data = table.asLists(); + List transferData = data.get(1); + + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + PostInitiateTransferRequest request = new PostInitiateTransferRequest()// + .settlementDate(transferData.get(0))// + .ownerExternalId(null)// + .transferExternalId(null)// + .purchasePriceRatio(transferData.get(1))// + .dateFormat(DATE_FORMAT_ASSET_EXT)// + .locale(DEFAULT_LOCALE);// + + Response response = externalAssetOwnersApi + .transferRequestWithLoanId(loanId, request, TRANSACTION_TYPE_SALE).execute(); + + AssetExternalizationErrorMessage errorMsgType = AssetExternalizationErrorMessage.valueOf(errorMessageType); + String errorMessageExpected = errorMsgType.getValue(); + + String errorToString = response.errorBody().string(); + ErrorResponse errorResponse = GSON.fromJson(errorToString, ErrorResponse.class); + String errorMessageActual = errorResponse.getDeveloperMessage(); + int errorCodeActual = response.code(); + + assertThat(errorCodeActual).as(ErrorMessageHelper.wrongErrorCode(errorCodeActual, errorCodeExpected)).isEqualTo(errorCodeExpected); + assertThat(errorMessageActual).as(ErrorMessageHelper.wrongErrorMessage(errorMessageActual, errorMessageExpected)) + .isEqualTo(errorMessageExpected); + + log.info("ERROR CODE: {}", errorCodeActual); + log.info("ERROR MESSAGE: {}", errorMessageActual); + } + + @Then("The latest asset externalization transaction with {string} status has the following TRANSFER Journal entries:") + public void checkJournalEntriesTransaction(String status, DataTable table) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Long lastTransferIdByStatus = getLastTransferIdByStatus(loanId, status); + + Response journalEntriesOfTransfer = externalAssetOwnersApi + .getJournalEntriesOfTransfer(lastTransferIdByStatus, null, null).execute(); + List content = journalEntriesOfTransfer.body().getJournalEntryData().getContent(); + + List> data = table.asLists(); + int linesExpected = data.size() - 1; + + for (int i = 1; i < data.size(); i++) { + List expectedValues = data.get(i); + List> actualValuesList = content.stream().map(t -> { + List actualValues = new ArrayList<>(); + actualValues.add(t.getGlAccountType().getValue()); + actualValues.add(t.getGlAccountCode()); + actualValues.add(t.getGlAccountName()); + actualValues.add(t.getEntryType().getValue()); + actualValues.add(t.getAmount().setScale(2, RoundingMode.HALF_DOWN).toString()); + return actualValues; + }).collect(Collectors.toList()); + + boolean containsExpectedValues = actualValuesList.stream().anyMatch(actualValues -> actualValues.equals(expectedValues)); + assertThat(containsExpectedValues) + .as(ErrorMessageHelper.wrongValueInLineInAssetExternalizationJournalEntry(i, actualValuesList, expectedValues)) + .isTrue(); + + int linesActual = journalEntriesOfTransfer.body().getJournalEntryData().getNumberOfElements(); + assertThat(linesActual).as(ErrorMessageHelper.wrongNumberOfLinesInAssetExternalizationJournalEntry(linesActual, linesExpected)) + .isEqualTo(linesExpected); + } + + log.info("loanId: {}", journalEntriesOfTransfer.body().getTransferData().getLoan().getLoanId()); + log.info("ownerExternalId: {}", journalEntriesOfTransfer.body().getTransferData().getOwner().getExternalId()); + log.info("transferId: {}", lastTransferIdByStatus); + log.info("transferExternalId: {}", journalEntriesOfTransfer.body().getTransferData().getTransferExternalId()); + } + + private Long getLastTransferIdByStatus(Long loanId, String status) throws IOException { + Response transfersResponse = externalAssetOwnersApi.getTransfers(null, loanId, null, null, null) + .execute(); + List content = transfersResponse.body().getContent(); + + ExternalTransferData result = content.stream().filter(t -> status.equals(t.getStatus().getValue())) + .reduce((first, second) -> second) + .orElseThrow(() -> new IllegalStateException(String.format("No Journal entry found with status: %s", status))); + + return result.getTransferId(); + } + + private Long getLastTransferId(Long loanId) throws IOException { + Response transfersResponse = externalAssetOwnersApi.getTransfers(null, loanId, null, null, null) + .execute(); + List content = transfersResponse.body().getContent(); + ExternalTransferData result = content.stream().reduce((first, second) -> second) + .orElseThrow(() -> new IllegalStateException("transfersResponse.body().getContent() is empty")); + + return result.getTransferId(); + } + + @Then("The asset external owner has the following OWNER Journal entries:") + public void checkJournalEntriesOwner(DataTable table) throws IOException { + String ownerExternalId = testContext().get(TestContextKey.ASSET_EXTERNALIZATION_OWNER_EXTERNAL_ID); + + Response journalEntriesOfOwner = externalAssetOwnersApi + .getJournalEntriesOfOwner(ownerExternalId, null, null).execute(); + List content = journalEntriesOfOwner.body().getJournalEntryData().getContent(); + + List> data = table.asLists(); + int linesExpected = data.size() - 1; + + for (int i = 1; i < data.size(); i++) { + List expectedValues = data.get(i); + List> actualValuesList = content.stream().map(t -> { + List actualValues = new ArrayList<>(); + actualValues.add(t.getGlAccountType().getValue()); + actualValues.add(t.getGlAccountCode()); + actualValues.add(t.getGlAccountName()); + actualValues.add(t.getEntryType().getValue()); + actualValues.add(t.getAmount().setScale(2, RoundingMode.HALF_DOWN).toString()); + return actualValues; + }).collect(Collectors.toList()); + + boolean containsExpectedValues = actualValuesList.stream().anyMatch(actualValues -> actualValues.equals(expectedValues)); + assertThat(containsExpectedValues) + .as(ErrorMessageHelper.wrongValueInLineInAssetExternalizationJournalEntry(i, actualValuesList, expectedValues)) + .isTrue(); + + int linesActual = journalEntriesOfOwner.body().getJournalEntryData().getNumberOfElements(); + assertThat(linesActual).as(ErrorMessageHelper.wrongNumberOfLinesInAssetExternalizationJournalEntry(linesActual, linesExpected)) + .isEqualTo(linesExpected); + } + + log.info("ownerExternalId: {}", journalEntriesOfOwner.body().getOwnerData().getExternalId()); + } + + @Then("LoanOwnershipTransferBusinessEvent is created") + public void loanOwnershipTransferBusinessEventCheck() throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + Long transferId = getLastTransferId(loanId); + + eventCheckHelper.loanOwnershipTransferBusinessEventCheck(loanId, transferId); + } + + @Then("LoanOwnershipTransferBusinessEvent with transfer status: {string} and transfer status reason {string} is created") + public void loanOwnershipTransferBusinessEventCheck(String transferStatus, String transferStatusReason) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + Long transferId = getLastTransferId(loanId); + + eventCheckHelper.loanOwnershipTransferBusinessEventWithStatusCheck(loanId, transferId, transferStatus, transferStatusReason); + } + + @Then("LoanAccountSnapshotBusinessEvent is created") + public void loanAccountSnapshotBusinessEventCheck() throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + Long transferId = getLastTransferId(loanId); + + eventCheckHelper.loanAccountSnapshotBusinessEventCheck(loanId, transferId); + } + + @Then("Asset externalization response {string} has the correct Loan ID, transferExternalId") + public void checkAssetExternalizationResponse(String type) { + String ownerExternalIdStored = testContext().get(TestContextKey.ASSET_EXTERNALIZATION_OWNER_EXTERNAL_ID); + + String transferExternalIdExpected = testContext().get(TestContextKey.ASSET_EXTERNALIZATION_BUYBACK_TRANSFER_PREFIX + "_" + type); + + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Response response = testContext().get(TestContextKey.ASSET_EXTERNALIZATION_RESPONSE); + PostInitiateTransferResponse body = response.body(); + Long loanIdActual = body.getSubResourceId(); + String transferExternalIdActual = body.getResourceExternalId(); + + log.info("loanId: {}", loanId); + log.info("ownerExternalIdStored: {}", ownerExternalIdStored); + log.info("transferExternalId generated by user: {}", transferExternalIdExpected); + log.info("transferExternalIdActual: {}", transferExternalIdActual); + + assertThat(loanIdActual).as(ErrorMessageHelper.wrongDataInAssetExternalizationResponse(loanIdActual, loanId)).isEqualTo(loanId); + assertThat(body.getResourceId()).isNotNull(); + if (transferExternalIdExpected != null) { + assertThat(transferExternalIdActual) + .as(ErrorMessageHelper.wrongDataInAssetExternalizationResponse(transferExternalIdActual, transferExternalIdExpected)) + .isEqualTo(transferExternalIdExpected); + } else { + assertThat(transferExternalIdActual).isNotEmpty(); + } + } + + @When("Admin makes asset externalization request for type {string} by Loan ID with unique ownerExternalId, user-generated transferExternalId and the following data:") + public void createAssetExternalizationRequestByLoanIdUserGeneratedExtId(String type, DataTable table) throws IOException { + // if user created transferExternalId previously, it will use that, otherwise create a new one + String transferExternalId = testContext() + .get(TestContextKey.ASSET_EXTERNALIZATION_TRANSFER_EXTERNAL_ID_USER_GENERATED + "_" + type); + if (transferExternalId == null) { + transferExternalId = Utils.randomNameGenerator("TestTransferExtId_", 3); + testContext().set(TestContextKey.ASSET_EXTERNALIZATION_TRANSFER_EXTERNAL_ID_USER_GENERATED + "_" + type, transferExternalId); + } + + createAssetExternalizationRequestByLoanId(table, transferExternalId); + } + + @When("Admin send {string} command to the transaction type {string}") + public void adminTransactionCommandTheWithType(String command, String type) throws IOException { + String transferExternalId = testContext() + .get(TestContextKey.ASSET_EXTERNALIZATION_TRANSFER_EXTERNAL_ID_USER_GENERATED + "_" + type); + Response response = externalAssetOwnersApi.transferRequestWithId1(transferExternalId, command) + .execute(); + ErrorHelper.checkSuccessfulApiCall(response); + } + + @When("Admin send {string} command to the transaction type {string} will throw error") + public void adminTransactionCommandTheWithTypeThrowError(String command, String type) throws IOException { + String transferExternalId = testContext() + .get(TestContextKey.ASSET_EXTERNALIZATION_TRANSFER_EXTERNAL_ID_USER_GENERATED + "_" + type); + Response response = externalAssetOwnersApi.transferRequestWithId1(transferExternalId, command) + .execute(); + ErrorHelper.checkFailedApiCall(response, 403); + } + + @Then("Fetching Asset externalization details by loan id gives numberOfElements: {int} with correct ownerExternalId, ignore transactionExternalId and contain the following data:") + public void checkAssetExternalizationDetailsByLoanIdIgnoreTransactionExternalId(int numberOfElements, DataTable table) + throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Response response = externalAssetOwnersApi.getTransfers(null, loanId, null, null, null).execute(); + ErrorHelper.checkSuccessfulApiCall(response); + + checkExternalAssetDetailsIgnoreTransferExternalId(loanId, null, response, numberOfElements, table); + } + + private void checkExternalAssetDetailsIgnoreTransferExternalId(Long loanId, String loanExternalId, + Response response, int numberOfElements, DataTable table) { + PageExternalTransferData body = response.body(); + Integer numberOfElementsActual = body.getNumberOfElements(); + List content = body.getContent(); + + String ownerExternalIdStored = testContext().get(TestContextKey.ASSET_EXTERNALIZATION_OWNER_EXTERNAL_ID); + + List> data = table.asLists(); + for (int i = 1; i < data.size(); i++) { + List expectedValues = data.get(i); + expectedValues.add(ownerExternalIdStored); + expectedValues.add(loanId == null ? null : String.valueOf(loanId)); + expectedValues.add(loanExternalId); + + List> actualValuesList = content.stream().map(t -> { + List actualValues = new ArrayList<>(); + actualValues.add(t.getSettlementDate() == null ? null : FORMATTER.format(t.getSettlementDate())); + actualValues.add(t.getPurchasePriceRatio() == null ? null : t.getPurchasePriceRatio()); + actualValues.add(t.getStatus() == null ? null : String.valueOf(t.getStatus())); + actualValues.add(t.getEffectiveFrom() == null ? null : FORMATTER.format(t.getEffectiveFrom())); + actualValues.add(t.getEffectiveTo() == null ? null : FORMATTER.format(t.getEffectiveTo())); + actualValues.add(t.getOwner().getExternalId() == null ? null : t.getOwner().getExternalId()); + actualValues.add(loanId == null ? null : String.valueOf(t.getLoan().getLoanId())); + actualValues.add(loanExternalId == null ? null : t.getLoan().getExternalId()); + return actualValues; + }).collect(Collectors.toList()); + + boolean containsExpectedValues = actualValuesList.stream().anyMatch(actualValues -> actualValues.equals(expectedValues)); + + assertThat(numberOfElementsActual) + .as(ErrorMessageHelper.wrongTotalFilteredRecordsInAssetExternalizationDetails(numberOfElementsActual, numberOfElements)) + .isEqualTo(numberOfElements); + assertThat(containsExpectedValues).as(ErrorMessageHelper.wrongValueInExternalAssetDetails(i, actualValuesList, expectedValues)) + .isTrue(); + } + } + + @When("Admin send {string} command on {string} transaction it will throw an error") + public void adminSendCommandAndItWillThrowError(String command, String transactionType) throws IOException { + String transferExternalId; + if (transactionType.equals(ExternalTransferData.StatusEnum.BUYBACK.getValue())) { + transferExternalId = testContext().get(TestContextKey.ASSET_EXTERNALIZATION_BUYBACK_TRANSFER_EXTERNAL_ID_FROM_RESPONSE); + } else { + transferExternalId = testContext().get(TestContextKey.ASSET_EXTERNALIZATION_SALES_TRANSFER_EXTERNAL_ID_FROM_RESPONSE); + } + + Response response = externalAssetOwnersApi.transferRequestWithId1(transferExternalId, command) + .execute(); + ErrorHelper.checkFailedApiCall(response, 403); + } + + @When("Admin send {string} command on {string} transaction") + public void adminSendCommand(String command, String transactionType) throws IOException { + String transferExternalId; + if (transactionType.equals(ExternalTransferData.StatusEnum.BUYBACK.getValue())) { + transferExternalId = testContext().get(TestContextKey.ASSET_EXTERNALIZATION_BUYBACK_TRANSFER_EXTERNAL_ID_FROM_RESPONSE); + } else { + transferExternalId = testContext().get(TestContextKey.ASSET_EXTERNALIZATION_SALES_TRANSFER_EXTERNAL_ID_FROM_RESPONSE); + } + + Response response = externalAssetOwnersApi.transferRequestWithId1(transferExternalId, command) + .execute(); + ErrorHelper.checkSuccessfulApiCall(response); + } + + @When("Admin makes asset externalization request for type {string} by Loan ID with unique ownerExternalId, force generated transferExternalId and without change test owner with following data:") + public void createAssetExternalizationRequestByLoanIdUserGeneratedExtIdForceTransferIdNoTestOwner(String type, DataTable table) + throws IOException { + // if user created transferExternalId previously, it will use that, otherwise create a new one + String transferExternalId = Utils.randomNameGenerator("TestTransferExtId_", 3); + testContext().set(TestContextKey.ASSET_EXTERNALIZATION_TRANSFER_EXTERNAL_ID_USER_GENERATED + "_" + type, transferExternalId); + + createAssetExternalizationRequestByLoanId(table, transferExternalId, false); + } + +} diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/BusinessDateStepDef.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/BusinessDateStepDef.java new file mode 100644 index 00000000000..0bc536b6df5 --- /dev/null +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/BusinessDateStepDef.java @@ -0,0 +1,64 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.test.stepdef.common; + +import static org.assertj.core.api.Assertions.assertThat; + +import io.cucumber.java.en.Then; +import io.cucumber.java.en.When; +import java.io.IOException; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import org.apache.fineract.client.models.BusinessDateResponse; +import org.apache.fineract.client.services.BusinessDateManagementApi; +import org.apache.fineract.test.helper.BusinessDateHelper; +import org.apache.fineract.test.helper.ErrorHelper; +import org.apache.fineract.test.stepdef.AbstractStepDef; +import org.springframework.beans.factory.annotation.Autowired; +import retrofit2.Response; + +public class BusinessDateStepDef extends AbstractStepDef { + + @Autowired + private BusinessDateHelper businessDateHelper; + + @Autowired + private BusinessDateManagementApi businessDateManagementApi; + + @When("Admin sets the business date to {string}") + public void setBusinessDate(String businessDate) throws IOException { + businessDateHelper.setBusinessDate(businessDate); + } + + @When("Admin sets the business date to the actual date") + public void setBusinessDateToday() throws IOException { + businessDateHelper.setBusinessDateToday(); + } + + @Then("Admin checks that the business date is correctly set to {string}") + public void checkBusinessDate(String businessDate) throws IOException { + Response businessDateResponse = businessDateManagementApi.getBusinessDate(BusinessDateHelper.BUSINESS_DATE) + .execute(); + ErrorHelper.checkSuccessfulApiCall(businessDateResponse); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("d MMMM yyyy"); + LocalDate localDate = LocalDate.parse(businessDate, formatter); + + assertThat(businessDateResponse.body().getDate()).isEqualTo(localDate); + } +} diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/BusinessStepStepDef.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/BusinessStepStepDef.java new file mode 100644 index 00000000000..9d92fa26504 --- /dev/null +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/BusinessStepStepDef.java @@ -0,0 +1,152 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.test.stepdef.common; + +import io.cucumber.java.en.Given; +import io.cucumber.java.en.Then; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.apache.fineract.client.models.BusinessStep; +import org.apache.fineract.client.models.UpdateBusinessStepConfigRequest; +import org.apache.fineract.client.services.BusinessStepConfigurationApi; +import org.apache.fineract.test.helper.ErrorHelper; +import org.apache.fineract.test.stepdef.AbstractStepDef; +import org.springframework.beans.factory.annotation.Autowired; +import retrofit2.Response; + +public class BusinessStepStepDef extends AbstractStepDef { + + private static final String WORKFLOW_NAME_LOAN_CLOSE_OF_BUSINESS = "LOAN_CLOSE_OF_BUSINESS"; + private static final String BUSINESS_STEP_NAME_APPLY_CHARGE_TO_OVERDUE_LOANS = "APPLY_CHARGE_TO_OVERDUE_LOANS"; + private static final String BUSINESS_STEP_NAME_LOAN_DELINQUENCY_CLASSIFICATION = "LOAN_DELINQUENCY_CLASSIFICATION"; + private static final String BUSINESS_STEP_NAME_CHECK_LOAN_REPAYMENT_DUE = "CHECK_LOAN_REPAYMENT_DUE"; + private static final String BUSINESS_STEP_NAME_CHECK_LOAN_REPAYMENT_OVERDUE = "CHECK_LOAN_REPAYMENT_OVERDUE"; + private static final String BUSINESS_STEP_NAME_UPDATE_LOAN_ARREARS_AGING = "UPDATE_LOAN_ARREARS_AGING"; + private static final String BUSINESS_STEP_NAME_ADD_PERIODIC_ACCRUAL_ENTRIES = "ADD_PERIODIC_ACCRUAL_ENTRIES"; + private static final String BUSINESS_STEP_NAME_EXTERNAL_ASSET_OWNER_TRANSFER = "EXTERNAL_ASSET_OWNER_TRANSFER"; + private static final String BUSINESS_STEP_NAME_CHECK_DUE_INSTALLMENTS = "CHECK_DUE_INSTALLMENTS"; + + @Autowired + private BusinessStepConfigurationApi businessStepConfigurationApi; + + @Given("Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow") + public void putExternalAssetOwnerTransferJobInCOB() throws IOException { + BusinessStep applyChargeToOverdueLoans = new BusinessStep().stepName(BUSINESS_STEP_NAME_APPLY_CHARGE_TO_OVERDUE_LOANS).order(1L); + BusinessStep loanDelinquencyClassification = new BusinessStep().stepName(BUSINESS_STEP_NAME_LOAN_DELINQUENCY_CLASSIFICATION) + .order(2L); + BusinessStep checkLoanRepaymentDue = new BusinessStep().stepName(BUSINESS_STEP_NAME_CHECK_LOAN_REPAYMENT_DUE).order(3L); + BusinessStep checkLoanRepaymentOverdue = new BusinessStep().stepName(BUSINESS_STEP_NAME_CHECK_LOAN_REPAYMENT_OVERDUE).order(4L); + BusinessStep updateLoanArrearsAging = new BusinessStep().stepName(BUSINESS_STEP_NAME_UPDATE_LOAN_ARREARS_AGING).order(5L); + BusinessStep addPeriodicAccrualEntries = new BusinessStep().stepName(BUSINESS_STEP_NAME_ADD_PERIODIC_ACCRUAL_ENTRIES).order(6L); + BusinessStep externalAssetOwnerTransfer = new BusinessStep().stepName(BUSINESS_STEP_NAME_EXTERNAL_ASSET_OWNER_TRANSFER).order(7L); + + List businessSteps = new ArrayList<>(); + businessSteps.add(applyChargeToOverdueLoans); + businessSteps.add(loanDelinquencyClassification); + businessSteps.add(checkLoanRepaymentDue); + businessSteps.add(checkLoanRepaymentOverdue); + businessSteps.add(updateLoanArrearsAging); + businessSteps.add(addPeriodicAccrualEntries); + businessSteps.add(externalAssetOwnerTransfer); + + UpdateBusinessStepConfigRequest request = new UpdateBusinessStepConfigRequest().businessSteps(businessSteps); + + Response response = businessStepConfigurationApi.updateJobBusinessStepConfig(WORKFLOW_NAME_LOAN_CLOSE_OF_BUSINESS, request) + .execute(); + ErrorHelper.checkSuccessfulApiCall(response); + } + + @Then("Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow") + public void removeExternalAssetOwnerTransferJobInCOB() throws IOException { + BusinessStep applyChargeToOverdueLoans = new BusinessStep().stepName(BUSINESS_STEP_NAME_APPLY_CHARGE_TO_OVERDUE_LOANS).order(1L); + BusinessStep loanDelinquencyClassification = new BusinessStep().stepName(BUSINESS_STEP_NAME_LOAN_DELINQUENCY_CLASSIFICATION) + .order(2L); + BusinessStep checkLoanRepaymentDue = new BusinessStep().stepName(BUSINESS_STEP_NAME_CHECK_LOAN_REPAYMENT_DUE).order(3L); + BusinessStep checkLoanRepaymentOverdue = new BusinessStep().stepName(BUSINESS_STEP_NAME_CHECK_LOAN_REPAYMENT_OVERDUE).order(4L); + BusinessStep updateLoanArrearsAging = new BusinessStep().stepName(BUSINESS_STEP_NAME_UPDATE_LOAN_ARREARS_AGING).order(5L); + BusinessStep addPeriodicAccrualEntries = new BusinessStep().stepName(BUSINESS_STEP_NAME_ADD_PERIODIC_ACCRUAL_ENTRIES).order(6L); + + List businessSteps = new ArrayList<>(); + businessSteps.add(applyChargeToOverdueLoans); + businessSteps.add(loanDelinquencyClassification); + businessSteps.add(checkLoanRepaymentDue); + businessSteps.add(checkLoanRepaymentOverdue); + businessSteps.add(updateLoanArrearsAging); + businessSteps.add(addPeriodicAccrualEntries); + + UpdateBusinessStepConfigRequest request = new UpdateBusinessStepConfigRequest().businessSteps(businessSteps); + + Response response = businessStepConfigurationApi.updateJobBusinessStepConfig(WORKFLOW_NAME_LOAN_CLOSE_OF_BUSINESS, request) + .execute(); + ErrorHelper.checkSuccessfulApiCall(response); + } + + @Given("Admin puts CHECK_DUE_INSTALLMENTS job into LOAN_CLOSE_OF_BUSINESS workflow") + public void putCheckDueInstallmentsJobInCOB() throws IOException { + BusinessStep applyChargeToOverdueLoans = new BusinessStep().stepName(BUSINESS_STEP_NAME_APPLY_CHARGE_TO_OVERDUE_LOANS).order(1L); + BusinessStep loanDelinquencyClassification = new BusinessStep().stepName(BUSINESS_STEP_NAME_LOAN_DELINQUENCY_CLASSIFICATION) + .order(2L); + BusinessStep checkLoanRepaymentDue = new BusinessStep().stepName(BUSINESS_STEP_NAME_CHECK_LOAN_REPAYMENT_DUE).order(3L); + BusinessStep checkLoanRepaymentOverdue = new BusinessStep().stepName(BUSINESS_STEP_NAME_CHECK_LOAN_REPAYMENT_OVERDUE).order(4L); + BusinessStep updateLoanArrearsAging = new BusinessStep().stepName(BUSINESS_STEP_NAME_UPDATE_LOAN_ARREARS_AGING).order(5L); + BusinessStep addPeriodicAccrualEntries = new BusinessStep().stepName(BUSINESS_STEP_NAME_ADD_PERIODIC_ACCRUAL_ENTRIES).order(6L); + BusinessStep checkDueInstallments = new BusinessStep().stepName(BUSINESS_STEP_NAME_CHECK_DUE_INSTALLMENTS).order(7L); + + List businessSteps = new ArrayList<>(); + businessSteps.add(applyChargeToOverdueLoans); + businessSteps.add(loanDelinquencyClassification); + businessSteps.add(checkLoanRepaymentDue); + businessSteps.add(checkLoanRepaymentOverdue); + businessSteps.add(updateLoanArrearsAging); + businessSteps.add(addPeriodicAccrualEntries); + businessSteps.add(checkDueInstallments); + + UpdateBusinessStepConfigRequest request = new UpdateBusinessStepConfigRequest().businessSteps(businessSteps); + + Response response = businessStepConfigurationApi.updateJobBusinessStepConfig(WORKFLOW_NAME_LOAN_CLOSE_OF_BUSINESS, request) + .execute(); + ErrorHelper.checkSuccessfulApiCall(response); + } + + @Then("Admin removes CHECK_DUE_INSTALLMENTS job from LOAN_CLOSE_OF_BUSINESS workflow") + public void removeCheckDueInstallmentsJobInCOB() throws IOException { + BusinessStep applyChargeToOverdueLoans = new BusinessStep().stepName(BUSINESS_STEP_NAME_APPLY_CHARGE_TO_OVERDUE_LOANS).order(1L); + BusinessStep loanDelinquencyClassification = new BusinessStep().stepName(BUSINESS_STEP_NAME_LOAN_DELINQUENCY_CLASSIFICATION) + .order(2L); + BusinessStep checkLoanRepaymentDue = new BusinessStep().stepName(BUSINESS_STEP_NAME_CHECK_LOAN_REPAYMENT_DUE).order(3L); + BusinessStep checkLoanRepaymentOverdue = new BusinessStep().stepName(BUSINESS_STEP_NAME_CHECK_LOAN_REPAYMENT_OVERDUE).order(4L); + BusinessStep updateLoanArrearsAging = new BusinessStep().stepName(BUSINESS_STEP_NAME_UPDATE_LOAN_ARREARS_AGING).order(5L); + BusinessStep addPeriodicAccrualEntries = new BusinessStep().stepName(BUSINESS_STEP_NAME_ADD_PERIODIC_ACCRUAL_ENTRIES).order(6L); + + List businessSteps = new ArrayList<>(); + businessSteps.add(applyChargeToOverdueLoans); + businessSteps.add(loanDelinquencyClassification); + businessSteps.add(checkLoanRepaymentDue); + businessSteps.add(checkLoanRepaymentOverdue); + businessSteps.add(updateLoanArrearsAging); + businessSteps.add(addPeriodicAccrualEntries); + + UpdateBusinessStepConfigRequest request = new UpdateBusinessStepConfigRequest().businessSteps(businessSteps); + + Response response = businessStepConfigurationApi.updateJobBusinessStepConfig(WORKFLOW_NAME_LOAN_CLOSE_OF_BUSINESS, request) + .execute(); + ErrorHelper.checkSuccessfulApiCall(response); + } +} diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/ClientStepDef.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/ClientStepDef.java index 7f0ae6e911a..7777afb81d3 100644 --- a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/ClientStepDef.java +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/ClientStepDef.java @@ -33,6 +33,7 @@ import org.apache.fineract.test.helper.ErrorHelper; import org.apache.fineract.test.helper.ErrorMessageHelper; import org.apache.fineract.test.helper.Utils; +import org.apache.fineract.test.messaging.event.EventCheckHelper; import org.apache.fineract.test.stepdef.AbstractStepDef; import org.apache.fineract.test.support.TestContextKey; import org.springframework.beans.factory.annotation.Autowired; @@ -49,6 +50,9 @@ public class ClientStepDef extends AbstractStepDef { @Autowired private ClientRequestFactory clientRequestFactory; + @Autowired + private EventCheckHelper eventCheckHelper; + @When("Admin creates a client with random data") public void createClientRandomFirstNameLastName() throws IOException { PostClientsRequest clientsRequest = clientRequestFactory.defaultClientCreationRequest(); @@ -56,6 +60,8 @@ public void createClientRandomFirstNameLastName() throws IOException { Response response = clientApi.create6(clientsRequest).execute(); ErrorHelper.checkSuccessfulApiCall(response); testContext().set(TestContextKey.CLIENT_CREATE_RESPONSE, response); + + eventCheckHelper.clientEventCheck(response); } @When("Admin creates a second client with random data") @@ -65,6 +71,8 @@ public void createSecondClientRandomFirstNameLastName() throws IOException { Response response = clientApi.create6(clientsRequest).execute(); ErrorHelper.checkSuccessfulApiCall(response); testContext().set(TestContextKey.CLIENT_CREATE_SECOND_CLIENT_RESPONSE, response); + + eventCheckHelper.clientEventCheck(response); } @When("Admin creates a client with Firstname {string} and Lastname {string}") @@ -114,5 +122,7 @@ public void checkClientCreatedSuccessfully() throws IOException { Response response = testContext().get(TestContextKey.CLIENT_CREATE_RESPONSE); assertThat(response.isSuccessful()).as(ErrorMessageHelper.requestFailed(response)).isTrue(); + + eventCheckHelper.clientEventCheck(response); } } diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/EventStepDef.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/EventStepDef.java new file mode 100644 index 00000000000..7fdd597426a --- /dev/null +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/EventStepDef.java @@ -0,0 +1,73 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.test.stepdef.common; + +import io.cucumber.java.en.Then; +import io.github.classgraph.ClassGraph; +import io.github.classgraph.ClassInfoList; +import io.github.classgraph.ScanResult; +import org.apache.fineract.client.models.PostLoansResponse; +import org.apache.fineract.test.messaging.EventAssertion; +import org.apache.fineract.test.messaging.event.Event; +import org.apache.fineract.test.stepdef.AbstractStepDef; +import org.apache.fineract.test.support.TestContextKey; +import org.springframework.beans.factory.annotation.Autowired; +import retrofit2.Response; + +@SuppressWarnings({ "unchecked", "rawtypes" }) +public class EventStepDef extends AbstractStepDef { + + @Autowired + private EventAssertion eventAssertion; + + @Then("{string} event has been raised for the loan") + public void assertEventRaisedForLoan(String eventType) { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + Class eventTypeClazz = resolveEventType(eventType); + eventAssertion.assertEventRaised(eventTypeClazz, loanId); + } + + @Then("No new event with type {string} has been raised for the loan") + public void assertEventNotRaisedForLoan(String eventType) { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + Class eventTypeClazz = resolveEventType(eventType); + eventAssertion.assertEventNotRaised(eventTypeClazz, loanId); + } + + private Class resolveEventType(String eventType) { + String fullyQualifiedEventClassName = null; + try (ScanResult scanResult = new ClassGraph().enableAllInfo().acceptPackages("org.apache.fineract.test").scan()) { + ClassInfoList matchingClasses = scanResult.getAllClasses().filter(i -> i.getSimpleName().equalsIgnoreCase(eventType)); + if (matchingClasses.isEmpty()) { + throw new IllegalArgumentException("Cannot find event with type name: " + eventType); + } + fullyQualifiedEventClassName = matchingClasses.get(0).getName(); + } + + Class eventTypeClazz = null; + try { + eventTypeClazz = (Class) Class.forName(fullyQualifiedEventClassName); + } catch (Exception e) { + throw new RuntimeException("Cannot find event with type name: " + eventType, e); + } + return eventTypeClazz; + } +} diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/JournalEntriesStepDef.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/JournalEntriesStepDef.java new file mode 100644 index 00000000000..0e81930db00 --- /dev/null +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/JournalEntriesStepDef.java @@ -0,0 +1,225 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.test.stepdef.common; + +import static org.assertj.core.api.Assertions.assertThat; + +import io.cucumber.datatable.DataTable; +import io.cucumber.java.en.Then; +import java.io.IOException; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; +import lombok.extern.slf4j.Slf4j; +import org.apache.fineract.client.models.GetJournalEntriesTransactionIdResponse; +import org.apache.fineract.client.models.GetLoansLoanIdResponse; +import org.apache.fineract.client.models.GetLoansLoanIdTransactions; +import org.apache.fineract.client.models.JournalEntryTransactionItem; +import org.apache.fineract.client.models.PostLoansResponse; +import org.apache.fineract.client.services.JournalEntriesApi; +import org.apache.fineract.client.services.LoansApi; +import org.apache.fineract.test.data.TransactionType; +import org.apache.fineract.test.helper.ErrorHelper; +import org.apache.fineract.test.helper.ErrorMessageHelper; +import org.apache.fineract.test.stepdef.AbstractStepDef; +import org.apache.fineract.test.support.TestContextKey; +import org.springframework.beans.factory.annotation.Autowired; +import retrofit2.Response; + +@Slf4j +public class JournalEntriesStepDef extends AbstractStepDef { + + public static final String DATE_FORMAT = "dd MMMM yyyy"; + + @Autowired + private LoansApi loansApi; + + @Autowired + private JournalEntriesApi journalEntriesApi; + + @Then("Loan Transactions tab has a {string} transaction with date {string} which has the following Journal entries:") + public void journalEntryDataCheck(String transactionType, String transactionDate, DataTable table) throws IOException { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DATE_FORMAT); + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Response loanDetailsResponse = loansApi.retrieveLoan(loanId, false, "transactions", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); + + TransactionType transactionType1 = TransactionType.valueOf(transactionType); + String transactionTypeExpected = transactionType1.getValue(); + + List transactions = loanDetailsResponse.body().getTransactions(); + + List transactionsMatch = transactions.stream() + .filter(t -> transactionDate.equals(formatter.format(t.getDate())) + && transactionTypeExpected.equals(t.getType().getCode().substring(20))) + .collect(Collectors.toList()); + + List> journalLinesActualList = transactionsMatch.stream().map(t -> { + String transactionId = "L" + t.getId(); + Response journalEntryDataResponse = null; + try { + journalEntryDataResponse = journalEntriesApi.retrieveAll1(// + null, // + null, // + null, // + null, // + null, // + null, // + null, // + transactionId, // + null, // + null, // + null, // + null, // + null, // + null, // + null, // + null, // + null, // + null, // + true// + ).execute(); + ErrorHelper.checkSuccessfulApiCall(journalEntryDataResponse); + } catch (IOException e) { + log.error("Exception", e); + } + + return journalEntryDataResponse.body().getPageItems(); + }).collect(Collectors.toList()); + + List> data = table.asLists(); + for (int i = 1; i < data.size(); i++) { + List>> possibleActualValuesList = new ArrayList<>(); + List expectedValues = data.get(i); + boolean containsAnyExpected = false; + + for (int j = 0; j < journalLinesActualList.size(); j++) { + List journalLinesActual = journalLinesActualList.get(j); + + List> actualValuesList = journalLinesActual.stream().map(t -> { + List actualValues = new ArrayList<>(); + actualValues.add(t.getGlAccountType().getValue() == null ? null : t.getGlAccountType().getValue()); + actualValues.add(t.getGlAccountCode() == null ? null : t.getGlAccountCode()); + actualValues.add(t.getGlAccountName() == null ? null : t.getGlAccountName()); + actualValues.add("DEBIT".equals(t.getEntryType().getValue()) ? String.valueOf(t.getAmount()) : null); + actualValues.add("CREDIT".equals(t.getEntryType().getValue()) ? String.valueOf(t.getAmount()) : null); + + return actualValues; + }).collect(Collectors.toList()); + possibleActualValuesList.add(actualValuesList); + + boolean containsExpectedValues = actualValuesList.stream().anyMatch(actualValues -> actualValues.equals(expectedValues)); + if (containsExpectedValues) { + containsAnyExpected = true; + } + } + assertThat(containsAnyExpected) + .as(ErrorMessageHelper.wrongValueInLineInJournalEntries(i, possibleActualValuesList, expectedValues)).isTrue(); + } + } + + @Then("In Loan transactions the replayed {string} transaction with date {string} has a reverted transaction pair with the following Journal entries:") + public void revertedJournalEntryDataCheck(String transactionType, String transactionDate, DataTable table) throws IOException { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DATE_FORMAT); + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Response loanDetailsResponse = loansApi.retrieveLoan(loanId, false, "transactions", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); + + TransactionType transactionType1 = TransactionType.valueOf(transactionType); + String transactionTypeExpected = transactionType1.getValue(); + + List transactions = loanDetailsResponse.body().getTransactions(); + + List transactionsMatch = transactions.stream() + .filter(t -> transactionDate.equals(formatter.format(t.getDate())) + && transactionTypeExpected.equals(t.getType().getCode().substring(20))) + .collect(Collectors.toList()); + + List transactionIdList = transactionsMatch.stream().flatMap(t -> t.getTransactionRelations().stream() + .filter(e -> "REPLAYED".equals(e.getRelationType())).map(c -> "L" + c.getToLoanTransaction().toString())) + .collect(Collectors.toList()); + + List> journalLinesActualList = transactionIdList.stream().map(t -> { + Response journalEntryDataResponse = null; + try { + journalEntryDataResponse = journalEntriesApi.retrieveAll1(// + null, // + null, // + null, // + null, // + null, // + null, // + null, // + t, // + null, // + null, // + null, // + null, // + null, // + null, // + null, // + null, // + null, // + null, // + true// + ).execute(); + ErrorHelper.checkSuccessfulApiCall(journalEntryDataResponse); + } catch (IOException e) { + log.error("Exception", e); + } + + return journalEntryDataResponse.body().getPageItems(); + }).collect(Collectors.toList()); + + List> data = table.asLists(); + for (int i = 1; i < data.size(); i++) { + List>> possibleActualValuesList = new ArrayList<>(); + List expectedValues = data.get(i); + boolean containsAnyExpected = false; + + for (int j = 0; j < journalLinesActualList.size(); j++) { + List journalLinesActual = journalLinesActualList.get(j); + + List> actualValuesList = journalLinesActual.stream().map(t -> { + List actualValues = new ArrayList<>(); + actualValues.add(t.getGlAccountType().getValue() == null ? null : t.getGlAccountType().getValue()); + actualValues.add(t.getGlAccountCode() == null ? null : t.getGlAccountCode()); + actualValues.add(t.getGlAccountName() == null ? null : t.getGlAccountName()); + actualValues.add("DEBIT".equals(t.getEntryType().getValue()) ? String.valueOf(t.getAmount()) : null); + actualValues.add("CREDIT".equals(t.getEntryType().getValue()) ? String.valueOf(t.getAmount()) : null); + + return actualValues; + }).collect(Collectors.toList()); + possibleActualValuesList.add(actualValuesList); + + boolean containsExpectedValues = actualValuesList.stream().anyMatch(actualValues -> actualValues.equals(expectedValues)); + if (containsExpectedValues) { + containsAnyExpected = true; + } + } + assertThat(containsAnyExpected) + .as(ErrorMessageHelper.wrongValueInLineInJournalEntries(i, possibleActualValuesList, expectedValues)).isTrue(); + } + } +} diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/SchedulerStepDef.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/SchedulerStepDef.java new file mode 100644 index 00000000000..ac562f9e2c6 --- /dev/null +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/SchedulerStepDef.java @@ -0,0 +1,59 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.test.stepdef.common; + +import io.cucumber.java.en.And; +import io.cucumber.java.en.When; +import lombok.extern.slf4j.Slf4j; +import org.apache.fineract.test.data.job.DefaultJob; +import org.apache.fineract.test.service.JobService; +import org.apache.fineract.test.stepdef.AbstractStepDef; +import org.springframework.beans.factory.annotation.Autowired; + +@Slf4j +public class SchedulerStepDef extends AbstractStepDef { + + @Autowired + private JobService jobService; + + @And("Admin runs the Add Accrual Transactions job") + public void runAccrualTransaction() { + jobService.executeAndWait(DefaultJob.ADD_ACCRUAL_TRANSACTIONS); + } + + @And("Admin runs the Add Periodic Accrual Transactions job") + public void runPeriodicAccrualTransaction() { + jobService.executeAndWait(DefaultJob.ADD_PERIODIC_ACCRUAL_TRANSACTIONS); + } + + @And("Admin runs the Increase Business Date by 1 day job") + public void runIncreaseBusinessDate() { + jobService.executeAndWait(DefaultJob.INCREASE_BUSINESS_DAY); + } + + @And("Admin runs the Loan Delinquency Classification job") + public void runLoanDelinquencyClassification() { + jobService.executeAndWait(DefaultJob.LOAN_DELINQUENCY_CLASSIFICATION); + } + + @When("Admin runs COB job") + public void runCOB() { + jobService.executeAndWait(DefaultJob.LOAN_COB); + } +} diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/UserStepDef.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/UserStepDef.java new file mode 100644 index 00000000000..ab39b306219 --- /dev/null +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/UserStepDef.java @@ -0,0 +1,87 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.test.stepdef.common; + +import io.cucumber.java.en.When; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.apache.fineract.client.models.GetRolesResponse; +import org.apache.fineract.client.models.PostRolesRequest; +import org.apache.fineract.client.models.PostRolesResponse; +import org.apache.fineract.client.models.PostUsersRequest; +import org.apache.fineract.client.models.PostUsersResponse; +import org.apache.fineract.client.models.PutRolesRoleIdPermissionsRequest; +import org.apache.fineract.client.models.PutRolesRoleIdPermissionsResponse; +import org.apache.fineract.client.services.RolesApi; +import org.apache.fineract.client.services.UsersApi; +import org.apache.fineract.test.api.ApiProperties; +import org.apache.fineract.test.helper.ErrorHelper; +import org.apache.fineract.test.helper.Utils; +import org.apache.fineract.test.stepdef.AbstractStepDef; +import org.apache.fineract.test.support.TestContextKey; +import org.springframework.beans.factory.annotation.Autowired; +import retrofit2.Response; + +public class UserStepDef extends AbstractStepDef { + + private static final String EMAIL = "test@test.com"; + + @Autowired + private RolesApi rolesApi; + + @Autowired + private UsersApi usersApi; + + @Autowired + private ApiProperties apiProperties; + + @When("Admin creates new user with {string} username, {string} role name and given permissions:") + public void createUserWithUsernameAndRoles(String username, String roleName, List permissions) throws IOException { + Response> retrieveAllRolesResponse = rolesApi.retrieveAllRoles().execute(); + ErrorHelper.checkSuccessfulApiCall(retrieveAllRolesResponse); + PostRolesRequest newRoleRequest = new PostRolesRequest().name(Utils.randomNameGenerator(roleName, 8)).description(roleName); + Response createNewRole = rolesApi.createRole(newRoleRequest).execute(); + ErrorHelper.checkSuccessfulApiCall(createNewRole); + Long roleId = createNewRole.body().getResourceId(); + Map permissionMap = new HashMap<>(); + permissions.forEach(role -> permissionMap.put(role, true)); + PutRolesRoleIdPermissionsRequest putRolesRoleIdPermissionsRequest = new PutRolesRoleIdPermissionsRequest() + .permissions(permissionMap); + Response updateRolePermissionResponse = rolesApi + .updateRolePermissions(roleId, putRolesRoleIdPermissionsRequest).execute(); + ErrorHelper.checkSuccessfulApiCall(updateRolePermissionResponse); + + PostUsersRequest postUsersRequest = new PostUsersRequest() // + .username(Utils.randomNameGenerator(username, 8)) // + .email(EMAIL) // + .firstname(username) // + .lastname(username) // + .sendPasswordToEmail(Boolean.FALSE) // + .officeId(1L) // + .password(apiProperties.getPassword()) // + .repeatPassword(apiProperties.getPassword()) // + .roles(List.of(roleId)); + + Response createUserResponse = usersApi.create15(postUsersRequest).execute(); + ErrorHelper.checkSuccessfulApiCall(createUserResponse); + testContext().set(TestContextKey.CREATED_SIMPLE_USER_RESPONSE, createUserResponse); + } +} diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/InlineCOBStepDef.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/InlineCOBStepDef.java new file mode 100644 index 00000000000..31dd25a0ef5 --- /dev/null +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/InlineCOBStepDef.java @@ -0,0 +1,89 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.test.stepdef.loan; + +import io.cucumber.java.en.Then; +import io.cucumber.java.en.When; +import java.io.IOException; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import org.apache.fineract.client.models.InlineJobRequest; +import org.apache.fineract.client.models.InlineJobResponse; +import org.apache.fineract.client.models.PostLoansResponse; +import org.apache.fineract.client.services.ExternalEventConfigurationApi; +import org.apache.fineract.client.services.InlineJobApi; +import org.apache.fineract.test.helper.ErrorHelper; +import org.apache.fineract.test.messaging.EventAssertion; +import org.apache.fineract.test.messaging.event.assetexternalization.LoanAccountCustomSnapshotEvent; +import org.apache.fineract.test.messaging.event.loan.repayment.LoanRepaymentDueEvent; +import org.apache.fineract.test.messaging.event.loan.repayment.LoanRepaymentOverdueEvent; +import org.apache.fineract.test.stepdef.AbstractStepDef; +import org.apache.fineract.test.support.TestContextKey; +import org.springframework.beans.factory.annotation.Autowired; +import retrofit2.Response; + +public class InlineCOBStepDef extends AbstractStepDef { + + private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("dd MMMM yyyy"); + + @Autowired + private InlineJobApi inlineJobApi; + + @Autowired + private EventAssertion eventAssertion; + + @Autowired + ExternalEventConfigurationApi eventConfigurationApi; + + @When("Admin runs inline COB job for Loan") + public void runInlineCOB() throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + InlineJobRequest inlineJobRequest = new InlineJobRequest().addLoanIdsItem(loanId); + + Response inlineJobResponse = inlineJobApi.executeInlineJob("LOAN_COB", inlineJobRequest).execute(); + ErrorHelper.checkSuccessfulApiCall(inlineJobResponse); + } + + @Then("Loan Repayment Due Business Event is created") + public void checkLoanRepaymentDueBusinessEventCreated() { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + eventAssertion.assertEventRaised(LoanRepaymentDueEvent.class, loanId); + } + + @Then("Loan Repayment Overdue Business Event is created") + public void checkLoanRepaymentOverdueBusinessEventCreated() { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + eventAssertion.assertEventRaised(LoanRepaymentOverdueEvent.class, loanId); + } + + @Then("LoanAccountCustomSnapshotBusinessEvent is created with business date {string}") + public void checkLoanRepaymentDueBusinessEventCreatedWithBusinessDate(String expectedBusinessDate) { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + LocalDate expectedBusinessDateParsed = LocalDate.parse(expectedBusinessDate, FORMATTER); + eventAssertion.assertEvent(LoanAccountCustomSnapshotEvent.class, loanId).isRaisedOnBusinessDate(expectedBusinessDateParsed); + } +} diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanCOBStepDef.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanCOBStepDef.java new file mode 100644 index 00000000000..9c04e3f373f --- /dev/null +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanCOBStepDef.java @@ -0,0 +1,113 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.test.stepdef.loan; + +import static org.assertj.core.api.Assertions.assertThat; + +import io.cucumber.java.en.Then; +import io.cucumber.java.en.When; +import java.io.IOException; +import java.time.LocalDate; +import java.util.List; +import lombok.extern.slf4j.Slf4j; +import org.apache.fineract.client.models.GetLoanAccountLockResponse; +import org.apache.fineract.client.models.GetOldestCOBProcessedLoanResponse; +import org.apache.fineract.client.models.LoanAccountLock; +import org.apache.fineract.client.models.PostLoansResponse; +import org.apache.fineract.client.services.DefaultApi; +import org.apache.fineract.client.services.LoanAccountLockApi; +import org.apache.fineract.client.services.LoanCobCatchUpApi; +import org.apache.fineract.test.helper.ErrorHelper; +import org.apache.fineract.test.helper.ErrorMessageHelper; +import org.apache.fineract.test.stepdef.AbstractStepDef; +import org.apache.fineract.test.support.TestContextKey; +import org.springframework.beans.factory.annotation.Autowired; +import retrofit2.Response; + +@Slf4j +public class LoanCOBStepDef extends AbstractStepDef { + + @Autowired + private LoanCobCatchUpApi loanCobCatchUpApi; + + @Autowired + private LoanAccountLockApi loanAccountLockApi; + + @Autowired + private DefaultApi defaultApi; + + @Then("The cobProcessedDate of the oldest loan processed by COB is more than 1 day earlier than cobBusinessDate") + public void checkOldestCOBProcessed() throws IOException { + Response response = loanCobCatchUpApi.getOldestCOBProcessedLoan().execute(); + ErrorHelper.checkSuccessfulApiCall(response); + + LocalDate cobDate = response.body().getCobBusinessDate(); + LocalDate cobDateMinusOne = cobDate.minusDays(1); + LocalDate cobProcessedDate = response.body().getCobProcessedDate(); + log.info("cobDateMinusOne: {}", cobDateMinusOne); + log.info("cobProcessedDate: {}", cobProcessedDate); + + boolean result = cobDateMinusOne.isAfter(cobProcessedDate); + assertThat(result).as(ErrorMessageHelper.wrongLastCOBProcessedLoanDate(cobProcessedDate, cobDateMinusOne)).isTrue(); + } + + @Then("There are no locked loan accounts") + public void listOfLockedLoansEmpty() throws IOException { + Response response = loanAccountLockApi.retrieveLockedAccounts(0, 1000).execute(); + ErrorHelper.checkSuccessfulApiCall(response); + + int size = response.body().getContent().size(); + assertThat(size).as(ErrorMessageHelper.listOfLockedLoansNotEmpty(response)).isEqualTo(0); + log.info("Size of List of the locked loans: {}", size); + } + + @Then("The loan account is not locked") + public void loanIsNotInListOfLockedLoans() throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + Long targetLoanId = loanResponse.body().getLoanId(); + + Response response = loanAccountLockApi.retrieveLockedAccounts(0, 1000).execute(); + ErrorHelper.checkSuccessfulApiCall(response); + + List content = response.body().getContent(); + boolean contains = content.stream()// + .map(LoanAccountLock::getLoanId)// + .anyMatch(targetLoanId::equals);// + + assertThat(contains).as(ErrorMessageHelper.listOfLockedLoansContainsLoan(targetLoanId, response)).isFalse(); + } + + @When("Admin places a lock on loan account with an error message") + public void placeLockOnLoanAccountWithErrorMessage() throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Response response = defaultApi.placeLockOnLoanAccount(loanId, "LOAN_COB_CHUNK_PROCESSING", "TestError").execute(); + ErrorHelper.checkSuccessfulApiCall(response); + } + + @When("Admin places a lock on loan account WITHOUT an error message") + public void placeLockOnLoanAccountNoErrorMessage() throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Response response = defaultApi.placeLockOnLoanAccount(loanId, "LOAN_COB_CHUNK_PROCESSING").execute(); + ErrorHelper.checkSuccessfulApiCall(response); + } +} diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanChargeAdjustmentStepDef.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanChargeAdjustmentStepDef.java new file mode 100644 index 00000000000..9e3aeaa1427 --- /dev/null +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanChargeAdjustmentStepDef.java @@ -0,0 +1,188 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.test.stepdef.loan; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.google.gson.Gson; +import io.cucumber.java.en.When; +import java.io.IOException; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.List; +import org.apache.fineract.client.models.BusinessDateResponse; +import org.apache.fineract.client.models.GetLoansLoanIdLoanChargeData; +import org.apache.fineract.client.models.GetLoansLoanIdResponse; +import org.apache.fineract.client.models.GetLoansLoanIdTransactions; +import org.apache.fineract.client.models.PostLoansLoanIdChargesChargeIdRequest; +import org.apache.fineract.client.models.PostLoansLoanIdChargesChargeIdResponse; +import org.apache.fineract.client.models.PostLoansLoanIdTransactionsResponse; +import org.apache.fineract.client.models.PostLoansLoanIdTransactionsTransactionIdRequest; +import org.apache.fineract.client.models.PostLoansResponse; +import org.apache.fineract.client.services.BusinessDateManagementApi; +import org.apache.fineract.client.services.LoanChargesApi; +import org.apache.fineract.client.services.LoanTransactionsApi; +import org.apache.fineract.client.services.LoansApi; +import org.apache.fineract.client.util.JSON; +import org.apache.fineract.test.data.ChargeProductType; +import org.apache.fineract.test.factory.LoanRequestFactory; +import org.apache.fineract.test.helper.ErrorHelper; +import org.apache.fineract.test.helper.ErrorMessageHelper; +import org.apache.fineract.test.helper.ErrorResponse; +import org.apache.fineract.test.stepdef.AbstractStepDef; +import org.apache.fineract.test.support.TestContextKey; +import org.springframework.beans.factory.annotation.Autowired; +import retrofit2.Response; + +public class LoanChargeAdjustmentStepDef extends AbstractStepDef { + + public static final String DATE_FORMAT = "dd MMMM yyyy"; + + private static final Gson GSON = new JSON().getGson(); + + @Autowired + private LoanChargesApi loanChargesApi; + @Autowired + private LoansApi loansApi; + @Autowired + private LoanTransactionsApi loanTransactionsApi; + @Autowired + private BusinessDateManagementApi businessDateManagementApi; + + @When("Admin makes a charge adjustment for the last {string} type charge which is due on {string} with {double} EUR transaction amount and externalId {string}") + public void makeLoanChargeAdjustment(String chargeTypeEnum, String date, Double transactionAmount, String externalId) + throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Response loanDetailsResponse = loansApi.retrieveLoan(loanId, false, "charges", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); + + Long transactionId = getTransactionIdForLastChargeMetConditions(chargeTypeEnum, date, loanDetailsResponse); + makeChargeAdjustmentCall(loanId, transactionId, externalId, transactionAmount); + } + + @When("Admin makes a charge adjustment for the last {string} type charge which is due on {string} with transaction amount higher than the available charge amount") + public void loanChargeAdjustmentFailedOnWrongAmount(String chargeTypeEnum, String date) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Response loanDetailsResponse = loansApi.retrieveLoan(loanId, false, "charges", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); + + Long transactionId = getTransactionIdForLastChargeMetConditions(chargeTypeEnum, date, loanDetailsResponse); + PostLoansLoanIdChargesChargeIdRequest chargeAdjustmentRequest = LoanRequestFactory.defaultChargeAdjustmentRequest().amount(8.0) + .externalId(""); + + Response chargeAdjustmentResponseFail = loanChargesApi + .executeLoanCharge2(loanId, transactionId, chargeAdjustmentRequest, "adjustment").execute(); + + String string = chargeAdjustmentResponseFail.errorBody().string(); + ErrorResponse errorResponse = GSON.fromJson(string, ErrorResponse.class); + Integer httpStatusCodeActual = errorResponse.getHttpStatusCode(); + String developerMessageActual = errorResponse.getErrors().get(0).getDeveloperMessage(); + + Integer httpStatusCodeExpected = 403; + String developerMessageExpected = "Transaction amount cannot be higher than the available charge amount for adjustment: 7.000000"; + + assertThat(httpStatusCodeActual) + .as(ErrorMessageHelper.wrongErrorCodeInFailedChargeAdjustment(httpStatusCodeActual, httpStatusCodeExpected)) + .isEqualTo(httpStatusCodeExpected); + assertThat(developerMessageActual) + .as(ErrorMessageHelper.wrongErrorMessageInFailedChargeAdjustment(developerMessageActual, developerMessageExpected)) + .isEqualTo(developerMessageExpected); + } + + @When("Admin reverts the charge adjustment which was raised on {string} with {double} EUR transaction amount") + public void loanChargeAdjustmentUndo(String transactionDate, double transactionAmount) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Response loanDetailsResponse = loansApi.retrieveLoan(loanId, false, "transactions", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); + + Long transactionId = getTransactionIdForTransactionMetConditions(transactionDate, transactionAmount, loanDetailsResponse); + + Response> businessDateResponse = businessDateManagementApi.getBusinessDates().execute(); + LocalDate businessDate = businessDateResponse.body().get(0).getDate(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DATE_FORMAT); + String businessDateActual = formatter.format(businessDate); + + PostLoansLoanIdTransactionsTransactionIdRequest chargeAdjustmentUndoRequest = LoanRequestFactory + .defaultChargeAdjustmentTransactionUndoRequest().transactionDate(businessDateActual); + + Response chargeAdjustmentUndoResponse = loanTransactionsApi + .adjustLoanTransaction(loanId, transactionId, chargeAdjustmentUndoRequest, "").execute(); + ErrorHelper.checkSuccessfulApiCall(chargeAdjustmentUndoResponse); + } + + private Long getTransactionIdForTransactionMetConditions(String transactionDate, double transactionAmount, + Response loanDetailsResponse) { + List transactions = loanDetailsResponse.body().getTransactions(); + GetLoansLoanIdTransactions transactionMetConditions = new GetLoansLoanIdTransactions(); + for (int i = 0; i < transactions.size(); i++) { + LocalDate date = transactions.get(i).getDate(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DATE_FORMAT); + String dateActual = formatter.format(date); + + Double amountActual = transactions.get(i).getAmount(); + + if (dateActual.equals(transactionDate) && amountActual.equals(transactionAmount)) { + transactionMetConditions = transactions.get(i); + break; + } + } + return transactionMetConditions.getId(); + } + + private void makeChargeAdjustmentCall(Long loanId, Long transactionId, String externalId, double transactionAmount) throws IOException { + PostLoansLoanIdChargesChargeIdRequest chargeAdjustmentRequest = LoanRequestFactory.defaultChargeAdjustmentRequest() + .amount(transactionAmount).externalId(externalId); + + Response chargeAdjustmentResponse = loanChargesApi + .executeLoanCharge2(loanId, transactionId, chargeAdjustmentRequest, "adjustment").execute(); + testContext().set(TestContextKey.LOAN_CHARGE_ADJUSTMENT_RESPONSE, chargeAdjustmentResponse); + ErrorHelper.checkSuccessfulApiCall(chargeAdjustmentResponse); + } + + private Long getTransactionIdForLastChargeMetConditions(String chargeTypeEnum, String date, + Response loanDetailsResponse) { + List charges = loanDetailsResponse.body().getCharges(); + + ChargeProductType chargeType = ChargeProductType.valueOf(chargeTypeEnum); + Long chargeProductId = chargeType.getValue(); + + List resultList = new ArrayList<>(); + charges.forEach(charge -> { + Long chargeId = charge.getChargeId(); + LocalDate dueDate = charge.getDueDate(); + + DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DATE_FORMAT); + String chargeDueDate = formatter.format(dueDate); + + if (chargeId.equals(chargeProductId) && chargeDueDate.equals(date)) { + resultList.add(charge); + } + }); + + GetLoansLoanIdLoanChargeData lastChargeResult = resultList.get(resultList.size() - 1); + return lastChargeResult.getId(); + } +} diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanChargeBackStepDef.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanChargeBackStepDef.java new file mode 100644 index 00000000000..9eaf7c1edff --- /dev/null +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanChargeBackStepDef.java @@ -0,0 +1,174 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.test.stepdef.loan; + +import io.cucumber.java.en.When; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import org.apache.fineract.avro.loan.v1.LoanTransactionDataV1; +import org.apache.fineract.avro.loan.v1.LoanTransactionEnumDataV1; +import org.apache.fineract.client.models.GetLoansLoanIdResponse; +import org.apache.fineract.client.models.GetLoansLoanIdTransactions; +import org.apache.fineract.client.models.GetLoansLoanIdTransactionsTransactionIdResponse; +import org.apache.fineract.client.models.GetLoansType; +import org.apache.fineract.client.models.PostLoansLoanIdTransactionsResponse; +import org.apache.fineract.client.models.PostLoansLoanIdTransactionsTransactionIdRequest; +import org.apache.fineract.client.models.PostLoansResponse; +import org.apache.fineract.client.services.LoanTransactionsApi; +import org.apache.fineract.client.services.LoansApi; +import org.apache.fineract.test.data.paymenttype.DefaultPaymentType; +import org.apache.fineract.test.data.paymenttype.PaymentTypeResolver; +import org.apache.fineract.test.factory.LoanRequestFactory; +import org.apache.fineract.test.helper.ErrorHelper; +import org.apache.fineract.test.messaging.EventAssertion; +import org.apache.fineract.test.messaging.event.loan.LoanBalanceChangedEvent; +import org.apache.fineract.test.messaging.event.loan.transaction.LoanChargebackTransactionEvent; +import org.apache.fineract.test.stepdef.AbstractStepDef; +import org.apache.fineract.test.support.TestContextKey; +import org.springframework.beans.factory.annotation.Autowired; +import retrofit2.Response; + +public class LoanChargeBackStepDef extends AbstractStepDef { + + @Autowired + private LoanTransactionsApi loanTransactionsApi; + + @Autowired + private LoansApi loansApi; + + @Autowired + private EventAssertion eventAssertion; + + @Autowired + private PaymentTypeResolver paymentTypeResolver; + + @When("Admin makes {string} chargeback with {double} EUR transaction amount") + public void makeLoanChargeback(String repaymentType, double transactionAmount) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Response repaymentResponse = testContext().get(TestContextKey.LOAN_REPAYMENT_RESPONSE); + Long transactionId = Long.valueOf(repaymentResponse.body().getResourceId()); + + makeChargebackCall(loanId, transactionId, repaymentType, transactionAmount); + } + + @When("Admin makes {string} chargeback with {double} EUR transaction amount for Payment nr. {double}") + public void makeLoanChargebackForPayment(String repaymentType, double transactionAmount, double paymentNr) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Response loanDetails = loansApi.retrieveLoan(loanId, false, "transactions", "", "").execute(); + List transactions = loanDetails.body().getTransactions(); + + List transactionIdList = new ArrayList<>(); + for (GetLoansLoanIdTransactions f : transactions) { + String code = f.getType().getCode(); + if (code.equals("loanTransactionType.repayment")) { + transactionIdList.add(f.getId()); + } + } + Collections.sort(transactionIdList); + Long transactionId = transactionIdList.get((int) paymentNr - 1); + + makeChargebackCall(loanId, transactionId, repaymentType, transactionAmount); + } + + @When("Admin makes {string} chargeback with {double} EUR transaction amount for Downpayment nr. {double}") + public void makeLoanChargebackForDownpaymentayment(String repaymentType, double transactionAmount, double paymentNr) + throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Response loanDetails = loansApi.retrieveLoan(loanId, false, "transactions", "", "").execute(); + List transactions = loanDetails.body().getTransactions(); + + List transactionIdList = new ArrayList<>(); + for (GetLoansLoanIdTransactions f : transactions) { + String code = f.getType().getCode(); + if (code.equals("loanTransactionType.downPayment")) { + transactionIdList.add(f.getId()); + } + } + Collections.sort(transactionIdList); + Long transactionId = transactionIdList.get((int) paymentNr - 1); + + makeChargebackCall(loanId, transactionId, repaymentType, transactionAmount); + } + + private void makeChargebackCall(Long loanId, Long transactionId, String repaymentType, double transactionAmount) throws IOException { + DefaultPaymentType paymentType = DefaultPaymentType.valueOf(repaymentType); + Long paymentTypeValue = paymentTypeResolver.resolve(paymentType); + + PostLoansLoanIdTransactionsTransactionIdRequest chargebackRequest = LoanRequestFactory.defaultChargebackRequest() + .paymentTypeId(paymentTypeValue).transactionAmount(transactionAmount); + + Response chargebackResponse = loanTransactionsApi + .adjustLoanTransaction(loanId, transactionId, chargebackRequest, "chargeback").execute(); + testContext().set(TestContextKey.LOAN_CHARGEBACK_RESPONSE, chargebackResponse); + ErrorHelper.checkSuccessfulApiCall(chargebackResponse); + + checkEvents(chargebackResponse); + } + + private void checkEvents(Response chargebackResponse) throws IOException { + PostLoansLoanIdTransactionsResponse responseBody = chargebackResponse.body(); + Long loanId = responseBody.getLoanId(); + + eventAssertion.assertEvent(LoanBalanceChangedEvent.class, loanId).extractingData(data -> data.getId()).isEqualTo(loanId); + + checkLoanChargebackTransactionEvent(responseBody); + } + + private void checkLoanChargebackTransactionEvent(PostLoansLoanIdTransactionsResponse chargebackResponse) throws IOException { + + // get loanId and transactionId + Long loanId = chargebackResponse.getLoanId(); + long transactionId = Long.valueOf(chargebackResponse.getResourceId()); + + // retrieve transaction details + Response transactionResponse = loanTransactionsApi + .retrieveTransaction(loanId, transactionId, "").execute(); + ErrorHelper.checkSuccessfulApiCall(transactionResponse); + + GetLoansLoanIdTransactionsTransactionIdResponse transactionResponseBody = transactionResponse.body(); + + // Get transaction type from response + GetLoansType transactionType = transactionResponseBody.getType(); + // Build expected avro transaction type from api response type + LoanTransactionEnumDataV1 expectedEventTransactionType = LoanTransactionEnumDataV1.newBuilder() + .setId(transactionType.getId().intValue()).setCode(transactionType.getCode()).setValue("Chargeback") + .setDisbursement(transactionType.getDisbursement()).setRepaymentAtDisbursement(transactionType.getRepaymentAtDisbursement()) + .setRepayment(transactionType.getRepayment()).setMerchantIssuedRefund(false).setPayoutRefund(false).setGoodwillCredit(false) + .setChargeRefund(false).setContra(transactionType.getContra()).setWaiveInterest(transactionType.getWaiveInterest()) + .setWaiveCharges(transactionType.getWaiveCharges()).setAccrual(false).setWriteOff(transactionType.getWriteOff()) + .setRecoveryRepayment(transactionType.getRecoveryRepayment()).setInitiateTransfer(false).setApproveTransfer(false) + .setWithdrawTransfer(false).setRejectTransfer(false).setChargePayment(false).setRefund(false).setRefundForActiveLoans(false) + .setCreditBalanceRefund(false).setChargeback(true).build(); + + // verify payload for loanId, transactionId, transactionType, amount + eventAssertion.assertEvent(LoanChargebackTransactionEvent.class, transactionId).extractingData(LoanTransactionDataV1::getLoanId) + .isEqualTo(loanId).extractingData(LoanTransactionDataV1::getType).isEqualTo(expectedEventTransactionType) + .extractingBigDecimal(LoanTransactionDataV1::getAmount).isEqualTo(BigDecimal.valueOf(transactionResponseBody.getAmount())); + + } +} diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanChargeStepDef.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanChargeStepDef.java new file mode 100644 index 00000000000..51bd48e2787 --- /dev/null +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanChargeStepDef.java @@ -0,0 +1,296 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.test.stepdef.loan; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.google.gson.Gson; +import io.cucumber.datatable.DataTable; +import io.cucumber.java.en.And; +import io.cucumber.java.en.Then; +import io.cucumber.java.en.When; +import java.io.IOException; +import java.time.format.DateTimeFormatter; +import java.util.List; +import lombok.extern.slf4j.Slf4j; +import org.apache.fineract.avro.loan.v1.LoanChargeDataV1; +import org.apache.fineract.client.models.GetLoansLoanIdChargesChargeIdResponse; +import org.apache.fineract.client.models.GetLoansLoanIdResponse; +import org.apache.fineract.client.models.GetLoansLoanIdTransactions; +import org.apache.fineract.client.models.PostLoansLoanIdChargesChargeIdRequest; +import org.apache.fineract.client.models.PostLoansLoanIdChargesChargeIdResponse; +import org.apache.fineract.client.models.PostLoansLoanIdChargesRequest; +import org.apache.fineract.client.models.PostLoansLoanIdChargesResponse; +import org.apache.fineract.client.models.PostLoansResponse; +import org.apache.fineract.client.models.PutChargeTransactionChangesRequest; +import org.apache.fineract.client.models.PutChargeTransactionChangesResponse; +import org.apache.fineract.client.services.LoanChargesApi; +import org.apache.fineract.client.services.LoanTransactionsApi; +import org.apache.fineract.client.services.LoansApi; +import org.apache.fineract.client.util.JSON; +import org.apache.fineract.test.data.ChargeProductType; +import org.apache.fineract.test.data.ErrorMessageType; +import org.apache.fineract.test.factory.LoanChargeRequestFactory; +import org.apache.fineract.test.helper.ErrorHelper; +import org.apache.fineract.test.helper.ErrorMessageHelper; +import org.apache.fineract.test.helper.ErrorResponse; +import org.apache.fineract.test.messaging.EventAssertion; +import org.apache.fineract.test.messaging.event.loan.charge.LoanAddChargeEvent; +import org.apache.fineract.test.stepdef.AbstractStepDef; +import org.apache.fineract.test.support.TestContextKey; +import org.springframework.beans.factory.annotation.Autowired; +import retrofit2.Response; + +@Slf4j +public class LoanChargeStepDef extends AbstractStepDef { + + public static final String DEFAULT_DATE_FORMAT = "dd MMMM yyyy"; + public static final String DATE_FORMAT_EVENTS = "yyyy-MM-dd"; + public static final Double DEFAULT_CHARGE_FEE_FLAT = 10D; + private static final Gson GSON = new JSON().getGson(); + + @Autowired + private LoanChargesApi loanChargesApi; + @Autowired + private LoanTransactionsApi loanTransactionsApi; + @Autowired + private LoansApi loansApi; + @Autowired + private EventAssertion eventAssertion; + + @When("Admin adds {string} due date charge with {string} due date and {double} EUR transaction amount") + public void addChargeDueDate(String chargeType, String transactionDate, double transactionAmount) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + ChargeProductType chargeProductType = ChargeProductType.valueOf(chargeType); + Long chargeTypeId = chargeProductType.getValue(); + if (chargeTypeId.equals(ChargeProductType.LOAN_DISBURSEMENT_PERCENTAGE_FEE.getValue()) + || chargeTypeId.equals(ChargeProductType.LOAN_TRANCHE_DISBURSEMENT_PERCENTAGE_FEE.getValue()) + || chargeTypeId.equals(ChargeProductType.LOAN_INSTALLMENT_PERCENTAGE_FEE.getValue())) { + throw new IllegalStateException(String.format("The requested %s charge is NOT due date type, cannot be used here", chargeType)); + } + + PostLoansLoanIdChargesRequest loanIdChargesRequest = LoanChargeRequestFactory.defaultLoanChargeRequest().chargeId(chargeTypeId) + .dueDate(transactionDate).amount(transactionAmount); + + Response loanChargeResponse = loanChargesApi.executeLoanCharge(loanId, loanIdChargesRequest, "") + .execute(); + ErrorHelper.checkSuccessfulApiCall(loanChargeResponse); + testContext().set(TestContextKey.ADD_DUE_DATE_CHARGE_RESPONSE, loanChargeResponse); + + addChargeEventCheck(loanChargeResponse); + } + + @When("Admin adds {string} charge with {double} % of transaction amount") + public void addChargePercentage(String chargeType, double transactionPercentageAmount) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + ChargeProductType chargeProductType = ChargeProductType.valueOf(chargeType); + Long chargeTypeId = chargeProductType.getValue(); + if (!chargeTypeId.equals(ChargeProductType.LOAN_DISBURSEMENT_PERCENTAGE_FEE.getValue()) + && !chargeTypeId.equals(ChargeProductType.LOAN_TRANCHE_DISBURSEMENT_PERCENTAGE_FEE.getValue()) + && !chargeTypeId.equals(ChargeProductType.LOAN_INSTALLMENT_PERCENTAGE_FEE.getValue())) { + throw new IllegalStateException(String.format("The requested %s charge is due date type, cannot be used here", chargeType)); + } + + PostLoansLoanIdChargesRequest loanIdChargesRequest = LoanChargeRequestFactory.defaultLoanChargeRequest().chargeId(chargeTypeId) + .amount(transactionPercentageAmount); + + Response loanChargeResponse = loanChargesApi.executeLoanCharge(loanId, loanIdChargesRequest, "") + .execute(); + ErrorHelper.checkSuccessfulApiCall(loanChargeResponse); + testContext().set(TestContextKey.ADD_DUE_DATE_CHARGE_RESPONSE, loanChargeResponse); + } + + @Then("Admin is not able to add {string} due date charge with {string} due date and {double} EUR transaction amount because the of charged-off account") + public void addChargeDueDateOnChargedOff(String chargeType, String transactionDate, double transactionAmount) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + ChargeProductType chargeProductType = ChargeProductType.valueOf(chargeType); + Long chargeTypeId = chargeProductType.getValue(); + + PostLoansLoanIdChargesRequest loanIdChargesRequest = LoanChargeRequestFactory.defaultLoanChargeRequest().chargeId(chargeTypeId) + .dueDate(transactionDate).amount(transactionAmount); + + Response loanChargeResponse = loanChargesApi.executeLoanCharge(loanId, loanIdChargesRequest, "") + .execute(); + testContext().set(TestContextKey.ADD_DUE_DATE_CHARGE_RESPONSE, loanChargeResponse); + ErrorResponse errorDetails = ErrorResponse.from(loanChargeResponse); + assertThat(errorDetails.getHttpStatusCode()).as(ErrorMessageHelper.addChargeForChargeOffLoanCodeMsg()).isEqualTo(403); + assertThat(errorDetails.getSingleError().getDeveloperMessage()) + .isEqualTo(ErrorMessageHelper.addChargeForChargeOffLoanFailure(loanId)); + } + + @And("Admin adds a {double} % Processing charge to the loan with {string} locale on date: {string}") + public void addProcessingFee(double chargeAmount, String locale, String date) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + PostLoansLoanIdChargesRequest loanIdChargesRequest = LoanChargeRequestFactory.defaultLoanChargeRequest() + .chargeId(ChargeProductType.LOAN_PERCENTAGE_PROCESSING_FEE.value).amount(chargeAmount).dueDate(date) + .dateFormat(DEFAULT_DATE_FORMAT).locale(locale); + + Response loanChargeResponse = loanChargesApi.executeLoanCharge(loanId, loanIdChargesRequest, "") + .execute(); + ErrorHelper.checkSuccessfulApiCall(loanChargeResponse); + testContext().set(TestContextKey.ADD_PROCESSING_FEE_RESPONSE, loanChargeResponse); + } + + @And("Admin adds an NSF fee because of payment bounce with {string} transaction date") + public void addNSFfee(String date) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + PostLoansLoanIdChargesRequest loanIdChargesRequest = LoanChargeRequestFactory.defaultLoanChargeRequest() + .chargeId(ChargeProductType.LOAN_NSF_FEE.value).amount(DEFAULT_CHARGE_FEE_FLAT).dueDate(date) + .dateFormat(DEFAULT_DATE_FORMAT); + + Response loanChargeResponse = loanChargesApi.executeLoanCharge(loanId, loanIdChargesRequest, "") + .execute(); + ErrorHelper.checkSuccessfulApiCall(loanChargeResponse); + testContext().set(TestContextKey.ADD_NSF_FEE_RESPONSE, loanChargeResponse); + } + + @And("Admin waives charge") + public void waiveCharge() throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Response loanChargeResponse = testContext().get(TestContextKey.ADD_NSF_FEE_RESPONSE); + Long chargeId = Long.valueOf(loanChargeResponse.body().getResourceId()); + + PostLoansLoanIdChargesChargeIdRequest waiveRequest = new PostLoansLoanIdChargesChargeIdRequest(); + + Response waiveResponse = loanChargesApi + .executeLoanCharge2(loanId, chargeId, waiveRequest, "waive").execute(); + ErrorHelper.checkSuccessfulApiCall(waiveResponse); + testContext().set(TestContextKey.WAIVE_CHARGE_RESPONSE, waiveResponse); + } + + @And("Admin waives due date charge") + public void waiveDueDateCharge() throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Response loanChargeResponse = testContext().get(TestContextKey.ADD_DUE_DATE_CHARGE_RESPONSE); + Long chargeId = Long.valueOf(loanChargeResponse.body().getResourceId()); + + PostLoansLoanIdChargesChargeIdRequest waiveRequest = new PostLoansLoanIdChargesChargeIdRequest(); + + Response waiveResponse = loanChargesApi + .executeLoanCharge2(loanId, chargeId, waiveRequest, "waive").execute(); + ErrorHelper.checkSuccessfulApiCall(waiveResponse); + testContext().set(TestContextKey.WAIVE_CHARGE_RESPONSE, waiveResponse); + } + + @And("Admin makes waive undone for charge") + public void undoWaiveForCharge() throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Response loanDetails = loansApi.retrieveLoan(loanId, false, "transactions", "", "").execute(); + List transactions = loanDetails.body().getTransactions(); + + Long transactionId = 0L; + for (GetLoansLoanIdTransactions f : transactions) { + String code = f.getType().getCode(); + if (code.equals("loanTransactionType.waiveCharges")) { + transactionId = f.getId(); + } + } + + PutChargeTransactionChangesRequest undoWaiveRequest = new PutChargeTransactionChangesRequest(); + Response undoWaiveResponse = loanTransactionsApi + .undoWaiveCharge(loanId, transactionId, undoWaiveRequest).execute(); + ErrorHelper.checkSuccessfulApiCall(undoWaiveResponse); + testContext().set(TestContextKey.UNDO_WAIVE_RESPONSE, undoWaiveResponse); + } + + @Then("Charge is successfully added to the loan") + public void loanChargeStatus() throws IOException { + Response response = testContext().get(TestContextKey.ADD_NSF_FEE_RESPONSE); + + assertThat(response.isSuccessful()).as(ErrorMessageHelper.requestFailed(response)).isTrue(); + assertThat(response.code()).as(ErrorMessageHelper.requestFailedWithCode(response)).isEqualTo(200); + } + + @Then("Charge is successfully added to the loan with {float} EUR") + public void checkLoanChargeAmount(float chargeAmount) throws IOException { + Response response = testContext().get(TestContextKey.ADD_PROCESSING_FEE_RESPONSE); + Response loanChargeAmount = loanChargesApi + .retrieveLoanCharge(response.body().getLoanId(), Long.valueOf(response.body().getResourceId())).execute(); + + ErrorHelper.checkSuccessfulApiCall(response); + assertThat(loanChargeAmount.body().getAmount()).as("Charge amount is wrong").isEqualTo(chargeAmount); + } + + private void addChargeEventCheck(Response loanChargeResponse) throws IOException { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DATE_FORMAT_EVENTS); + Response chargeDetails = loanChargesApi + .retrieveLoanCharge(loanChargeResponse.body().getLoanId(), loanChargeResponse.body().getResourceId()).execute(); + GetLoansLoanIdChargesChargeIdResponse body = chargeDetails.body(); + + eventAssertion.assertEvent(LoanAddChargeEvent.class, loanChargeResponse.body().getResourceId()) + .extractingData(LoanChargeDataV1::getName).isEqualTo(body.getName()) + .extractingData(loanChargeDataV1 -> loanChargeDataV1.getAmount().longValue()).isEqualTo(body.getAmount().longValue()) + .extractingData(LoanChargeDataV1::getDueDate).isEqualTo(formatter.format(body.getDueDate())); + } + + @Then("Loan charge transaction with the following data results a {int} error and {string} error message") + public void chargeOffTransactionError(int errorCodeExpected, String errorMessageType, DataTable table) throws IOException { + List> data = table.asLists(); + List chargeData = data.get(1); + String chargeType = chargeData.get(0); + String transactionDate = chargeData.get(1); + Double transactionAmount = Double.valueOf(chargeData.get(2)); + + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + ErrorMessageType errorMsgType = ErrorMessageType.valueOf(errorMessageType); + String errorMessageExpectedRaw = errorMsgType.getValue(); + String errorMessageExpected = String.format(errorMessageExpectedRaw, loanId); + + ChargeProductType chargeProductType = ChargeProductType.valueOf(chargeType); + Long chargeTypeId = chargeProductType.getValue(); + if (chargeTypeId.equals(ChargeProductType.LOAN_DISBURSEMENT_PERCENTAGE_FEE.getValue()) + || chargeTypeId.equals(ChargeProductType.LOAN_TRANCHE_DISBURSEMENT_PERCENTAGE_FEE.getValue()) + || chargeTypeId.equals(ChargeProductType.LOAN_INSTALLMENT_PERCENTAGE_FEE.getValue())) { + throw new IllegalStateException(String.format("The requested %s charge is NOT due date type, cannot be used here", chargeType)); + } + + PostLoansLoanIdChargesRequest loanIdChargesRequest = LoanChargeRequestFactory.defaultLoanChargeRequest().chargeId(chargeTypeId) + .dueDate(transactionDate).amount(transactionAmount); + + Response loanChargeResponse = loanChargesApi.executeLoanCharge(loanId, loanIdChargesRequest, "") + .execute(); + int errorCodeActual = loanChargeResponse.code(); + String errorBody = loanChargeResponse.errorBody().string(); + ErrorResponse errorResponse = GSON.fromJson(errorBody, ErrorResponse.class); + String errorMessageActual = errorResponse.getErrors().get(0).getDeveloperMessage(); + + assertThat(errorCodeActual).as(ErrorMessageHelper.wrongErrorCode(errorCodeActual, errorCodeExpected)).isEqualTo(errorCodeExpected); + assertThat(errorMessageActual).as(ErrorMessageHelper.wrongErrorMessage(errorMessageActual, errorMessageExpected)) + .isEqualTo(errorMessageExpected); + + log.info("ERROR CODE: {}", errorCodeActual); + log.info("ERROR MESSAGE: {}", errorMessageActual); + } +} diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanDelinquencyStepDef.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanDelinquencyStepDef.java new file mode 100644 index 00000000000..e55519460e1 --- /dev/null +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanDelinquencyStepDef.java @@ -0,0 +1,771 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.test.stepdef.loan; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.google.gson.Gson; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; +import io.cucumber.datatable.DataTable; +import io.cucumber.java.en.Then; +import io.cucumber.java.en.When; +import java.io.IOException; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.nio.charset.StandardCharsets; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.codec.binary.Base64; +import org.apache.fineract.avro.loan.v1.LoanAccountDelinquencyRangeDataV1; +import org.apache.fineract.avro.loan.v1.LoanInstallmentDelinquencyBucketDataV1; +import org.apache.fineract.client.models.GetDelinquencyActionsResponse; +import org.apache.fineract.client.models.GetDelinquencyRangesResponse; +import org.apache.fineract.client.models.GetDelinquencyTagHistoryResponse; +import org.apache.fineract.client.models.GetLoansLoanIdDelinquencyPausePeriod; +import org.apache.fineract.client.models.GetLoansLoanIdDelinquencySummary; +import org.apache.fineract.client.models.GetLoansLoanIdLoanInstallmentLevelDelinquency; +import org.apache.fineract.client.models.GetLoansLoanIdResponse; +import org.apache.fineract.client.models.GetUsersUserIdResponse; +import org.apache.fineract.client.models.PostLoansDelinquencyActionRequest; +import org.apache.fineract.client.models.PostLoansDelinquencyActionResponse; +import org.apache.fineract.client.models.PostLoansResponse; +import org.apache.fineract.client.models.PostUsersResponse; +import org.apache.fineract.client.services.LoansApi; +import org.apache.fineract.client.services.UsersApi; +import org.apache.fineract.client.util.JSON; +import org.apache.fineract.test.api.ApiProperties; +import org.apache.fineract.test.data.DelinquencyRange; +import org.apache.fineract.test.data.LoanStatus; +import org.apache.fineract.test.helper.ErrorHelper; +import org.apache.fineract.test.helper.ErrorMessageHelper; +import org.apache.fineract.test.helper.ErrorResponse; +import org.apache.fineract.test.messaging.EventAssertion; +import org.apache.fineract.test.messaging.event.EventCheckHelper; +import org.apache.fineract.test.messaging.event.loan.delinquency.LoanDelinquencyRangeChangeEvent; +import org.apache.fineract.test.stepdef.AbstractStepDef; +import org.apache.fineract.test.support.TestContextKey; +import org.springframework.beans.factory.annotation.Autowired; +import retrofit2.Response; + +@Slf4j +public class LoanDelinquencyStepDef extends AbstractStepDef { + + public static final String DATE_FORMAT = "dd MMMM yyyy"; + public static final String DEFAULT_LOCALE = "en"; + public static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern(DATE_FORMAT); + private static final Gson GSON = new JSON().getGson(); + + @Autowired + private LoansApi loansApi; + + @Autowired + private EventAssertion eventAssertion; + + @Autowired + private EventCheckHelper eventCheckHelper; + + @Autowired + private ApiProperties apiProperties; + + @Autowired + private UsersApi usersApi; + + @Then("Admin checks that delinquency range is: {string} and has delinquentDate {string}") + public void checkDelinquencyRange(String range, String delinquentDateExpected) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Response loanDetails = loansApi.retrieveLoan(loanId, false, "", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetails); + Integer loanStatus = loanDetails.body().getStatus().getId(); + + if (!LoanStatus.SUBMITTED_AND_PENDING_APPROVAL.value.equals(loanStatus) && !LoanStatus.APPROVED.value.equals(loanStatus)) { + String delinquentDateExpectedValue = "".equals(delinquentDateExpected) ? null : delinquentDateExpected; + eventAssertion.assertEvent(LoanDelinquencyRangeChangeEvent.class, loanId)// + .extractingData(LoanAccountDelinquencyRangeDataV1::getDelinquentDate)// + .isEqualTo(delinquentDateExpectedValue);// + } + + DelinquencyRange expectedDelinquencyRange = DelinquencyRange.valueOf(range); + String expectedDelinquencyRangeValue = expectedDelinquencyRange.getValue(); + + String actualDelinquencyRangeValue = DelinquencyRange.NO_DELINQUENCY.value; + GetDelinquencyRangesResponse actualDelinquencyRange = loanDetails.body().getDelinquencyRange(); + if (actualDelinquencyRange != null) { + actualDelinquencyRangeValue = actualDelinquencyRange.getClassification(); + } + + assertThat(actualDelinquencyRangeValue) + .as(ErrorMessageHelper.delinquencyRangeError(actualDelinquencyRangeValue, expectedDelinquencyRangeValue)) + .isEqualTo(expectedDelinquencyRangeValue); + } + + @Then("Admin checks that {string}th delinquency range is: {string} and added on: {string} and has delinquentDate {string}") + public void checkDelinquencyRange(String nthInList, String range, String addedOnDate, String delinquentDateExpected) + throws IOException { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DATE_FORMAT); + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + String delinquentDateExpectedValue = "".equals(delinquentDateExpected) ? null : delinquentDateExpected; + eventAssertion.assertEvent(LoanDelinquencyRangeChangeEvent.class, loanId) + .extractingData(LoanAccountDelinquencyRangeDataV1::getDelinquentDate).isEqualTo(delinquentDateExpectedValue); + + DelinquencyRange expectedDelinquencyRange = DelinquencyRange.valueOf(range); + String expectedDelinquencyRangeValue = expectedDelinquencyRange.getValue(); + + Response> delinquencyHistoryDetails = loansApi.getDelinquencyTagHistory(loanId).execute(); + ErrorHelper.checkSuccessfulApiCall(delinquencyHistoryDetails); + + String actualDelinquencyRangeValue = DelinquencyRange.NO_DELINQUENCY.value; + String actualDelinquencyAddedOnDate = ""; + int i = Integer.parseInt(nthInList) - 1; + GetDelinquencyTagHistoryResponse delinquencyTag = delinquencyHistoryDetails.body().get(i); + if (delinquencyTag != null) { + actualDelinquencyRangeValue = delinquencyTag.getDelinquencyRange().getClassification(); + actualDelinquencyAddedOnDate = formatter.format(delinquencyTag.getAddedOnDate()); + } + + assertThat(actualDelinquencyRangeValue) + .as(ErrorMessageHelper.delinquencyRangeError(actualDelinquencyRangeValue, expectedDelinquencyRangeValue)) + .isEqualTo(expectedDelinquencyRangeValue); + assertThat(actualDelinquencyAddedOnDate).as(ErrorMessageHelper.delinquencyRangeError(actualDelinquencyAddedOnDate, addedOnDate)) + .isEqualTo(addedOnDate); + } + + @Then("Loan delinquency history has the following details:") + public void delinquencyHistoryCheck(DataTable table) throws IOException { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DATE_FORMAT); + List> dataExpected = table.asLists(); + + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Response> delinquencyHistoryDetails = loansApi.getDelinquencyTagHistory(loanId).execute(); + ErrorHelper.checkSuccessfulApiCall(delinquencyHistoryDetails); + List body = delinquencyHistoryDetails.body(); + + for (int i = 0; i < body.size(); i++) { + List line = dataExpected.get(i + 1); + DelinquencyRange expectedDelinquencyRange = DelinquencyRange.valueOf(line.get(0)); + String classificationExpected = expectedDelinquencyRange.getValue(); + String addedOnDateExpected = line.get(1); + String liftedOnDateExpected = line.get(2); + + String classificationActual = body.get(i).getDelinquencyRange().getClassification(); + String addedOnDateActual = body.get(i).getAddedOnDate() == null ? null : formatter.format(body.get(i).getAddedOnDate()); + String liftedOnDateActual = body.get(i).getLiftedOnDate() == null ? null : formatter.format(body.get(i).getLiftedOnDate()); + + assertThat(classificationActual) + .as(ErrorMessageHelper.wrongDataInDelinquencyHistoryClassification(classificationActual, classificationExpected)) + .isEqualTo(classificationExpected); + assertThat(addedOnDateActual) + .as(ErrorMessageHelper.wrongDataInDelinquencyHistoryAddedOnDate(addedOnDateActual, addedOnDateExpected)) + .isEqualTo(addedOnDateExpected); + assertThat(liftedOnDateActual) + .as(ErrorMessageHelper.wrongDataInDelinquencyHistoryLiftedOnDate(liftedOnDateActual, liftedOnDateExpected)) + .isEqualTo(liftedOnDateExpected); + } + } + + @When("Admin initiate a DELINQUENCY PAUSE with startDate: {string} and endDate: {string}") + public void delinquencyPause(String startDate, String endDate) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + PostLoansDelinquencyActionRequest request = new PostLoansDelinquencyActionRequest()// + .action("pause")// + .startDate(startDate)// + .endDate(endDate)// + .dateFormat(DATE_FORMAT)// + .locale(DEFAULT_LOCALE);// + + Response response = loansApi.createLoanDelinquencyAction(loanId, request).execute(); + testContext().set(TestContextKey.LOAN_DELINQUENCY_ACTION_RESPONSE, response); + ErrorHelper.checkSuccessfulApiCall(response); + + eventCheckHelper.loanAccountDelinquencyPauseChangedBusinessEventCheck(loanId); + } + + @When("Created user with CREATE_DELINQUENCY_ACTION permission initiate a DELINQUENCY PAUSE with startDate: {string} and endDate: {string}") + public void delinquencyPauseWithCreatedUser(String startDate, String endDate) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + PostLoansDelinquencyActionRequest request = new PostLoansDelinquencyActionRequest()// + .action("pause")// + .startDate(startDate)// + .endDate(endDate)// + .dateFormat(DATE_FORMAT)// + .locale(DEFAULT_LOCALE);// + + Map headerMap = new HashMap<>(); + Response createUserResponse = testContext().get(TestContextKey.CREATED_SIMPLE_USER_RESPONSE); + Long createdUserId = createUserResponse.body().getResourceId(); + Response user = usersApi.retrieveOne31(createdUserId).execute(); + ErrorHelper.checkSuccessfulApiCall(user); + String authorizationString = user.body().getUsername() + ":" + apiProperties.getPassword(); + Base64 base64 = new Base64(); + headerMap.put("Authorization", + "Basic " + new String(base64.encode(authorizationString.getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8)); + + Response response = loansApi.createLoanDelinquencyAction(loanId, request, headerMap).execute(); + testContext().set(TestContextKey.LOAN_DELINQUENCY_ACTION_RESPONSE, response); + ErrorHelper.checkSuccessfulApiCall(response); + + eventCheckHelper.loanAccountDelinquencyPauseChangedBusinessEventCheck(loanId); + } + + @Then("Created user with no CREATE_DELINQUENCY_ACTION permission gets an error when initiate a DELINQUENCY PAUSE with startDate: {string} and endDate: {string}") + public void delinquencyPauseWithCreatedUserNOPermissionError(String startDate, String endDate) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + int errorCodeExpected = 403; + String errorMessageExpected = "User has no authority to CREATE delinquency_actions"; + + PostLoansDelinquencyActionRequest request = new PostLoansDelinquencyActionRequest()// + .action("pause")// + .startDate(startDate)// + .endDate(endDate)// + .dateFormat(DATE_FORMAT)// + .locale(DEFAULT_LOCALE);// + + Map headerMap = new HashMap<>(); + Response createUserResponse = testContext().get(TestContextKey.CREATED_SIMPLE_USER_RESPONSE); + Long createdUserId = createUserResponse.body().getResourceId(); + Response user = usersApi.retrieveOne31(createdUserId).execute(); + ErrorHelper.checkSuccessfulApiCall(user); + String authorizationString = user.body().getUsername() + ":" + apiProperties.getPassword(); + Base64 base64 = new Base64(); + headerMap.put("Authorization", + "Basic " + new String(base64.encode(authorizationString.getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8)); + + Response response = loansApi.createLoanDelinquencyAction(loanId, request, headerMap).execute(); + testContext().set(TestContextKey.LOAN_DELINQUENCY_ACTION_RESPONSE, response); + int errorCodeActual = response.code(); + String errorBody = response.errorBody().string(); + ErrorResponse errorResponse = GSON.fromJson(errorBody, ErrorResponse.class); + String errorMessageActual = errorResponse.getErrors().get(0).getDeveloperMessage(); + + assertThat(errorCodeActual).as(ErrorMessageHelper.wrongErrorCode(errorCodeActual, errorCodeExpected)).isEqualTo(errorCodeExpected); + assertThat(errorMessageActual).as(ErrorMessageHelper.wrongErrorMessage(errorMessageActual, errorMessageExpected)) + .isEqualTo(errorMessageExpected); + + log.info("ERROR CODE: {}", errorCodeActual); + log.info("ERROR MESSAGE: {}", errorMessageActual); + } + + @When("Admin initiate a DELINQUENCY RESUME with startDate: {string}") + public void delinquencyResume(String startDate) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + PostLoansDelinquencyActionRequest request = new PostLoansDelinquencyActionRequest()// + .action("resume")// + .startDate(startDate)// + .dateFormat(DATE_FORMAT)// + .locale(DEFAULT_LOCALE);// + + Response response = loansApi.createLoanDelinquencyAction(loanId, request).execute(); + testContext().set(TestContextKey.LOAN_DELINQUENCY_ACTION_RESPONSE, response); + ErrorHelper.checkSuccessfulApiCall(response); + + eventCheckHelper.loanAccountDelinquencyPauseChangedBusinessEventCheck(loanId); + } + + @When("Admin initiate a DELINQUENCY PAUSE by loanExternalId with startDate: {string} and endDate: {string}") + public void delinquencyPauseByLoanExternalId(String startDate, String endDate) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + String loanExternalId = loanResponse.body().getResourceExternalId(); + long loanId = loanResponse.body().getLoanId(); + + PostLoansDelinquencyActionRequest request = new PostLoansDelinquencyActionRequest()// + .action("pause")// + .startDate(startDate)// + .endDate(endDate)// + .dateFormat(DATE_FORMAT)// + .locale(DEFAULT_LOCALE);// + + Response response = loansApi.createLoanDelinquencyAction1(loanExternalId, request).execute(); + testContext().set(TestContextKey.LOAN_DELINQUENCY_ACTION_RESPONSE, response); + ErrorHelper.checkSuccessfulApiCall(response); + + eventCheckHelper.loanAccountDelinquencyPauseChangedBusinessEventCheck(loanId); + } + + @When("Admin initiate a DELINQUENCY RESUME by loanExternalId with startDate: {string}") + public void delinquencyResumeByLoanExternalId(String startDate) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + String loanExternalId = loanResponse.body().getResourceExternalId(); + long loanId = loanResponse.body().getLoanId(); + + PostLoansDelinquencyActionRequest request = new PostLoansDelinquencyActionRequest()// + .action("resume")// + .startDate(startDate)// + .dateFormat(DATE_FORMAT)// + .locale(DEFAULT_LOCALE);// + + Response response = loansApi.createLoanDelinquencyAction1(loanExternalId, request).execute(); + testContext().set(TestContextKey.LOAN_DELINQUENCY_ACTION_RESPONSE, response); + ErrorHelper.checkSuccessfulApiCall(response); + + eventCheckHelper.loanAccountDelinquencyPauseChangedBusinessEventCheck(loanId); + } + + @Then("Delinquency-actions have the following data:") + public void getDelinquencyActionData(DataTable table) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + List> data = table.asLists(); + int nrOfLinesExpected = data.size() - 1; + + Response> response = loansApi.getLoanDelinquencyActions(loanId).execute(); + int nrOfLinesActual = response.body().size(); + + assertThat(nrOfLinesActual)// + .as(ErrorMessageHelper.wrongNumberOfLinesInDelinquencyActions(nrOfLinesActual, nrOfLinesExpected))// + .isEqualTo(nrOfLinesExpected);// + + for (int i = 1; i < data.size(); i++) { + List expectedValues = data.get(i); + + GetDelinquencyActionsResponse lineActual = response.body().get(i - 1); + + List actualValues = new ArrayList<>(); + actualValues.add(Objects.requireNonNull(lineActual.getAction())); + actualValues.add(FORMATTER.format(Objects.requireNonNull(lineActual.getStartDate()))); + actualValues.add(lineActual.getEndDate() == null ? null : FORMATTER.format(lineActual.getEndDate())); + + assertThat(actualValues)// + .as(ErrorMessageHelper.wrongValueInLineDelinquencyActions(i, actualValues, expectedValues))// + .isEqualTo(expectedValues);// + } + } + + @Then("Initiating a delinquency-action other than PAUSE or RESUME in action field results an error - startDate: {string}, endDate: {string}") + public void actionFieldError(String startDate, String endDate) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + PostLoansDelinquencyActionRequest request = new PostLoansDelinquencyActionRequest()// + .action("TEST")// + .startDate(startDate)// + .endDate(endDate)// + .dateFormat(DATE_FORMAT)// + .locale(DEFAULT_LOCALE);// + + Response response = loansApi.createLoanDelinquencyAction(loanId, request).execute(); + int errorCodeExpected = 400; + String errorMessageExpected = "Invalid Delinquency Action: TEST"; + errorMessageAssertation(response, errorCodeExpected, errorMessageExpected); + } + + @Then("Initiating a DELINQUENCY PAUSE with startDate before the actual business date results an error - startDate: {string}, endDate: {string}") + public void delinquencyPauseStartDateError(String startDate, String endDate) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + PostLoansDelinquencyActionRequest request = new PostLoansDelinquencyActionRequest()// + .action("pause")// + .startDate(startDate)// + .endDate(endDate)// + .dateFormat(DATE_FORMAT)// + .locale(DEFAULT_LOCALE);// + + Response response = loansApi.createLoanDelinquencyAction(loanId, request).execute(); + int errorCodeExpected = 400; + String errorMessageExpected = "Start date of pause period must be in the future"; + errorMessageAssertation(response, errorCodeExpected, errorMessageExpected); + } + + @Then("Initiating a DELINQUENCY PAUSE on a non-active loan results an error - startDate: {string}, endDate: {string}") + public void delinquencyPauseNonActiveLoanError(String startDate, String endDate) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + PostLoansDelinquencyActionRequest request = new PostLoansDelinquencyActionRequest()// + .action("pause")// + .startDate(startDate)// + .endDate(endDate)// + .dateFormat(DATE_FORMAT)// + .locale(DEFAULT_LOCALE);// + + Response response = loansApi.createLoanDelinquencyAction(loanId, request).execute(); + int errorCodeExpected = 400; + String errorMessageExpected = "Delinquency actions can be created only for active loans."; + errorMessageAssertation(response, errorCodeExpected, errorMessageExpected); + } + + @Then("Initiating a DELINQUENCY RESUME on a non-active loan results an error - startDate: {string}") + public void delinquencyResumeNonActiveLoanError(String startDate) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + PostLoansDelinquencyActionRequest request = new PostLoansDelinquencyActionRequest()// + .action("resume")// + .startDate(startDate)// + .dateFormat(DATE_FORMAT)// + .locale(DEFAULT_LOCALE);// + + Response response = loansApi.createLoanDelinquencyAction(loanId, request).execute(); + int errorCodeExpected = 400; + String errorMessageExpected = "Delinquency actions can be created only for active loans."; + errorMessageAssertation(response, errorCodeExpected, errorMessageExpected); + } + + @Then("Overlapping PAUSE periods result an error - startDate: {string}, endDate: {string}") + public void delinquencyPauseOverlappingError(String startDate, String endDate) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + PostLoansDelinquencyActionRequest request = new PostLoansDelinquencyActionRequest()// + .action("pause")// + .startDate(startDate)// + .endDate(endDate)// + .dateFormat(DATE_FORMAT)// + .locale(DEFAULT_LOCALE);// + + Response response = loansApi.createLoanDelinquencyAction(loanId, request).execute(); + int errorCodeExpected = 400; + String errorMessageExpected = "Delinquency pause period cannot overlap with another pause period"; + errorMessageAssertation(response, errorCodeExpected, errorMessageExpected); + } + + @Then("Initiating a DELINQUENCY RESUME without an active PAUSE period results an error - startDate: {string}") + public void delinquencyResumeWithoutPauseError(String startDate) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + PostLoansDelinquencyActionRequest request = new PostLoansDelinquencyActionRequest()// + .action("resume")// + .startDate(startDate)// + .dateFormat(DATE_FORMAT)// + .locale(DEFAULT_LOCALE);// + + Response response = loansApi.createLoanDelinquencyAction(loanId, request).execute(); + int errorCodeExpected = 400; + String errorMessageExpected = "Resume Delinquency Action can only be created during an active pause"; + errorMessageAssertation(response, errorCodeExpected, errorMessageExpected); + } + + @Then("Initiating a DELINQUENCY RESUME with start date other than actual business date results an error - startDate: {string}") + public void delinquencyResumeStartDateError(String startDate) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + PostLoansDelinquencyActionRequest request = new PostLoansDelinquencyActionRequest()// + .action("resume")// + .startDate(startDate)// + .dateFormat(DATE_FORMAT)// + .locale(DEFAULT_LOCALE);// + + Response response = loansApi.createLoanDelinquencyAction(loanId, request).execute(); + int errorCodeExpected = 400; + String errorMessageExpected = "Start date of the Resume Delinquency action must be the current business date"; + errorMessageAssertation(response, errorCodeExpected, errorMessageExpected); + } + + @Then("Initiating a DELINQUENCY RESUME with an endDate results an error - startDate: {string}, endDate: {string}") + public void delinquencyResumeWithEndDateError(String startDate, String endDate) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + PostLoansDelinquencyActionRequest request = new PostLoansDelinquencyActionRequest()// + .action("resume")// + .startDate(startDate)// + .endDate(endDate)// + .dateFormat(DATE_FORMAT)// + .locale(DEFAULT_LOCALE);// + + Response response = loansApi.createLoanDelinquencyAction(loanId, request).execute(); + int errorCodeExpected = 400; + String errorMessageExpected = "Resume Delinquency action can not have end date"; + errorMessageAssertation(response, errorCodeExpected, errorMessageExpected); + } + + @Then("Installment level delinquency event has correct data") + public void installmentLevelDelinquencyEventCheck() throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + eventCheckHelper.installmentLevelDelinquencyRangeChangeEventCheck(loanId); + } + + @Then("INSTALLMENT level delinquency is null") + public void installmentLevelDelinquencyNull() throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Response loanDetails = loansApi.retrieveLoan(loanId, false, "", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetails); + List installmentLevelDelinquency = loanDetails.body().getDelinquent() + .getInstallmentLevelDelinquency() == null ? null : loanDetails.body().getDelinquent().getInstallmentLevelDelinquency(); + assertThat(installmentLevelDelinquency).isNull(); + } + + @Then("Loan has the following LOAN level delinquency data:") + public void loanDelinquencyDataCheck(DataTable table) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + List expectedValuesList = table.asLists().get(1); + DelinquencyRange expectedDelinquencyRange = DelinquencyRange.valueOf(expectedValuesList.get(0)); + String expectedDelinquencyRangeValue = expectedDelinquencyRange.getValue(); + expectedValuesList.set(0, expectedDelinquencyRangeValue); + + Response loanDetails = loansApi.retrieveLoan(loanId, false, "", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetails); + String actualDelinquencyRangeValue = loanDetails.body().getDelinquencyRange() == null ? "NO_DELINQUENCY" + : loanDetails.body().getDelinquencyRange().getClassification(); + GetLoansLoanIdDelinquencySummary delinquent = loanDetails.body().getDelinquent(); + List actualValuesList = List.of(actualDelinquencyRangeValue, delinquent.getDelinquentAmount().toString(), + delinquent.getDelinquentDate() == null ? "null" : FORMATTER.format(delinquent.getDelinquentDate()), + delinquent.getDelinquentDays().toString(), delinquent.getPastDueDays().toString()); + + assertThat(actualValuesList).as(ErrorMessageHelper.wrongValueInLoanLevelDelinquencyData(actualValuesList, expectedValuesList)) + .isEqualTo(expectedValuesList); + } + + @Then("Loan has the following INSTALLMENT level delinquency data:") + public void loanDelinquencyInstallmentLevelDataCheck(DataTable table) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Response loanDetails = loansApi.retrieveLoan(loanId, false, "", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetails); + List installmentLevelDelinquency = loanDetails.body().getDelinquent() + .getInstallmentLevelDelinquency(); + + List> data = table.asLists(); + assertThat(installmentLevelDelinquency.size()) + .as(ErrorMessageHelper.nrOfLinesWrongInInstallmentLevelDelinquencyData(installmentLevelDelinquency.size(), data.size() - 1)) + .isEqualTo(data.size() - 1); + for (int i = 1; i < data.size(); i++) { + DelinquencyRange expectedDelinquencyRange = DelinquencyRange.valueOf(data.get(i).get(1)); + String expectedDelinquencyRangeValue = expectedDelinquencyRange.getValue(); + + List expectedValuesList = data.get(i); + expectedValuesList.set(1, expectedDelinquencyRangeValue); + + List actualValuesList = List.of(String.valueOf(installmentLevelDelinquency.get(i - 1).getRangeId()), + installmentLevelDelinquency.get(i - 1).getClassification(), + installmentLevelDelinquency.get(i - 1).getDelinquentAmount().setScale(2, RoundingMode.HALF_DOWN).toString()); + assertThat(actualValuesList) + .as(ErrorMessageHelper.wrongValueInLineInInstallmentLevelDelinquencyData(i, actualValuesList, expectedValuesList)) + .isEqualTo(expectedValuesList); + } + } + + @Then("Loan Delinquency pause periods has the following data:") + public void loanDelinquencyPauseDataCheck(DataTable table) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + List> expectedData = table.asLists(); + Response loanDetails = loansApi.retrieveLoan(loanId, false, "", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetails); + + List delinquencyPausePeriods = loanDetails.body().getDelinquent() + .getDelinquencyPausePeriods(); + + assertThat(delinquencyPausePeriods.size()) + .as(ErrorMessageHelper.nrOfLinesWrongInLoanDelinquencyPauseData(delinquencyPausePeriods.size(), expectedData.size() - 1)) + .isEqualTo(expectedData.size() - 1); + + for (int i = 1; i < expectedData.size(); i++) { + List expectedValuesList = expectedData.get(i); + + List> actualValuesList = delinquencyPausePeriods.stream() + .map(t -> fetchValuesOfDelinquencyPausePeriods(table.row(0), t)).collect(Collectors.toList()); + + boolean containsExpectedValues = actualValuesList.stream().anyMatch(actualValues -> actualValues.equals(expectedValuesList)); + assertThat(containsExpectedValues) + .as(ErrorMessageHelper.wrongValueInLineInDelinquencyPausePeriodData(i, actualValuesList, expectedValuesList)).isTrue(); + } + } + + @Then("Loan details delinquent.nextPaymentDueDate will be {string}") + public void nextPaymentDueDateCheck(String expectedDate) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Response loanDetails = loansApi.retrieveLoan(loanId, false, "", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetails); + String actualDate = FORMATTER.format(loanDetails.body().getDelinquent().getNextPaymentDueDate()); + + assertThat(actualDate).as(ErrorMessageHelper.wrongDataInNextPaymentDueDate(actualDate, expectedDate)).isEqualTo(expectedDate); + } + + @Then("LoanAccountDelinquencyRangeDataV1 has delinquencyRange field with value {string}") + public void checkDelinquencyRangeInEvent(String expectedRange) { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + DelinquencyRange expectedDelinquencyRange = DelinquencyRange.valueOf(expectedRange); + String expectedDelinquencyRangeValue = expectedDelinquencyRange.getValue(); + + eventAssertion.assertEvent(LoanDelinquencyRangeChangeEvent.class, loanId)// + .extractingData(loanAccountDelinquencyRangeDataV1 -> { // + String actualDelinquencyRangeValue = loanAccountDelinquencyRangeDataV1.getDelinquencyRange().getClassification();// + assertThat(actualDelinquencyRangeValue)// + .as(ErrorMessageHelper.delinquencyRangeError(actualDelinquencyRangeValue, expectedDelinquencyRangeValue))// + .isEqualTo(expectedDelinquencyRangeValue);// + return null; + }); + } + + @Then("LoanDelinquencyRangeChangeBusinessEvent has the same Delinquency range, date and amount as in LoanDetails on both loan- and installment-level") + public void checkDelinquencyRangeInEvent() throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Response loanDetails = loansApi.retrieveLoan(loanId, false, "", "", "").execute(); + GetDelinquencyRangesResponse delinquencyRange = loanDetails.body().getDelinquencyRange(); + GetLoansLoanIdDelinquencySummary delinquent = loanDetails.body().getDelinquent(); + + eventAssertion.assertEvent(LoanDelinquencyRangeChangeEvent.class, loanId)// + .extractingData(loanAccountDelinquencyRangeDataV1 -> { // + Long loanLevelDelinquencyRangeId = loanAccountDelinquencyRangeDataV1.getDelinquencyRange().getId(); + String loanLevelDelinquencyRange = loanAccountDelinquencyRangeDataV1.getDelinquencyRange().getClassification(); + String loanLevelDelinquentDate = loanAccountDelinquencyRangeDataV1.getDelinquentDate(); + BigDecimal loanLevelTotalAmount = loanAccountDelinquencyRangeDataV1.getAmount().getTotalAmount(); + + Long loanLevelDelinquencyRangeIdExpected = delinquencyRange.getId(); + String loanLevelDelinquencyRangeExpected = delinquencyRange.getClassification(); + String loanLevelDelinquentDateExpected = FORMATTER.format(delinquent.getDelinquentDate()); + BigDecimal loanLevelTotalAmountExpected = new BigDecimal(delinquent.getDelinquentAmount()); + + assertThat(loanLevelDelinquencyRangeId)// + .as(ErrorMessageHelper.wrongValueInLoanDelinquencyRangeChangeBusinessEvent4(loanLevelDelinquencyRangeId, + loanLevelDelinquencyRangeIdExpected))// + .isEqualTo(loanLevelDelinquencyRangeIdExpected);// + assertThat(loanLevelDelinquencyRange)// + .as(ErrorMessageHelper.wrongValueInLoanDelinquencyRangeChangeBusinessEvent5(loanLevelDelinquencyRange, + loanLevelDelinquencyRangeExpected))// + .isEqualTo(loanLevelDelinquencyRangeExpected);// + assertThat(loanLevelDelinquentDate)// + .as(ErrorMessageHelper.wrongValueInLoanDelinquencyRangeChangeBusinessEvent7(loanLevelDelinquentDate, + loanLevelDelinquentDateExpected))// + .isEqualTo(loanLevelDelinquentDateExpected);// + assertThat(loanLevelTotalAmount)// + .as(ErrorMessageHelper.wrongValueInLoanDelinquencyRangeChangeBusinessEvent6(loanLevelTotalAmount, + loanLevelTotalAmountExpected))// + .isEqualTo(loanLevelTotalAmountExpected);// + + List installmentLevelDelinquencyBucketsExpected = delinquent + .getInstallmentLevelDelinquency(); + List installmentDelinquencyBuckets = loanAccountDelinquencyRangeDataV1 + .getInstallmentDelinquencyBuckets(); + for (int i = 0; i < installmentDelinquencyBuckets.size(); i++) { + Long installmentLevelDelinquencyRangeId = installmentDelinquencyBuckets.get(i).getDelinquencyRange().getId(); + String installmentLevelDelinquencyRange = installmentDelinquencyBuckets.get(i).getDelinquencyRange() + .getClassification(); + BigDecimal installmentLevelTotalAmount = installmentDelinquencyBuckets.get(i).getAmount().getTotalAmount(); + + Long installmentLevelDelinquencyRangeIdExpected = installmentLevelDelinquencyBucketsExpected.get(i).getRangeId(); + String installmentLevelDelinquencyRangeExpected = installmentLevelDelinquencyBucketsExpected.get(i) + .getClassification(); + BigDecimal installmentLevelTotalAmountExpected = installmentLevelDelinquencyBucketsExpected.get(i) + .getDelinquentAmount(); + + assertThat(installmentLevelDelinquencyRangeId)// + .as(ErrorMessageHelper.wrongValueInLoanDelinquencyRangeChangeBusinessEvent1( + installmentLevelDelinquencyRangeId, installmentLevelDelinquencyRangeIdExpected))// + .isEqualTo(installmentLevelDelinquencyRangeIdExpected);// + assertThat(installmentLevelDelinquencyRange)// + .as(ErrorMessageHelper.wrongValueInLoanDelinquencyRangeChangeBusinessEvent2( + installmentLevelDelinquencyRange, installmentLevelDelinquencyRangeExpected))// + .isEqualTo(installmentLevelDelinquencyRangeExpected);// + assertThat(installmentLevelTotalAmount)// + .as(ErrorMessageHelper.wrongValueInLoanDelinquencyRangeChangeBusinessEvent3(installmentLevelTotalAmount, + installmentLevelTotalAmountExpected))// + .isEqualTo(installmentLevelTotalAmountExpected);// + } + return null; + }); + } + + @Then("In Loan details delinquent.lastRepaymentAmount is {int} EUR with lastRepaymentDate {string}") + public void delinquentLastRepaymentAmountCheck(int expectedLastRepaymentAmount, String expectedLastRepaymentDate) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Response loanDetails = loansApi.retrieveLoan(loanId, false, "", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetails); + + Double expectedLastRepaymentAmount1 = Double.valueOf(expectedLastRepaymentAmount); + Double actualLastRepaymentAmount = loanDetails.body().getDelinquent().getLastRepaymentAmount(); + String actualLastRepaymentDate = FORMATTER.format(loanDetails.body().getDelinquent().getLastRepaymentDate()); + + assertThat(actualLastRepaymentAmount)// + .as(ErrorMessageHelper.wrongDataInDelinquentLastRepaymentAmount(actualLastRepaymentAmount, expectedLastRepaymentAmount1))// + .isEqualTo(expectedLastRepaymentAmount);// + assertThat(actualLastRepaymentDate)// + .as(ErrorMessageHelper.wrongDataInDelinquentLastRepaymentDate(actualLastRepaymentDate, expectedLastRepaymentDate))// + .isEqualTo(expectedLastRepaymentDate);// + + log.info("loanDetails.delinquent.lastRepaymentAmount: {}", actualLastRepaymentAmount); + log.info("loanDetails.delinquent.lastRepaymentDate: {}", actualLastRepaymentDate); + } + + @SuppressFBWarnings("SF_SWITCH_NO_DEFAULT") + private List fetchValuesOfDelinquencyPausePeriods(List header, GetLoansLoanIdDelinquencyPausePeriod t) { + List actualValues = new ArrayList<>(); + for (String headerName : header) { + switch (headerName) { + case "active" -> actualValues.add(t.getActive() == null ? null : t.getActive().toString()); + case "pausePeriodStart" -> + actualValues.add(t.getPausePeriodStart() == null ? null : FORMATTER.format(t.getPausePeriodStart())); + case "pausePeriodEnd" -> actualValues.add(t.getPausePeriodEnd() == null ? null : FORMATTER.format(t.getPausePeriodEnd())); + } + } + return actualValues; + } + + private void errorMessageAssertation(Response response, int errorCodeExpected, + String errorMessageExpected) throws IOException { + String errorToString = response.errorBody().string(); + ErrorResponse errorResponse = GSON.fromJson(errorToString, ErrorResponse.class); + String errorMessageActual = errorResponse.getErrors().get(0).getDeveloperMessage(); + int errorCodeActual = response.code(); + + assertThat(errorCodeActual).as(ErrorMessageHelper.wrongErrorCode(errorCodeActual, errorCodeExpected)).isEqualTo(errorCodeExpected); + assertThat(errorMessageActual).as(ErrorMessageHelper.wrongErrorMessage(errorMessageActual, errorMessageExpected)) + .isEqualTo(errorMessageExpected); + + log.info("ERROR CODE: {}", errorCodeActual); + log.info("ERROR MESSAGE: {}", errorMessageActual); + } + + @Then("LoanDelinquencyRangeChangeBusinessEvent is created") + public void checkLoanDelinquencyRangeChangeBusinessEventCreated() { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + eventAssertion.assertEventRaised(LoanDelinquencyRangeChangeEvent.class, loanId); + } +} diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanReAgingStepDef.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanReAgingStepDef.java new file mode 100644 index 00000000000..5f2f0a7e96a --- /dev/null +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanReAgingStepDef.java @@ -0,0 +1,107 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.test.stepdef.loan; + +import io.cucumber.datatable.DataTable; +import io.cucumber.java.en.Then; +import io.cucumber.java.en.When; +import java.io.IOException; +import java.util.List; +import lombok.extern.slf4j.Slf4j; +import org.apache.fineract.client.models.PostLoansLoanIdTransactionsRequest; +import org.apache.fineract.client.models.PostLoansLoanIdTransactionsResponse; +import org.apache.fineract.client.models.PostLoansResponse; +import org.apache.fineract.client.services.LoanTransactionsApi; +import org.apache.fineract.test.factory.LoanRequestFactory; +import org.apache.fineract.test.helper.ErrorHelper; +import org.apache.fineract.test.messaging.EventAssertion; +import org.apache.fineract.test.messaging.event.loan.LoanReAgeEvent; +import org.apache.fineract.test.stepdef.AbstractStepDef; +import org.apache.fineract.test.support.TestContextKey; +import org.springframework.beans.factory.annotation.Autowired; +import retrofit2.Response; + +@Slf4j +public class LoanReAgingStepDef extends AbstractStepDef { + + @Autowired + private LoanTransactionsApi loanTransactionsApi; + + @Autowired + private EventAssertion eventAssertion; + + @When("Admin creates a Loan re-aging transaction with the following data:") + public void createReAgingTransaction(DataTable table) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + List data = table.asLists().get(1); + int frequencyNumber = Integer.parseInt(data.get(0)); + String frequencyType = data.get(1); + String startDate = data.get(2); + int numberOfInstallments = Integer.parseInt(data.get(3)); + + PostLoansLoanIdTransactionsRequest reAgingRequest = LoanRequestFactory.defaultReAgingRequest().frequencyNumber(frequencyNumber) + .frequencyType(frequencyType).startDate(startDate).numberOfInstallments(numberOfInstallments); + + Response response = loanTransactionsApi.executeLoanTransaction(loanId, reAgingRequest, "reAge") + .execute(); + ErrorHelper.checkSuccessfulApiCall(response); + testContext().set(TestContextKey.LOAN_REAGING_RESPONSE, response); + } + + @When("Admin creates a Loan re-aging transaction by Loan external ID with the following data:") + public void createReAgingTransactionByLoanExternalId(DataTable table) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + String loanExternalId = loanResponse.body().getResourceExternalId(); + + List data = table.asLists().get(1); + int frequencyNumber = Integer.parseInt(data.get(0)); + String frequencyType = data.get(1); + String startDate = data.get(2); + int numberOfInstallments = Integer.parseInt(data.get(3)); + + PostLoansLoanIdTransactionsRequest reAgingRequest = LoanRequestFactory.defaultReAgingRequest().frequencyNumber(frequencyNumber) + .frequencyType(frequencyType).startDate(startDate).numberOfInstallments(numberOfInstallments); + + Response response = loanTransactionsApi + .executeLoanTransaction1(loanExternalId, reAgingRequest, "reAge").execute(); + ErrorHelper.checkSuccessfulApiCall(response); + testContext().set(TestContextKey.LOAN_REAGING_RESPONSE, response); + } + + @When("Admin successfully undo Loan re-aging transaction") + public void undoReAgingTransaction() throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Response response = loanTransactionsApi + .executeLoanTransaction(loanId, new PostLoansLoanIdTransactionsRequest(), "undoReAge").execute(); + ErrorHelper.checkSuccessfulApiCall(response); + testContext().set(TestContextKey.LOAN_REAGING_UNDO_RESPONSE, response); + } + + @Then("LoanReAgeBusinessEvent is created") + public void checkLoanReAmortizeBusinessEventCreated() { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + eventAssertion.assertEventRaised(LoanReAgeEvent.class, loanId); + } +} diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanReAmortizationStepDef.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanReAmortizationStepDef.java new file mode 100644 index 00000000000..96428b6c572 --- /dev/null +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanReAmortizationStepDef.java @@ -0,0 +1,89 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.test.stepdef.loan; + +import io.cucumber.java.en.Then; +import io.cucumber.java.en.When; +import java.io.IOException; +import org.apache.fineract.client.models.PostLoansLoanIdTransactionsRequest; +import org.apache.fineract.client.models.PostLoansLoanIdTransactionsResponse; +import org.apache.fineract.client.models.PostLoansResponse; +import org.apache.fineract.client.services.LoanTransactionsApi; +import org.apache.fineract.test.factory.LoanRequestFactory; +import org.apache.fineract.test.helper.ErrorHelper; +import org.apache.fineract.test.messaging.EventAssertion; +import org.apache.fineract.test.messaging.event.loan.LoanReAmortizeEvent; +import org.apache.fineract.test.stepdef.AbstractStepDef; +import org.apache.fineract.test.support.TestContextKey; +import org.springframework.beans.factory.annotation.Autowired; +import retrofit2.Response; + +public class LoanReAmortizationStepDef extends AbstractStepDef { + + @Autowired + private LoanTransactionsApi loanTransactionsApi; + + @Autowired + private EventAssertion eventAssertion; + + @When("When Admin creates a Loan re-amortization transaction on current business date") + public void createLoanReAmortization() throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + PostLoansLoanIdTransactionsRequest reAmortizationRequest = LoanRequestFactory.defaultLoanReAmortizationRequest(); + + Response response = loanTransactionsApi + .executeLoanTransaction(loanId, reAmortizationRequest, "reAmortize").execute(); + ErrorHelper.checkSuccessfulApiCall(response); + testContext().set(TestContextKey.LOAN_REAMORTIZATION_RESPONSE, response); + } + + @When("When Admin creates a Loan re-amortization transaction on current business date by loan external ID") + public void createLoanReAmortizationByLoanExternalId() throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + String loanExternalId = loanResponse.body().getResourceExternalId(); + + PostLoansLoanIdTransactionsRequest reAmortizationRequest = LoanRequestFactory.defaultLoanReAmortizationRequest(); + + Response response = loanTransactionsApi + .executeLoanTransaction1(loanExternalId, reAmortizationRequest, "reAmortize").execute(); + ErrorHelper.checkSuccessfulApiCall(response); + testContext().set(TestContextKey.LOAN_REAMORTIZATION_RESPONSE, response); + } + + @When("When Admin undo Loan re-amortization transaction on current business date") + public void undoLoanReAmortization() throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Response response = loanTransactionsApi + .executeLoanTransaction(loanId, new PostLoansLoanIdTransactionsRequest(), "undoReAmortize").execute(); + ErrorHelper.checkSuccessfulApiCall(response); + testContext().set(TestContextKey.LOAN_REAMORTIZATION_UNDO_RESPONSE, response); + } + + @Then("LoanReAmortizeBusinessEvent is created") + public void checkLoanReAmortizeBusinessEventCreated() { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + eventAssertion.assertEventRaised(LoanReAmortizeEvent.class, loanId); + } +} diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanRepaymentStepDef.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanRepaymentStepDef.java new file mode 100644 index 00000000000..8473d17f4d1 --- /dev/null +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanRepaymentStepDef.java @@ -0,0 +1,564 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.test.stepdef.loan; + +import static org.apache.fineract.test.data.paymenttype.DefaultPaymentType.AUTOPAY; +import static org.assertj.core.api.Assertions.assertThat; + +import io.cucumber.java.en.And; +import io.cucumber.java.en.Then; +import io.cucumber.java.en.When; +import java.io.IOException; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.nio.charset.StandardCharsets; +import java.time.format.DateTimeFormatter; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import org.apache.commons.codec.binary.Base64; +import org.apache.fineract.avro.loan.v1.LoanTransactionAdjustmentDataV1; +import org.apache.fineract.avro.loan.v1.LoanTransactionDataV1; +import org.apache.fineract.client.models.GetLoansLoanIdRepaymentPeriod; +import org.apache.fineract.client.models.GetLoansLoanIdResponse; +import org.apache.fineract.client.models.GetLoansLoanIdTransactions; +import org.apache.fineract.client.models.GetLoansLoanIdTransactionsTransactionIdResponse; +import org.apache.fineract.client.models.GetUsersUserIdResponse; +import org.apache.fineract.client.models.PostLoansLoanIdTransactionsRequest; +import org.apache.fineract.client.models.PostLoansLoanIdTransactionsResponse; +import org.apache.fineract.client.models.PostLoansLoanIdTransactionsTransactionIdRequest; +import org.apache.fineract.client.models.PostLoansResponse; +import org.apache.fineract.client.models.PostUsersResponse; +import org.apache.fineract.client.services.LoanTransactionsApi; +import org.apache.fineract.client.services.LoansApi; +import org.apache.fineract.client.services.UsersApi; +import org.apache.fineract.test.api.ApiProperties; +import org.apache.fineract.test.data.TransactionType; +import org.apache.fineract.test.data.paymenttype.DefaultPaymentType; +import org.apache.fineract.test.data.paymenttype.PaymentTypeResolver; +import org.apache.fineract.test.factory.LoanRequestFactory; +import org.apache.fineract.test.helper.ErrorHelper; +import org.apache.fineract.test.helper.ErrorMessageHelper; +import org.apache.fineract.test.helper.ErrorResponse; +import org.apache.fineract.test.messaging.EventAssertion; +import org.apache.fineract.test.messaging.event.EventCheckHelper; +import org.apache.fineract.test.messaging.event.loan.LoanBalanceChangedEvent; +import org.apache.fineract.test.messaging.event.loan.transaction.LoanAdjustTransactionBusinessEvent; +import org.apache.fineract.test.stepdef.AbstractStepDef; +import org.apache.fineract.test.support.TestContextKey; +import org.springframework.beans.factory.annotation.Autowired; +import retrofit2.Response; + +public class LoanRepaymentStepDef extends AbstractStepDef { + + public static final String DATE_FORMAT = "dd MMMM yyyy"; + public static final String DEFAULT_LOCALE = "en"; + public static final String DEFAULT_ACCOUNT_NB = "1234567890"; + public static final String DEFAULT_CHECK_NB = "1234567890"; + public static final String DEFAULT_RECEIPT_NB = "1234567890"; + public static final String DEFAULT_BANK_NB = "1234567890"; + @Autowired + private LoanTransactionsApi loanTransactionsApi; + + @Autowired + private LoansApi loansApi; + + @Autowired + private EventAssertion eventAssertion; + + @Autowired + private ApiProperties apiProperties; + + @Autowired + private UsersApi usersApi; + + @Autowired + private PaymentTypeResolver paymentTypeResolver; + + @Autowired + private EventCheckHelper eventCheckHelper; + + @And("Customer makes {string} repayment on {string} with {double} EUR transaction amount") + public void makeLoanRepayment(String repaymentType, String transactionDate, double transactionAmount) throws IOException { + makeRepayment(repaymentType, transactionDate, transactionAmount, null); + } + + @And("Customer makes {string} repayment on {string} with {double} EUR transaction amount and check external owner") + public void makeLoanRepaymentAndCheckOwner(String repaymentType, String transactionDate, double transactionAmount) throws IOException { + String transferExternalOwnerId = testContext().get(TestContextKey.ASSET_EXTERNALIZATION_OWNER_EXTERNAL_ID); + makeRepayment(repaymentType, transactionDate, transactionAmount, transferExternalOwnerId); + } + + private void makeRepayment(String repaymentType, String transactionDate, double transactionAmount, String transferExternalOwnerId) + throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + DefaultPaymentType paymentType = DefaultPaymentType.valueOf(repaymentType); + long paymentTypeValue = paymentTypeResolver.resolve(paymentType); + + PostLoansLoanIdTransactionsRequest repaymentRequest = LoanRequestFactory.defaultRepaymentRequest().transactionDate(transactionDate) + .transactionAmount(transactionAmount).paymentTypeId(paymentTypeValue).dateFormat(DATE_FORMAT).locale(DEFAULT_LOCALE); + + Map headerMap = new HashMap<>(); + String idempotencyKey = UUID.randomUUID().toString(); + testContext().set(TestContextKey.TRANSACTION_IDEMPOTENCY_KEY, idempotencyKey); + headerMap.put("Idempotency-Key", idempotencyKey); + + Response repaymentResponse = loanTransactionsApi + .executeLoanTransaction(loanId, repaymentRequest, "repayment", headerMap).execute(); + testContext().set(TestContextKey.LOAN_REPAYMENT_RESPONSE, repaymentResponse); + ErrorHelper.checkSuccessfulApiCall(repaymentResponse); + EventAssertion.EventAssertionBuilder transactionEvent = eventCheckHelper + .transactionEventCheck(repaymentResponse, TransactionType.REPAYMENT, transferExternalOwnerId); + testContext().set(TestContextKey.TRANSACTION_EVENT, transactionEvent); + eventAssertion.assertEventRaised(LoanBalanceChangedEvent.class, loanId); + } + + @And("Created user makes {string} repayment on {string} with {double} EUR transaction amount") + public void makeRepaymentWithGivenUser(String repaymentType, String transactionDate, double transactionAmount) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + DefaultPaymentType paymentType = DefaultPaymentType.valueOf(repaymentType); + Long paymentTypeValue = paymentTypeResolver.resolve(paymentType); + + PostLoansLoanIdTransactionsRequest repaymentRequest = LoanRequestFactory.defaultRepaymentRequest().transactionDate(transactionDate) + .transactionAmount(transactionAmount).paymentTypeId(paymentTypeValue).dateFormat(DATE_FORMAT).locale(DEFAULT_LOCALE); + + Map headerMap = new HashMap<>(); + String idempotencyKey = UUID.randomUUID().toString(); + testContext().set(TestContextKey.TRANSACTION_IDEMPOTENCY_KEY, idempotencyKey); + headerMap.put("Idempotency-Key", idempotencyKey); + + Response createUserResponse = testContext().get(TestContextKey.CREATED_SIMPLE_USER_RESPONSE); + Long createdUserId = createUserResponse.body().getResourceId(); + Response user = usersApi.retrieveOne31(createdUserId).execute(); + ErrorHelper.checkSuccessfulApiCall(user); + String authorizationString = user.body().getUsername() + ":" + apiProperties.getPassword(); + Base64 base64 = new Base64(); + headerMap.put("Authorization", + "Basic " + new String(base64.encode(authorizationString.getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8)); + + Response repaymentResponse = loanTransactionsApi + .executeLoanTransaction(loanId, repaymentRequest, "repayment", headerMap).execute(); + testContext().set(TestContextKey.LOAN_REPAYMENT_RESPONSE, repaymentResponse); + ErrorHelper.checkSuccessfulApiCall(repaymentResponse); + eventAssertion.assertEventRaised(LoanBalanceChangedEvent.class, loanId); + } + + @And("Customer makes externalID controlled {string} repayment on {string} with {double} EUR transaction amount") + public void makeRepaymentByExternalId(String repaymentType, String transactionDate, double transactionAmount) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + String resourceExternalId = loanResponse.body().getResourceExternalId(); + + DefaultPaymentType paymentType = DefaultPaymentType.valueOf(repaymentType); + Long paymentTypeValue = paymentTypeResolver.resolve(paymentType); + + PostLoansLoanIdTransactionsRequest repaymentRequest = LoanRequestFactory.defaultRepaymentRequest().transactionDate(transactionDate) + .transactionAmount(transactionAmount).paymentTypeId(paymentTypeValue).dateFormat(DATE_FORMAT).locale(DEFAULT_LOCALE); + + Map headerMap = new HashMap<>(); + String idempotencyKey = UUID.randomUUID().toString(); + testContext().set(TestContextKey.TRANSACTION_IDEMPOTENCY_KEY, idempotencyKey); + headerMap.put("Idempotency-Key", idempotencyKey); + + Response repaymentResponse = loanTransactionsApi + .executeLoanTransaction1(resourceExternalId, repaymentRequest, "repayment", headerMap).execute(); + + testContext().set(TestContextKey.LOAN_REPAYMENT_RESPONSE, repaymentResponse); + ErrorHelper.checkSuccessfulApiCall(repaymentResponse); + eventAssertion.assertEventRaised(LoanBalanceChangedEvent.class, loanId); + } + + @And("Created user makes externalID controlled {string} repayment on {string} with {double} EUR transaction amount") + public void makeRepaymentWithGivenUserByExternalId(String repaymentType, String transactionDate, double transactionAmount) + throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + String resourceExternalId = loanResponse.body().getResourceExternalId(); + + DefaultPaymentType paymentType = DefaultPaymentType.valueOf(repaymentType); + Long paymentTypeValue = paymentTypeResolver.resolve(paymentType); + + PostLoansLoanIdTransactionsRequest repaymentRequest = LoanRequestFactory.defaultRepaymentRequest().transactionDate(transactionDate) + .transactionAmount(transactionAmount).paymentTypeId(paymentTypeValue).dateFormat(DATE_FORMAT).locale(DEFAULT_LOCALE); + + Map headerMap = new HashMap<>(); + String idempotencyKey = UUID.randomUUID().toString(); + testContext().set(TestContextKey.TRANSACTION_IDEMPOTENCY_KEY, idempotencyKey); + headerMap.put("Idempotency-Key", idempotencyKey); + + Response createUserResponse = testContext().get(TestContextKey.CREATED_SIMPLE_USER_RESPONSE); + Long createdUserId = createUserResponse.body().getResourceId(); + Response user = usersApi.retrieveOne31(createdUserId).execute(); + ErrorHelper.checkSuccessfulApiCall(user); + String authorizationString = user.body().getUsername() + ":" + apiProperties.getPassword(); + Base64 base64 = new Base64(); + headerMap.put("Authorization", + "Basic " + new String(base64.encode(authorizationString.getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8)); + + Response repaymentResponse = loanTransactionsApi + .executeLoanTransaction1(resourceExternalId, repaymentRequest, "repayment", headerMap).execute(); + testContext().set(TestContextKey.LOAN_REPAYMENT_RESPONSE, repaymentResponse); + ErrorHelper.checkSuccessfulApiCall(repaymentResponse); + eventAssertion.assertEventRaised(LoanBalanceChangedEvent.class, loanId); + } + + @And("Customer not able to make {string} repayment on {string} with {double} EUR transaction amount") + public void makeLoanRepaymentFails(String repaymentType, String transactionDate, double transactionAmount) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + DefaultPaymentType paymentType = DefaultPaymentType.valueOf(repaymentType); + Long paymentTypeValue = paymentTypeResolver.resolve(paymentType); + + PostLoansLoanIdTransactionsRequest repaymentRequest = LoanRequestFactory.defaultRepaymentRequest().transactionDate(transactionDate) + .transactionAmount(transactionAmount).paymentTypeId(paymentTypeValue).dateFormat(DATE_FORMAT).locale(DEFAULT_LOCALE); + + Response repaymentResponse = loanTransactionsApi + .executeLoanTransaction(loanId, repaymentRequest, "repayment").execute(); + ErrorResponse errorDetails = ErrorResponse.from(repaymentResponse); + assertThat(errorDetails.getHttpStatusCode()).as(ErrorMessageHelper.dateFailureErrorCodeMsg()).isEqualTo(400); + assertThat(errorDetails.getSingleError().getDeveloperMessage()).isEqualTo(ErrorMessageHelper.loanRepaymentOnClosedLoanFailureMsg()); + } + + @Then("Customer not able to make a repayment undo on {string} due to charge off") + public void makeLoanRepaymentUndoAfterChargeOff(String transactionDate) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + Response transactionResponse = testContext().get(TestContextKey.LOAN_REPAYMENT_RESPONSE); + Long loanId = loanResponse.body().getLoanId(); + Long transactionId = transactionResponse.body().getResourceId(); + + Response repaymentResponse = testContext().get(TestContextKey.LOAN_REPAYMENT_RESPONSE); + + PostLoansLoanIdTransactionsTransactionIdRequest repaymentUndoRequest = LoanRequestFactory.defaultRepaymentUndoRequest() + .transactionDate(transactionDate).dateFormat(DATE_FORMAT).locale(DEFAULT_LOCALE); + + Response repaymentUndoResponse = loanTransactionsApi + .adjustLoanTransaction(loanId, repaymentResponse.body().getResourceId(), repaymentUndoRequest, "").execute(); + ErrorResponse errorDetails = ErrorResponse.from(repaymentUndoResponse); + assertThat(errorDetails.getHttpStatusCode()).as(ErrorMessageHelper.repaymentUndoFailureDueToChargeOffCodeMsg()).isEqualTo(403); + assertThat(errorDetails.getSingleError().getDeveloperMessage()) + .isEqualTo(ErrorMessageHelper.repaymentUndoFailureDueToChargeOff(transactionId)); + } + + @And("Customer makes {string} repayment on {string} with {double} EUR transaction amount \\(and transaction fails because of wrong date)") + public void makeLoanRepaymentWithWrongDate(String repaymentType, String transactionDate, double transactionAmount) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + DefaultPaymentType paymentType = DefaultPaymentType.valueOf(repaymentType); + Long paymentTypeValue = paymentTypeResolver.resolve(paymentType); + + PostLoansLoanIdTransactionsRequest repaymentRequest = LoanRequestFactory.defaultRepaymentRequest().transactionDate(transactionDate) + .transactionAmount(transactionAmount).paymentTypeId(paymentTypeValue).dateFormat(DATE_FORMAT).locale(DEFAULT_LOCALE); + + Response repaymentResponse = loanTransactionsApi + .executeLoanTransaction(loanId, repaymentRequest, "repayment").execute(); + testContext().set(TestContextKey.LOAN_REPAYMENT_RESPONSE, repaymentResponse); + } + + @When("Refund happens on {string} with {double} EUR transaction amount") + public void makeRefund(String transactionDate, double transactionAmount) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + PostLoansLoanIdTransactionsRequest refundRequest = LoanRequestFactory.defaultRefundRequest().transactionDate(transactionDate) + .transactionAmount(transactionAmount).paymentTypeId(paymentTypeResolver.resolve(AUTOPAY)).dateFormat(DATE_FORMAT) + .locale(DEFAULT_LOCALE).accountNumber(DEFAULT_ACCOUNT_NB).checkNumber(DEFAULT_CHECK_NB).receiptNumber(DEFAULT_RECEIPT_NB) + .bankNumber(DEFAULT_BANK_NB); + + Response refundResponse = loanTransactionsApi + .executeLoanTransaction(loanId, refundRequest, "payoutRefund").execute(); + ErrorHelper.checkSuccessfulApiCall(refundResponse); + testContext().set(TestContextKey.LOAN_REFUND_RESPONSE, refundResponse); + } + + @When("Refund undo happens on {string}") + public void makeRefundUndo(String transactionDate) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + Response refundResponse = testContext().get(TestContextKey.LOAN_REFUND_RESPONSE); + + PostLoansLoanIdTransactionsTransactionIdRequest refundUndoRequest = LoanRequestFactory.defaultRefundUndoRequest() + .transactionDate(transactionDate).dateFormat(DATE_FORMAT).locale(DEFAULT_LOCALE); + + Response refundUndoResponse = loanTransactionsApi + .adjustLoanTransaction(loanId, refundResponse.body().getResourceId(), refundUndoRequest, "").execute(); + ErrorHelper.checkSuccessfulApiCall(refundUndoResponse); + testContext().set(TestContextKey.LOAN_REPAYMENT_UNDO_RESPONSE, refundUndoResponse); + EventAssertion.EventAssertionBuilder eventAssertionBuilder = eventAssertion + .assertEvent(LoanAdjustTransactionBusinessEvent.class, refundResponse.body().getResourceId()); + eventAssertionBuilder + .extractingData(loanTransactionAdjustmentDataV1 -> loanTransactionAdjustmentDataV1.getTransactionToAdjust().getId()) + .isEqualTo(refundResponse.body().getResourceId()); + eventAssertionBuilder + .extractingData( + loanTransactionAdjustmentDataV1 -> loanTransactionAdjustmentDataV1.getTransactionToAdjust().getManuallyReversed()) + .isEqualTo(Boolean.TRUE); + eventAssertionBuilder.extractingData(LoanTransactionAdjustmentDataV1::getNewTransactionDetail).isEqualTo(null); + } + + @When("Customer makes a repayment undo on {string}") + public void makeLoanRepaymentUndo(String transactionDate) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + Response repaymentResponse = testContext().get(TestContextKey.LOAN_REPAYMENT_RESPONSE); + + PostLoansLoanIdTransactionsTransactionIdRequest repaymentUndoRequest = LoanRequestFactory.defaultRepaymentUndoRequest() + .transactionDate(transactionDate).dateFormat(DATE_FORMAT).locale(DEFAULT_LOCALE); + + Response repaymentUndoResponse = loanTransactionsApi + .adjustLoanTransaction(loanId, repaymentResponse.body().getResourceId(), repaymentUndoRequest, "").execute(); + ErrorHelper.checkSuccessfulApiCall(repaymentUndoResponse); + testContext().set(TestContextKey.LOAN_REPAYMENT_UNDO_RESPONSE, repaymentUndoResponse); + EventAssertion.EventAssertionBuilder eventAssertionBuilder = eventAssertion + .assertEvent(LoanAdjustTransactionBusinessEvent.class, repaymentResponse.body().getResourceId()); + eventAssertionBuilder + .extractingData(loanTransactionAdjustmentDataV1 -> loanTransactionAdjustmentDataV1.getTransactionToAdjust().getId()) + .isEqualTo(repaymentResponse.body().getResourceId()); + eventAssertionBuilder + .extractingData( + loanTransactionAdjustmentDataV1 -> loanTransactionAdjustmentDataV1.getTransactionToAdjust().getManuallyReversed()) + .isEqualTo(Boolean.TRUE); + eventAssertionBuilder.extractingData(LoanTransactionAdjustmentDataV1::getNewTransactionDetail).isEqualTo(null); + } + + @Then("Loan {string} transaction adjust amount {double} must return {int} code") + public void makeLoanRepaymentAdjustFail(String transactionType, double transactionAmount, int codeExpected) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + Response repaymentResponse = testContext().get(transactionType); + + PostLoansLoanIdTransactionsTransactionIdRequest repaymentUndoRequest = LoanRequestFactory.defaultRepaymentUndoRequest() + .transactionAmount(transactionAmount); + + Response repaymentUndoResponse = loanTransactionsApi + .adjustLoanTransaction(loanId, repaymentResponse.body().getResourceId(), repaymentUndoRequest, "").execute(); + assertThat(repaymentUndoResponse.code()).isEqualTo(codeExpected); + } + + @When("Customer undo {string}th repayment on {string}") + public void undoNthRepayment(String nthItemStr, String transactionDate) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + List transactions = loansApi.retrieveLoan(loanId, false, "transactions", "", "").execute().body() + .getTransactions(); + + int nthItem = Integer.parseInt(nthItemStr) - 1; + GetLoansLoanIdTransactions targetTransaction = transactions.stream().filter(t -> Boolean.TRUE.equals(t.getType().getRepayment())) + .toList().get(nthItem); + + PostLoansLoanIdTransactionsTransactionIdRequest repaymentUndoRequest = LoanRequestFactory.defaultRepaymentUndoRequest() + .transactionDate(transactionDate).dateFormat(DATE_FORMAT).locale(DEFAULT_LOCALE); + + Response repaymentUndoResponse = loanTransactionsApi + .adjustLoanTransaction(loanId, targetTransaction.getId(), repaymentUndoRequest, "").execute(); + ErrorHelper.checkSuccessfulApiCall(repaymentUndoResponse); + testContext().set(TestContextKey.LOAN_REPAYMENT_UNDO_RESPONSE, repaymentUndoResponse); + EventAssertion.EventAssertionBuilder eventAssertionBuilder = eventAssertion + .assertEvent(LoanAdjustTransactionBusinessEvent.class, targetTransaction.getId()); + eventAssertionBuilder + .extractingData(loanTransactionAdjustmentDataV1 -> loanTransactionAdjustmentDataV1.getTransactionToAdjust().getId()) + .isEqualTo(targetTransaction.getId()); + eventAssertionBuilder + .extractingData( + loanTransactionAdjustmentDataV1 -> loanTransactionAdjustmentDataV1.getTransactionToAdjust().getManuallyReversed()) + .isEqualTo(Boolean.TRUE); + eventAssertionBuilder.extractingData(LoanTransactionAdjustmentDataV1::getNewTransactionDetail).isEqualTo(null); + } + + @When("Customer undo {string}th transaction made on {string}") + public void undoNthTransaction(String nthItemStr, String transactionDate) throws IOException { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DATE_FORMAT); + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + List transactions = loansApi.retrieveLoan(loanId, false, "transactions", "", "").execute().body() + .getTransactions(); + + int nthItem = Integer.parseInt(nthItemStr) - 1; + GetLoansLoanIdTransactions targetTransaction = transactions.stream() + .filter(t -> transactionDate.equals(formatter.format(t.getDate()))).toList().get(nthItem); + + PostLoansLoanIdTransactionsTransactionIdRequest transactionUndoRequest = LoanRequestFactory.defaultTransactionUndoRequest() + .transactionDate(transactionDate); + + Response transactionUndoResponse = loanTransactionsApi + .adjustLoanTransaction(loanId, targetTransaction.getId(), transactionUndoRequest, "").execute(); + ErrorHelper.checkSuccessfulApiCall(transactionUndoResponse); + testContext().set(TestContextKey.LOAN_TRANSACTION_UNDO_RESPONSE, transactionUndoResponse); + EventAssertion.EventAssertionBuilder eventAssertionBuilder = eventAssertion + .assertEvent(LoanAdjustTransactionBusinessEvent.class, targetTransaction.getId()); + eventAssertionBuilder + .extractingData(loanTransactionAdjustmentDataV1 -> loanTransactionAdjustmentDataV1.getTransactionToAdjust().getId()) + .isEqualTo(targetTransaction.getId()); + eventAssertionBuilder + .extractingData( + loanTransactionAdjustmentDataV1 -> loanTransactionAdjustmentDataV1.getTransactionToAdjust().getManuallyReversed()) + .isEqualTo(Boolean.TRUE); + eventAssertionBuilder.extractingData(LoanTransactionAdjustmentDataV1::getNewTransactionDetail).isEqualTo(null); + } + + @When("Customer undo {string}th {string} transaction made on {string}") + public void undoNthTransactionType(String nthItemStr, String transactionType, String transactionDate) throws IOException { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DATE_FORMAT); + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + List transactions = loansApi.retrieveLoan(loanId, false, "transactions", "", "").execute().body() + .getTransactions(); + + int nthItem = Integer.parseInt(nthItemStr) - 1; + GetLoansLoanIdTransactions targetTransaction = transactions// + .stream()// + .filter(t -> transactionDate.equals(formatter.format(t.getDate())) && transactionType.equals(t.getType().getValue()))// + .toList()// + .get(nthItem);// + + PostLoansLoanIdTransactionsTransactionIdRequest transactionUndoRequest = LoanRequestFactory.defaultTransactionUndoRequest() + .transactionDate(transactionDate); + + Response transactionUndoResponse = loanTransactionsApi + .adjustLoanTransaction(loanId, targetTransaction.getId(), transactionUndoRequest, "").execute(); + ErrorHelper.checkSuccessfulApiCall(transactionUndoResponse); + testContext().set(TestContextKey.LOAN_TRANSACTION_UNDO_RESPONSE, transactionUndoResponse); + EventAssertion.EventAssertionBuilder eventAssertionBuilder = eventAssertion + .assertEvent(LoanAdjustTransactionBusinessEvent.class, targetTransaction.getId()); + eventAssertionBuilder + .extractingData(loanTransactionAdjustmentDataV1 -> loanTransactionAdjustmentDataV1.getTransactionToAdjust().getId()) + .isEqualTo(targetTransaction.getId()); + eventAssertionBuilder + .extractingData( + loanTransactionAdjustmentDataV1 -> loanTransactionAdjustmentDataV1.getTransactionToAdjust().getManuallyReversed()) + .isEqualTo(Boolean.TRUE); + eventAssertionBuilder.extractingData(LoanTransactionAdjustmentDataV1::getNewTransactionDetail).isEqualTo(null); + } + + @Then("Repayment transaction is created with {double} amount and {string} type") + public void loanRepaymentStatus(double repaymentAmount, String paymentType) throws IOException { + Response repaymentResponse = testContext().get(TestContextKey.LOAN_REPAYMENT_RESPONSE); + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + Response transactionResponse = loanTransactionsApi + .retrieveTransaction(loanId, repaymentResponse.body().getResourceId(), "").execute(); + ErrorHelper.checkSuccessfulApiCall(transactionResponse); + assertThat(transactionResponse.body().getAmount()).isEqualTo(repaymentAmount); + assertThat(transactionResponse.body().getPaymentDetailData().getPaymentType().getName()).isEqualTo(paymentType); + + } + + @Then("Repayment failed because the repayment date is after the business date") + public void repaymentDateFailure() { + Response response = testContext().get(TestContextKey.LOAN_REPAYMENT_RESPONSE); + + ErrorResponse errorDetails = ErrorResponse.from(response); + + assertThat(errorDetails.getHttpStatusCode()).as(ErrorMessageHelper.dateFailureErrorCodeMsg()).isEqualTo(403); + assertThat(errorDetails.getSingleError().getDeveloperMessage()).isEqualTo(ErrorMessageHelper.transactionDateInFutureFailureMsg()); + } + + @Then("Amounts are distributed equally in loan repayment schedule in case of total amount {double}") + public void amountsEquallyDistributedInSchedule(double totalAmount) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId1 = loanResponse.body().getLoanId(); + + Response getLoansLoanIdResponseCall = loansApi + .retrieveLoan(loanId1, false, "all", "guarantors,futureSchedule", "").execute(); + ErrorHelper.checkSuccessfulApiCall(getLoansLoanIdResponseCall); + + List periods = getLoansLoanIdResponseCall.body().getRepaymentSchedule().getPeriods(); + + BigDecimal expectedAmount = new BigDecimal(totalAmount / (periods.size() - 1)).setScale(0, RoundingMode.HALF_DOWN); + BigDecimal lastExpectedAmount = new BigDecimal(totalAmount).setScale(0, RoundingMode.HALF_DOWN); + + for (int i = 1; i < periods.size(); i++) { + BigDecimal actualAmount = new BigDecimal(periods.get(i).getPrincipalOriginalDue()).setScale(0, RoundingMode.HALF_DOWN); + + if (i == periods.size() - 1) { + assertThat(actualAmount.compareTo(lastExpectedAmount)) + .as(ErrorMessageHelper.wrongAmountInRepaymentSchedule(i, actualAmount, lastExpectedAmount)).isEqualTo(0); + } else { + assertThat(actualAmount.compareTo(expectedAmount)) + .as(ErrorMessageHelper.wrongAmountInRepaymentSchedule(i, actualAmount, expectedAmount)).isEqualTo(0); + lastExpectedAmount = lastExpectedAmount.subtract(actualAmount); + } + } + } + + @When("Customer adjust {string}th repayment on {string} with amount {string} and check external owner") + public void adjustNthRepaymentWithExternalOwner(String nthItemStr, String transactionDate, String amount) throws IOException { + String transferExternalOwnerId = testContext().get(TestContextKey.ASSET_EXTERNALIZATION_OWNER_EXTERNAL_ID); + adjustNthRepaymentWithExternalOwnerCheck(nthItemStr, transactionDate, amount, transferExternalOwnerId); + } + + @When("Customer adjust {string}th repayment on {string} with amount {string}") + public void adjustNthRepayment(String nthItemStr, String transactionDate, String amount) throws IOException { + adjustNthRepaymentWithExternalOwnerCheck(nthItemStr, transactionDate, amount, null); + } + + private void adjustNthRepaymentWithExternalOwnerCheck(String nthItemStr, String transactionDate, String amount, String externalOwnerId) + throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + List transactions = loansApi.retrieveLoan(loanId, false, "transactions", "", "").execute().body() + .getTransactions(); + + int nthItem = Integer.parseInt(nthItemStr) - 1; + GetLoansLoanIdTransactions targetTransaction = transactions.stream().filter(t -> Boolean.TRUE.equals(t.getType().getRepayment())) + .toList().get(nthItem); + double amountValue = Double.parseDouble(amount); + PostLoansLoanIdTransactionsTransactionIdRequest repaymentUndoRequest = LoanRequestFactory.defaultRepaymentAdjustRequest(amountValue) + .transactionDate(transactionDate).dateFormat(DATE_FORMAT).locale(DEFAULT_LOCALE); + + Response repaymentAdjustmentResponse = loanTransactionsApi + .adjustLoanTransaction(loanId, targetTransaction.getId(), repaymentUndoRequest, "").execute(); + ErrorHelper.checkSuccessfulApiCall(repaymentAdjustmentResponse); + testContext().set(TestContextKey.LOAN_REPAYMENT_UNDO_RESPONSE, repaymentAdjustmentResponse); + + EventAssertion.EventAssertionBuilder eventAssertionBuilder = eventAssertion + .assertEvent(LoanAdjustTransactionBusinessEvent.class, targetTransaction.getId()); + eventAssertionBuilder + .extractingData(loanTransactionAdjustmentDataV1 -> loanTransactionAdjustmentDataV1.getTransactionToAdjust().getId()) + .isEqualTo(targetTransaction.getId()); + eventAssertionBuilder.extractingData( + loanTransactionAdjustmentDataV1 -> loanTransactionAdjustmentDataV1.getTransactionToAdjust().getAmount().doubleValue()) + .isEqualTo(targetTransaction.getAmount()); + eventAssertionBuilder + .extractingData( + loanTransactionAdjustmentDataV1 -> loanTransactionAdjustmentDataV1.getTransactionToAdjust().getManuallyReversed()) + .isEqualTo(Boolean.TRUE); + eventAssertionBuilder + .extractingData( + loanTransactionAdjustmentDataV1 -> loanTransactionAdjustmentDataV1.getTransactionToAdjust().getExternalOwnerId()) + .isEqualTo(externalOwnerId); + if (amountValue > 0) { + eventAssertionBuilder + .extractingData(loanTransactionAdjustmentDataV1 -> loanTransactionAdjustmentDataV1.getNewTransactionDetail().getId()) + .isEqualTo(repaymentAdjustmentResponse.body().getResourceId()); + eventAssertionBuilder.extractingData( + loanTransactionAdjustmentDataV1 -> loanTransactionAdjustmentDataV1.getNewTransactionDetail().getAmount().doubleValue()) + .isEqualTo(amountValue); + eventAssertionBuilder.extractingData( + loanTransactionAdjustmentDataV1 -> loanTransactionAdjustmentDataV1.getNewTransactionDetail().getExternalOwnerId()) + .isEqualTo(externalOwnerId); + } + + } +} diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanRescheduleStepDef.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanRescheduleStepDef.java new file mode 100644 index 00000000000..a7145490320 --- /dev/null +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanRescheduleStepDef.java @@ -0,0 +1,144 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.test.stepdef.loan; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.google.gson.Gson; +import io.cucumber.datatable.DataTable; +import io.cucumber.java.en.Then; +import io.cucumber.java.en.When; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.List; +import lombok.extern.slf4j.Slf4j; +import org.apache.fineract.client.models.PostCreateRescheduleLoansRequest; +import org.apache.fineract.client.models.PostCreateRescheduleLoansResponse; +import org.apache.fineract.client.models.PostLoansResponse; +import org.apache.fineract.client.models.PostUpdateRescheduleLoansRequest; +import org.apache.fineract.client.models.PostUpdateRescheduleLoansResponse; +import org.apache.fineract.client.services.RescheduleLoansApi; +import org.apache.fineract.client.util.JSON; +import org.apache.fineract.test.data.LoanRescheduleErrorMessage; +import org.apache.fineract.test.helper.ErrorHelper; +import org.apache.fineract.test.helper.ErrorMessageHelper; +import org.apache.fineract.test.helper.ErrorResponse; +import org.apache.fineract.test.stepdef.AbstractStepDef; +import org.apache.fineract.test.support.TestContextKey; +import org.springframework.beans.factory.annotation.Autowired; +import retrofit2.Response; + +@Slf4j +public class LoanRescheduleStepDef extends AbstractStepDef { + + private static final Gson GSON = new JSON().getGson(); + + @Autowired + private RescheduleLoansApi rescheduleLoansApi; + + @When("Admin creates and approves Loan reschedule with the following data:") + public void createAndApproveLoanReschedule(DataTable table) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + List> data = table.asLists(); + List rescheduleData = data.get(1); + String rescheduleFromDate = rescheduleData.get(0); + String submittedOnDate = rescheduleData.get(1); + String adjustedDueDate = rescheduleData.get(2); + Integer graceOfPrincipal = Integer.parseInt(rescheduleData.get(3)) == 0 ? null : Integer.valueOf(rescheduleData.get(3)); + Integer graceOnInterest = Integer.parseInt(rescheduleData.get(4)) == 0 ? null : Integer.valueOf(rescheduleData.get(4)); + Integer extraTerms = Integer.parseInt(rescheduleData.get(5)) == 0 ? null : Integer.valueOf(rescheduleData.get(5)); + BigDecimal newInterestRate = new BigDecimal(rescheduleData.get(6)); + + PostCreateRescheduleLoansRequest request = new PostCreateRescheduleLoansRequest()// + .loanId(loanId)// + .rescheduleFromDate(rescheduleFromDate)// + .submittedOnDate(submittedOnDate)// + .adjustedDueDate(adjustedDueDate)// + .graceOnPrincipal(graceOfPrincipal)// + .graceOnInterest(graceOnInterest)// + .extraTerms(extraTerms)// + .newInterestRate(newInterestRate)// + .rescheduleReasonId(54L)// + .rescheduleReasonComment("")// + .dateFormat("dd MMMM yyyy")// + .locale("en");// + + Response createResponse = rescheduleLoansApi.createLoanRescheduleRequest(request).execute(); + ErrorHelper.checkSuccessfulApiCall(createResponse); + + Long scheduleId = createResponse.body().getResourceId(); + PostUpdateRescheduleLoansRequest approveRequest = new PostUpdateRescheduleLoansRequest()// + .approvedOnDate(submittedOnDate)// + .dateFormat("dd MMMM yyyy")// + .locale("en");// + + Response approveResponse = rescheduleLoansApi + .updateLoanRescheduleRequest(scheduleId, approveRequest, "approve").execute(); + ErrorHelper.checkSuccessfulApiCall(approveResponse); + } + + @Then("Loan reschedule with the following data results a {int} error and {string} error message") + public void createLoanRescheduleError(int errorCodeExpected, String errorMessageType, DataTable table) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + List> data = table.asLists(); + List rescheduleData = data.get(1); + String rescheduleFromDate = rescheduleData.get(0); + String submittedOnDate = rescheduleData.get(1); + String adjustedDueDate = rescheduleData.get(2); + Integer graceOfPrincipal = Integer.parseInt(rescheduleData.get(3)) == 0 ? null : Integer.valueOf(rescheduleData.get(3)); + Integer graceOnInterest = Integer.parseInt(rescheduleData.get(4)) == 0 ? null : Integer.valueOf(rescheduleData.get(4)); + Integer extraTerms = Integer.parseInt(rescheduleData.get(5)) == 0 ? null : Integer.valueOf(rescheduleData.get(5)); + BigDecimal newInterestRate = new BigDecimal(rescheduleData.get(6)); + + PostCreateRescheduleLoansRequest request = new PostCreateRescheduleLoansRequest()// + .loanId(loanId)// + .rescheduleFromDate(rescheduleFromDate)// + .submittedOnDate(submittedOnDate)// + .adjustedDueDate(adjustedDueDate)// + .graceOnPrincipal(graceOfPrincipal)// + .graceOnInterest(graceOnInterest)// + .extraTerms(extraTerms)// + .newInterestRate(newInterestRate)// + .rescheduleReasonId(54L)// + .rescheduleReasonComment("")// + .dateFormat("dd MMMM yyyy")// + .locale("en");// + + Response createResponse = rescheduleLoansApi.createLoanRescheduleRequest(request).execute(); + + LoanRescheduleErrorMessage loanRescheduleErrorMessage = LoanRescheduleErrorMessage.valueOf(errorMessageType); + String errorMessageExpected = loanRescheduleErrorMessage.getValue(loanId); + + String errorToString = createResponse.errorBody().string(); + ErrorResponse errorResponse = GSON.fromJson(errorToString, ErrorResponse.class); + String errorMessageActual = errorResponse.getErrors().get(0).getDeveloperMessage(); + int errorCodeActual = createResponse.code(); + + assertThat(errorCodeActual).as(ErrorMessageHelper.wrongErrorCode(errorCodeActual, errorCodeExpected)).isEqualTo(errorCodeExpected); + assertThat(errorMessageActual).as(ErrorMessageHelper.wrongErrorMessage(errorMessageActual, errorMessageExpected)) + .isEqualTo(errorMessageExpected); + + log.info("ERROR CODE: {}", errorCodeActual); + log.info("ERROR MESSAGE: {}", errorMessageActual); + } +} 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 new file mode 100644 index 00000000000..81b48e52320 --- /dev/null +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java @@ -0,0 +1,2093 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.test.stepdef.loan; + +import static org.apache.fineract.test.data.TransactionProcessingStrategyCode.ADVANCED_PAYMENT_ALLOCATION; +import static org.assertj.core.api.Assertions.assertThat; +import static org.awaitility.Awaitility.await; + +import com.google.gson.Gson; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; +import io.cucumber.datatable.DataTable; +import io.cucumber.java.en.And; +import io.cucumber.java.en.Then; +import io.cucumber.java.en.When; +import java.io.IOException; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.time.Duration; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; +import lombok.extern.slf4j.Slf4j; +import org.apache.fineract.avro.loan.v1.LoanAccountDataV1; +import org.apache.fineract.avro.loan.v1.LoanChargePaidByDataV1; +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.DeleteLoansLoanIdResponse; +import org.apache.fineract.client.models.GetLoanProductsProductIdResponse; +import org.apache.fineract.client.models.GetLoansLoanIdDelinquencySummary; +import org.apache.fineract.client.models.GetLoansLoanIdLoanChargeData; +import org.apache.fineract.client.models.GetLoansLoanIdLoanChargePaidByData; +import org.apache.fineract.client.models.GetLoansLoanIdRepaymentPeriod; +import org.apache.fineract.client.models.GetLoansLoanIdRepaymentSchedule; +import org.apache.fineract.client.models.GetLoansLoanIdResponse; +import org.apache.fineract.client.models.GetLoansLoanIdTimeline; +import org.apache.fineract.client.models.GetLoansLoanIdTransactions; +import org.apache.fineract.client.models.GetLoansLoanIdTransactionsTransactionIdResponse; +import org.apache.fineract.client.models.IsCatchUpRunningResponse; +import org.apache.fineract.client.models.PostClientsResponse; +import org.apache.fineract.client.models.PostLoansLoanIdRequest; +import org.apache.fineract.client.models.PostLoansLoanIdResponse; +import org.apache.fineract.client.models.PostLoansLoanIdTransactionsRequest; +import org.apache.fineract.client.models.PostLoansLoanIdTransactionsResponse; +import org.apache.fineract.client.models.PostLoansLoanIdTransactionsTransactionIdRequest; +import org.apache.fineract.client.models.PostLoansRequest; +import org.apache.fineract.client.models.PostLoansResponse; +import org.apache.fineract.client.models.PutLoanProductsProductIdRequest; +import org.apache.fineract.client.models.PutLoanProductsProductIdResponse; +import org.apache.fineract.client.models.PutLoansLoanIdRequest; +import org.apache.fineract.client.models.PutLoansLoanIdResponse; +import org.apache.fineract.client.services.LoanCobCatchUpApi; +import org.apache.fineract.client.services.LoanProductsApi; +import org.apache.fineract.client.services.LoanTransactionsApi; +import org.apache.fineract.client.services.LoansApi; +import org.apache.fineract.client.util.JSON; +import org.apache.fineract.test.data.AmortizationType; +import org.apache.fineract.test.data.InterestCalculationPeriodTime; +import org.apache.fineract.test.data.InterestType; +import org.apache.fineract.test.data.LoanStatus; +import org.apache.fineract.test.data.LoanTermFrequencyType; +import org.apache.fineract.test.data.RepaymentFrequencyType; +import org.apache.fineract.test.data.TransactionProcessingStrategyCode; +import org.apache.fineract.test.data.TransactionType; +import org.apache.fineract.test.data.loanproduct.DefaultLoanProduct; +import org.apache.fineract.test.data.loanproduct.LoanProductResolver; +import org.apache.fineract.test.data.paymenttype.DefaultPaymentType; +import org.apache.fineract.test.data.paymenttype.PaymentTypeResolver; +import org.apache.fineract.test.factory.LoanRequestFactory; +import org.apache.fineract.test.helper.ErrorHelper; +import org.apache.fineract.test.helper.ErrorMessageHelper; +import org.apache.fineract.test.helper.ErrorResponse; +import org.apache.fineract.test.helper.Utils; +import org.apache.fineract.test.initializer.global.LoanProductGlobalInitializerStep; +import org.apache.fineract.test.messaging.EventAssertion; +import org.apache.fineract.test.messaging.event.EventCheckHelper; +import org.apache.fineract.test.messaging.event.loan.LoanStatusChangedEvent; +import org.apache.fineract.test.messaging.event.loan.transaction.LoanAccrualTransactionCreatedBusinessEvent; +import org.apache.fineract.test.messaging.event.loan.transaction.LoanChargeOffEvent; +import org.apache.fineract.test.messaging.event.loan.transaction.LoanChargeOffUndoEvent; +import org.apache.fineract.test.stepdef.AbstractStepDef; +import org.apache.fineract.test.support.TestContextKey; +import org.springframework.beans.factory.annotation.Autowired; +import retrofit2.Response; + +@Slf4j +public class LoanStepDef extends AbstractStepDef { + + public static final String DATE_FORMAT = "dd MMMM yyyy"; + public static final String DATE_FORMAT_EVENTS = "yyyy-MM-dd"; + public static final String DEFAULT_LOCALE = "en"; + public static final String LOAN_STATE_SUBMITTED_AND_PENDING = "Submitted and pending approval"; + public static final String LOAN_STATE_APPROVED = "Approved"; + public static final String LOAN_STATE_ACTIVE = "Active"; + private static final Gson GSON = new JSON().getGson(); + private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern(DATE_FORMAT); + private static final DateTimeFormatter FORMATTER_EVENTS = DateTimeFormatter.ofPattern(DATE_FORMAT_EVENTS); + + @Autowired + private LoansApi loansApi; + + @Autowired + private LoanCobCatchUpApi loanCobCatchUpApi; + + @Autowired + private LoanTransactionsApi loanTransactionsApi; + + @Autowired + private EventAssertion eventAssertion; + + @Autowired + private PaymentTypeResolver paymentTypeResolver; + + @Autowired + private LoanProductResolver loanProductResolver; + + @Autowired + private LoanRequestFactory loanRequestFactory; + + @Autowired + private EventCheckHelper eventCheckHelper; + + @Autowired + private LoanProductsApi loanProductsApi; + + @When("Admin creates a new Loan") + public void createLoan() throws IOException { + Response clientResponse = testContext().get(TestContextKey.CLIENT_CREATE_RESPONSE); + Long clientId = clientResponse.body().getClientId(); + PostLoansRequest loansRequest = loanRequestFactory.defaultLoansRequest(clientId); + + Response response = loansApi.calculateLoanScheduleOrSubmitLoanApplication(loansRequest, "").execute(); + testContext().set(TestContextKey.LOAN_CREATE_RESPONSE, response); + ErrorHelper.checkSuccessfulApiCall(response); + + eventCheckHelper.createLoanEventCheck(response); + } + + @When("Admin creates a new default Loan with date: {string}") + public void createLoanWithDate(String date) throws IOException { + Response clientResponse = testContext().get(TestContextKey.CLIENT_CREATE_RESPONSE); + Long clientId = clientResponse.body().getClientId(); + PostLoansRequest loansRequest = loanRequestFactory.defaultLoansRequest(clientId).submittedOnDate(date) + .expectedDisbursementDate(date); + + Response response = loansApi.calculateLoanScheduleOrSubmitLoanApplication(loansRequest, "").execute(); + testContext().set(TestContextKey.LOAN_CREATE_RESPONSE, response); + ErrorHelper.checkSuccessfulApiCall(response); + + eventCheckHelper.createLoanEventCheck(response); + } + + @When("Admin crates a second default loan with date: {string}") + public void createSecondLoanWithDate(String date) throws IOException { + Response clientResponse = testContext().get(TestContextKey.CLIENT_CREATE_RESPONSE); + Long clientId = clientResponse.body().getClientId(); + PostLoansRequest loansRequest = loanRequestFactory.defaultLoansRequest(clientId).submittedOnDate(date) + .expectedDisbursementDate(date); + + Response response = loansApi.calculateLoanScheduleOrSubmitLoanApplication(loansRequest, "").execute(); + testContext().set(TestContextKey.LOAN_CREATE_SECOND_LOAN_RESPONSE, response); + ErrorHelper.checkSuccessfulApiCall(response); + + eventCheckHelper.createLoanEventCheck(response); + } + + @When("Admin crates a second default loan for the second client with date: {string}") + public void createSecondLoanForSecondClientWithDate(String date) throws IOException { + Response clientResponse = testContext().get(TestContextKey.CLIENT_CREATE_SECOND_CLIENT_RESPONSE); + Long clientId = clientResponse.body().getClientId(); + PostLoansRequest loansRequest = loanRequestFactory.defaultLoansRequest(clientId).submittedOnDate(date) + .expectedDisbursementDate(date); + + Response response = loansApi.calculateLoanScheduleOrSubmitLoanApplication(loansRequest, "").execute(); + testContext().set(TestContextKey.LOAN_CREATE_SECOND_LOAN_RESPONSE, response); + ErrorHelper.checkSuccessfulApiCall(response); + + eventCheckHelper.createLoanEventCheck(response); + } + + /** + * Use this where inline COB run needed - this way we don't have to run inline COB for all 30 days of loan term, but + * only 1 day + */ + @When("Admin creates a new Loan with date: {string} and with 1 day loan term and repayment") + public void createLoanWithDateShortTerm(String date) throws IOException { + Response clientResponse = testContext().get(TestContextKey.CLIENT_CREATE_RESPONSE); + Long clientId = clientResponse.body().getClientId(); + PostLoansRequest loansRequest = loanRequestFactory.defaultLoansRequest(clientId)// + .submittedOnDate(date)// + .expectedDisbursementDate(date)// + .loanTermFrequency(1)// + .repaymentEvery(1);// + + Response response = loansApi.calculateLoanScheduleOrSubmitLoanApplication(loansRequest, "").execute(); + testContext().set(TestContextKey.LOAN_CREATE_RESPONSE, response); + ErrorHelper.checkSuccessfulApiCall(response); + } + + @When("Customer makes {string} transaction with {string} payment type on {string} with {double} EUR transaction amount and self-generated Idempotency key") + public void createTransactionWithIdempotencyKey(String transactionTypeInput, String transactionPaymentType, String transactionDate, + double transactionAmount) throws IOException { + createTransactionWithIdempotencyKeyAndExternalOwnerCheck(transactionTypeInput, transactionPaymentType, transactionDate, + transactionAmount, null); + } + + @When("Customer makes {string} transaction with {string} payment type on {string} with {double} EUR transaction amount and self-generated Idempotency key and check external owner") + public void createTransactionWithIdempotencyKeyAndWithExternalOwner(String transactionTypeInput, String transactionPaymentType, + String transactionDate, double transactionAmount) throws IOException { + String transferExternalOwnerId = testContext().get(TestContextKey.ASSET_EXTERNALIZATION_OWNER_EXTERNAL_ID); + createTransactionWithIdempotencyKeyAndExternalOwnerCheck(transactionTypeInput, transactionPaymentType, transactionDate, + transactionAmount, transferExternalOwnerId); + } + + private void createTransactionWithIdempotencyKeyAndExternalOwnerCheck(String transactionTypeInput, String transactionPaymentType, + String transactionDate, double transactionAmount, String externalOwnerId) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + TransactionType transactionType = TransactionType.valueOf(transactionTypeInput); + String transactionTypeValue = transactionType.getValue(); + DefaultPaymentType paymentType = DefaultPaymentType.valueOf(transactionPaymentType); + Long paymentTypeValue = paymentTypeResolver.resolve(paymentType); + + PostLoansLoanIdTransactionsRequest paymentTransactionRequest = LoanRequestFactory.defaultPaymentTransactionRequest() + .transactionDate(transactionDate).transactionAmount(transactionAmount).paymentTypeId(paymentTypeValue); + + Map headerMap = new HashMap<>(); + String idempotencyKey = UUID.randomUUID().toString(); + testContext().set(TestContextKey.TRANSACTION_IDEMPOTENCY_KEY, idempotencyKey); + headerMap.put("Idempotency-Key", idempotencyKey); + + Response paymentTransactionResponse = loanTransactionsApi + .executeLoanTransaction(loanId, paymentTransactionRequest, transactionTypeValue, headerMap).execute(); + testContext().set(TestContextKey.LOAN_PAYMENT_TRANSACTION_RESPONSE, paymentTransactionResponse); + ErrorHelper.checkSuccessfulApiCall(paymentTransactionResponse); + + eventCheckHelper.transactionEventCheck(paymentTransactionResponse, transactionType, externalOwnerId); + } + + @When("Admin makes {string} transaction with {string} payment type on {string} with {double} EUR transaction amount") + public void createTransactionForRefund(String transactionTypeInput, String transactionPaymentType, String transactionDate, + double transactionAmount) throws IOException, InterruptedException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + TransactionType transactionType = TransactionType.valueOf(transactionTypeInput); + String transactionTypeValue = transactionType.getValue(); + DefaultPaymentType paymentType = DefaultPaymentType.valueOf(transactionPaymentType); + Long paymentTypeValue = paymentTypeResolver.resolve(paymentType); + + PostLoansLoanIdTransactionsRequest paymentTransactionRequest = LoanRequestFactory.defaultPaymentTransactionRequest() + .transactionDate(transactionDate).transactionAmount(transactionAmount).paymentTypeId(paymentTypeValue); + + Response paymentTransactionResponse = loanTransactionsApi + .executeLoanTransaction(loanId, paymentTransactionRequest, transactionTypeValue).execute(); + testContext().set(TestContextKey.LOAN_PAYMENT_TRANSACTION_RESPONSE, paymentTransactionResponse); + ErrorHelper.checkSuccessfulApiCall(paymentTransactionResponse); + + eventCheckHelper.transactionEventCheck(paymentTransactionResponse, transactionType, null); + } + + @When("Customer makes {string} transaction with {string} payment type on {string} with {double} EUR transaction amount and system-generated Idempotency key") + public void createTransactionWithAutoIdempotencyKey(String transactionTypeInput, String transactionPaymentType, String transactionDate, + double transactionAmount) throws IOException { + createTransactionWithAutoIdempotencyKeyAndWithExternalOwner(transactionTypeInput, transactionPaymentType, transactionDate, + transactionAmount, null); + } + + @When("Customer makes {string} transaction with {string} payment type on {string} with {double} EUR transaction amount and system-generated Idempotency key and check external owner") + public void createTransactionWithAutoIdempotencyKeyWithExternalOwner(String transactionTypeInput, String transactionPaymentType, + String transactionDate, double transactionAmount) throws IOException { + String transferExternalOwnerId = testContext().get(TestContextKey.ASSET_EXTERNALIZATION_OWNER_EXTERNAL_ID); + createTransactionWithAutoIdempotencyKeyAndWithExternalOwner(transactionTypeInput, transactionPaymentType, transactionDate, + transactionAmount, transferExternalOwnerId); + } + + private void createTransactionWithAutoIdempotencyKeyAndWithExternalOwner(String transactionTypeInput, String transactionPaymentType, + String transactionDate, double transactionAmount, String externalOwnerId) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + TransactionType transactionType = TransactionType.valueOf(transactionTypeInput); + String transactionTypeValue = transactionType.getValue(); + DefaultPaymentType paymentType = DefaultPaymentType.valueOf(transactionPaymentType); + Long paymentTypeValue = paymentTypeResolver.resolve(paymentType); + + PostLoansLoanIdTransactionsRequest paymentTransactionRequest = LoanRequestFactory.defaultPaymentTransactionRequest() + .transactionDate(transactionDate).transactionAmount(transactionAmount).paymentTypeId(paymentTypeValue); + + Response paymentTransactionResponse = loanTransactionsApi + .executeLoanTransaction(loanId, paymentTransactionRequest, transactionTypeValue).execute(); + testContext().set(TestContextKey.LOAN_PAYMENT_TRANSACTION_RESPONSE, paymentTransactionResponse); + testContext().set(TestContextKey.LOAN_REPAYMENT_RESPONSE, paymentTransactionResponse); + ErrorHelper.checkSuccessfulApiCall(paymentTransactionResponse); + + eventCheckHelper.transactionEventCheck(paymentTransactionResponse, transactionType, externalOwnerId); + } + + @When("Admin makes Credit Balance Refund transaction on {string} with {double} EUR transaction amount") + public void createCBR(String transactionDate, double transactionAmount) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + String transactionTypeValue = "creditBalanceRefund"; + + PostLoansLoanIdTransactionsRequest paymentTransactionRequest = LoanRequestFactory.defaultPaymentTransactionRequest() + .transactionDate(transactionDate).transactionAmount(transactionAmount); + + Response paymentTransactionResponse = loanTransactionsApi + .executeLoanTransaction(loanId, paymentTransactionRequest, transactionTypeValue).execute(); + testContext().set(TestContextKey.LOAN_PAYMENT_TRANSACTION_RESPONSE, paymentTransactionResponse); + ErrorHelper.checkSuccessfulApiCall(paymentTransactionResponse); + } + + @Then("Credit Balance Refund transaction on future date {string} with {double} EUR transaction amount will result an error") + public void futureDateCBRError(String transactionDate, double transactionAmount) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + int errorCodeExpected = 403; + String errorMessageExpected = String.format("Loan: %s, Credit Balance Refund transaction cannot be created for the future.", + loanId); + + String transactionTypeValue = "creditBalanceRefund"; + + PostLoansLoanIdTransactionsRequest paymentTransactionRequest = LoanRequestFactory.defaultPaymentTransactionRequest() + .transactionDate(transactionDate).transactionAmount(transactionAmount); + + Response paymentTransactionResponse = loanTransactionsApi + .executeLoanTransaction(loanId, paymentTransactionRequest, transactionTypeValue).execute(); + testContext().set(TestContextKey.LOAN_PAYMENT_TRANSACTION_RESPONSE, paymentTransactionResponse); + + int errorCodeActual = paymentTransactionResponse.code(); + String errorBody = paymentTransactionResponse.errorBody().string(); + ErrorResponse errorResponse = GSON.fromJson(errorBody, ErrorResponse.class); + String errorMessageActual = errorResponse.getErrors().get(0).getDeveloperMessage(); + + assertThat(errorCodeActual).as(ErrorMessageHelper.wrongErrorCode(errorCodeActual, errorCodeExpected)).isEqualTo(errorCodeExpected); + assertThat(errorMessageActual).as(ErrorMessageHelper.wrongErrorMessage(errorMessageActual, errorMessageExpected)) + .isEqualTo(errorMessageExpected); + + log.info("ERROR CODE: {}", errorCodeActual); + log.info("ERROR MESSAGE: {}", errorMessageActual); + } + + @When("Admin creates a fully customized loan with the following data:") + public void createFullyCustomizedLoan(DataTable table) throws IOException { + List> data = table.asLists(); + List loanData = data.get(1); + String loanProduct = loanData.get(0); + String submitDate = loanData.get(1); + String principal = loanData.get(2); + BigDecimal interestRate = new BigDecimal(loanData.get(3)); + String interestType = loanData.get(4); + String interestCalculationPeriod = loanData.get(5); + String amortizationType = loanData.get(6); + Integer loanTermFrequency = Integer.valueOf(loanData.get(7)); + String loanTermFrequencyType = loanData.get(8); + Integer repaymentFrequency = Integer.valueOf(loanData.get(9)); + String repaymentFrequencyType = loanData.get(10); + Integer numberOfRepayments = Integer.valueOf(loanData.get(11)); + Integer graceOnPrincipalPayment = Integer.valueOf(loanData.get(12)); + Integer graceOnInterestPayment = Integer.valueOf(loanData.get(13)); + Integer graceOnInterestCharged = Integer.valueOf(loanData.get(14)); + String transactionProcessingStrategyCode = loanData.get(15); + + Response clientResponse = testContext().get(TestContextKey.CLIENT_CREATE_RESPONSE); + Long clientId = clientResponse.body().getClientId(); + + DefaultLoanProduct product = DefaultLoanProduct.valueOf(loanProduct); + Long loanProductId = loanProductResolver.resolve(product); + + LoanTermFrequencyType termFrequencyType = LoanTermFrequencyType.valueOf(loanTermFrequencyType); + Integer loanTermFrequencyTypeValue = termFrequencyType.getValue(); + + RepaymentFrequencyType repaymentFrequencyType1 = RepaymentFrequencyType.valueOf(repaymentFrequencyType); + Integer repaymentFrequencyTypeValue = repaymentFrequencyType1.getValue(); + + InterestType interestType1 = InterestType.valueOf(interestType); + Integer interestTypeValue = interestType1.getValue(); + + InterestCalculationPeriodTime interestCalculationPeriod1 = InterestCalculationPeriodTime.valueOf(interestCalculationPeriod); + Integer interestCalculationPeriodValue = interestCalculationPeriod1.getValue(); + + AmortizationType amortizationType1 = AmortizationType.valueOf(amortizationType); + Integer amortizationTypeValue = amortizationType1.getValue(); + + TransactionProcessingStrategyCode processingStrategyCode = TransactionProcessingStrategyCode + .valueOf(transactionProcessingStrategyCode); + String transactionProcessingStrategyCodeValue = processingStrategyCode.getValue(); + + PostLoansRequest loansRequest = loanRequestFactory.defaultLoansRequest(clientId)// + .productId(loanProductId)// + .principal(new BigDecimal(principal))// + .interestRatePerPeriod(interestRate)// + .interestType(interestTypeValue)// + .interestCalculationPeriodType(interestCalculationPeriodValue)// + .amortizationType(amortizationTypeValue)// + .loanTermFrequency(loanTermFrequency)// + .loanTermFrequencyType(loanTermFrequencyTypeValue)// + .numberOfRepayments(numberOfRepayments)// + .repaymentEvery(repaymentFrequency)// + .repaymentFrequencyType(repaymentFrequencyTypeValue)// + .submittedOnDate(submitDate)// + .expectedDisbursementDate(submitDate)// + .graceOnPrincipalPayment(graceOnPrincipalPayment)// + .graceOnInterestPayment(graceOnInterestPayment)// + .graceOnInterestPayment(graceOnInterestCharged).transactionProcessingStrategyCode(transactionProcessingStrategyCodeValue);// + + Response response = loansApi.calculateLoanScheduleOrSubmitLoanApplication(loansRequest, "").execute(); + testContext().set(TestContextKey.LOAN_CREATE_RESPONSE, response); + ErrorHelper.checkSuccessfulApiCall(response); + + eventCheckHelper.createLoanEventCheck(response); + } + + @When("Admin creates a fully customized loan with fixed length {int} and with the following data:") + public void createFullyCustomizedLoanFixedLength(int fixedLength, DataTable table) throws IOException { + List> data = table.asLists(); + List loanData = data.get(1); + String loanProduct = loanData.get(0); + String submitDate = loanData.get(1); + String principal = loanData.get(2); + BigDecimal interestRate = new BigDecimal(loanData.get(3)); + String interestType = loanData.get(4); + String interestCalculationPeriod = loanData.get(5); + String amortizationType = loanData.get(6); + Integer loanTermFrequency = Integer.valueOf(loanData.get(7)); + String loanTermFrequencyType = loanData.get(8); + Integer repaymentFrequency = Integer.valueOf(loanData.get(9)); + String repaymentFrequencyType = loanData.get(10); + Integer numberOfRepayments = Integer.valueOf(loanData.get(11)); + Integer graceOnPrincipalPayment = Integer.valueOf(loanData.get(12)); + Integer graceOnInterestPayment = Integer.valueOf(loanData.get(13)); + Integer graceOnInterestCharged = Integer.valueOf(loanData.get(14)); + String transactionProcessingStrategyCode = loanData.get(15); + + Response clientResponse = testContext().get(TestContextKey.CLIENT_CREATE_RESPONSE); + Long clientId = clientResponse.body().getClientId(); + + DefaultLoanProduct product = DefaultLoanProduct.valueOf(loanProduct); + Long loanProductId = loanProductResolver.resolve(product); + + LoanTermFrequencyType termFrequencyType = LoanTermFrequencyType.valueOf(loanTermFrequencyType); + Integer loanTermFrequencyTypeValue = termFrequencyType.getValue(); + + RepaymentFrequencyType repaymentFrequencyType1 = RepaymentFrequencyType.valueOf(repaymentFrequencyType); + Integer repaymentFrequencyTypeValue = repaymentFrequencyType1.getValue(); + + InterestType interestType1 = InterestType.valueOf(interestType); + Integer interestTypeValue = interestType1.getValue(); + + InterestCalculationPeriodTime interestCalculationPeriod1 = InterestCalculationPeriodTime.valueOf(interestCalculationPeriod); + Integer interestCalculationPeriodValue = interestCalculationPeriod1.getValue(); + + AmortizationType amortizationType1 = AmortizationType.valueOf(amortizationType); + Integer amortizationTypeValue = amortizationType1.getValue(); + + TransactionProcessingStrategyCode processingStrategyCode = TransactionProcessingStrategyCode + .valueOf(transactionProcessingStrategyCode); + String transactionProcessingStrategyCodeValue = processingStrategyCode.getValue(); + + PostLoansRequest loansRequest = loanRequestFactory.defaultLoansRequest(clientId)// + .productId(loanProductId)// + .principal(new BigDecimal(principal))// + .interestRatePerPeriod(interestRate)// + .interestType(interestTypeValue)// + .interestCalculationPeriodType(interestCalculationPeriodValue)// + .amortizationType(amortizationTypeValue)// + .loanTermFrequency(loanTermFrequency)// + .loanTermFrequencyType(loanTermFrequencyTypeValue)// + .numberOfRepayments(numberOfRepayments)// + .repaymentEvery(repaymentFrequency)// + .repaymentFrequencyType(repaymentFrequencyTypeValue)// + .submittedOnDate(submitDate)// + .expectedDisbursementDate(submitDate)// + .graceOnPrincipalPayment(graceOnPrincipalPayment)// + .graceOnInterestPayment(graceOnInterestPayment)// + .graceOnInterestPayment(graceOnInterestCharged).transactionProcessingStrategyCode(transactionProcessingStrategyCodeValue)// + .fixedLength(fixedLength);// + + Response response = loansApi.calculateLoanScheduleOrSubmitLoanApplication(loansRequest, "").execute(); + testContext().set(TestContextKey.LOAN_CREATE_RESPONSE, response); + ErrorHelper.checkSuccessfulApiCall(response); + + eventCheckHelper.createLoanEventCheck(response); + } + + @When("Admin creates a fully customized loan with Advanced payment allocation and with product no Advanced payment allocation set results an error:") + public void createFullyCustomizedLoanNoAdvancedPaymentError(DataTable table) throws IOException { + int errorCodeExpected = 400; + String errorMessageExpected = "Failed data validation due to: strategy.cannot.be.advanced.payment.allocation.if.not.configured."; + + List> data = table.asLists(); + List loanData = data.get(1); + String loanProduct = loanData.get(0); + String submitDate = loanData.get(1); + String principal = loanData.get(2); + BigDecimal interestRate = new BigDecimal(loanData.get(3)); + String interestType = loanData.get(4); + String interestCalculationPeriod = loanData.get(5); + String amortizationType = loanData.get(6); + Integer loanTermFrequency = Integer.valueOf(loanData.get(7)); + String loanTermFrequencyType = loanData.get(8); + Integer repaymentFrequency = Integer.valueOf(loanData.get(9)); + String repaymentFrequencyType = loanData.get(10); + Integer numberOfRepayments = Integer.valueOf(loanData.get(11)); + Integer graceOnPrincipalPayment = Integer.valueOf(loanData.get(12)); + Integer graceOnInterestPayment = Integer.valueOf(loanData.get(13)); + Integer graceOnInterestCharged = Integer.valueOf(loanData.get(14)); + String transactionProcessingStrategyCode = loanData.get(15); + + Response clientResponse = testContext().get(TestContextKey.CLIENT_CREATE_RESPONSE); + Long clientId = clientResponse.body().getClientId(); + + DefaultLoanProduct product = DefaultLoanProduct.valueOf(loanProduct); + Long loanProductId = loanProductResolver.resolve(product); + + LoanTermFrequencyType termFrequencyType = LoanTermFrequencyType.valueOf(loanTermFrequencyType); + Integer loanTermFrequencyTypeValue = termFrequencyType.getValue(); + + RepaymentFrequencyType repaymentFrequencyType1 = RepaymentFrequencyType.valueOf(repaymentFrequencyType); + Integer repaymentFrequencyTypeValue = repaymentFrequencyType1.getValue(); + + InterestType interestType1 = InterestType.valueOf(interestType); + Integer interestTypeValue = interestType1.getValue(); + + InterestCalculationPeriodTime interestCalculationPeriod1 = InterestCalculationPeriodTime.valueOf(interestCalculationPeriod); + Integer interestCalculationPeriodValue = interestCalculationPeriod1.getValue(); + + AmortizationType amortizationType1 = AmortizationType.valueOf(amortizationType); + Integer amortizationTypeValue = amortizationType1.getValue(); + + TransactionProcessingStrategyCode processingStrategyCode = TransactionProcessingStrategyCode + .valueOf(transactionProcessingStrategyCode); + String transactionProcessingStrategyCodeValue = processingStrategyCode.getValue(); + + PostLoansRequest loansRequest = loanRequestFactory.defaultLoansRequest(clientId)// + .productId(loanProductId)// + .principal(new BigDecimal(principal))// + .interestRatePerPeriod(interestRate)// + .interestType(interestTypeValue)// + .interestCalculationPeriodType(interestCalculationPeriodValue)// + .amortizationType(amortizationTypeValue)// + .loanTermFrequency(loanTermFrequency)// + .loanTermFrequencyType(loanTermFrequencyTypeValue)// + .numberOfRepayments(numberOfRepayments)// + .repaymentEvery(repaymentFrequency)// + .repaymentFrequencyType(repaymentFrequencyTypeValue)// + .submittedOnDate(submitDate)// + .expectedDisbursementDate(submitDate)// + .graceOnPrincipalPayment(graceOnPrincipalPayment)// + .graceOnInterestPayment(graceOnInterestPayment)// + .graceOnInterestPayment(graceOnInterestCharged).transactionProcessingStrategyCode(transactionProcessingStrategyCodeValue);// + + Response response = loansApi.calculateLoanScheduleOrSubmitLoanApplication(loansRequest, "").execute(); + int errorCodeActual = response.code(); + String errorBody = response.errorBody().string(); + ErrorResponse errorResponse = GSON.fromJson(errorBody, ErrorResponse.class); + String errorMessageActual = errorResponse.getErrors().get(0).getDeveloperMessage(); + + assertThat(errorCodeActual).as(ErrorMessageHelper.wrongErrorCode(errorCodeActual, errorCodeExpected)).isEqualTo(errorCodeExpected); + assertThat(errorMessageActual).as(ErrorMessageHelper.wrongErrorMessage(errorMessageActual, errorMessageExpected)) + .isEqualTo(errorMessageExpected); + + log.info("ERROR CODE: {}", errorCodeActual); + log.info("ERROR MESSAGE: {}", errorMessageActual); + } + + @Then("Loan details has the following last payment related data:") + public void checkLastPaymentData(DataTable table) throws IOException { + List> data = table.asLists(); + List expectedValues = data.get(1); + String lastPaymentAmountExpected = expectedValues.get(0); + String lastPaymentDateExpected = expectedValues.get(1); + String lastRepaymentAmountExpected = expectedValues.get(2); + String lastRepaymentDateExpected = expectedValues.get(3); + + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + Response loanDetailsResponse = loansApi.retrieveLoan(loanId, false, "collection", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); + + GetLoansLoanIdDelinquencySummary delinquent = loanDetailsResponse.body().getDelinquent(); + String lastPaymentAmountActual = String.valueOf(delinquent.getLastPaymentAmount()); + String lastPaymentDateActual = FORMATTER.format(delinquent.getLastPaymentDate()); + String lastRepaymentAmountActual = String.valueOf(delinquent.getLastRepaymentAmount()); + String lastRepaymentDateActual = FORMATTER.format(delinquent.getLastRepaymentDate()); + + assertThat(lastPaymentAmountActual) + .as(ErrorMessageHelper.wrongDataInLastPaymentAmount(lastPaymentAmountActual, lastPaymentAmountExpected)) + .isEqualTo(lastPaymentAmountExpected); + assertThat(lastPaymentDateActual).as(ErrorMessageHelper.wrongDataInLastPaymentDate(lastPaymentDateActual, lastPaymentDateExpected)) + .isEqualTo(lastPaymentDateExpected); + assertThat(lastRepaymentAmountActual) + .as(ErrorMessageHelper.wrongDataInLastRepaymentAmount(lastRepaymentAmountActual, lastRepaymentAmountExpected)) + .isEqualTo(lastRepaymentAmountExpected); + assertThat(lastRepaymentDateActual) + .as(ErrorMessageHelper.wrongDataInLastRepaymentDate(lastRepaymentDateActual, lastRepaymentDateExpected)) + .isEqualTo(lastRepaymentDateExpected); + } + + @Then("Loan details and LoanTransactionMakeRepaymentPostBusinessEvent has the following data in loanChargePaidByList section:") + public void checkLoanDetailsAndEventLoanChargePaidByListSection(DataTable table) throws IOException { + List> data = table.asLists(); + + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Response loanDetailsResponse = loansApi.retrieveLoan(loanId, false, "transactions", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); + + List transactions = loanDetailsResponse.body().getTransactions(); + GetLoansLoanIdTransactions lastRepaymentData = transactions.stream() + .filter(t -> "loanTransactionType.repayment".equals(t.getType().getCode())).reduce((first, second) -> second).orElse(null); + List loanChargePaidByList = lastRepaymentData.getLoanChargePaidByList(); + loanChargePaidByList.sort(Comparator.comparing(GetLoansLoanIdLoanChargePaidByData::getChargeId)); + + EventAssertion.EventAssertionBuilder transactionEvent = testContext().get(TestContextKey.TRANSACTION_EVENT); + transactionEvent.extractingData(loanTransactionDataV1 -> { + for (int i = 0; i < loanChargePaidByList.size(); i++) { + List loanChargePaidByListEvent = loanTransactionDataV1.getLoanChargePaidByList(); + loanChargePaidByListEvent.sort(Comparator.comparing(LoanChargePaidByDataV1::getChargeId)); + String amountEventActual = loanChargePaidByListEvent.get(i).getAmount().setScale(1, RoundingMode.HALF_DOWN).toString(); + String nameEventActual = loanChargePaidByListEvent.get(i).getName(); + + String amountActual = String.valueOf(loanChargePaidByList.get(i).getAmount()); + String nameActual = loanChargePaidByList.get(i).getName(); + + String amountExpected = data.get(i + 1).get(0); + String nameExpected = data.get(i + 1).get(1); + + assertThat(amountActual) + .as(ErrorMessageHelper.wrongDataInLoanDetailsLoanChargePaidByListAmount(amountActual, amountExpected)) + .isEqualTo(amountExpected); + assertThat(nameActual).as(ErrorMessageHelper.wrongDataInLoanDetailsLoanChargePaidByListName(nameActual, nameExpected)) + .isEqualTo(nameExpected); + + assertThat(amountEventActual).as(ErrorMessageHelper + .wrongDataInLoanTransactionMakeRepaymentPostEventLoanChargePaidByListAmount(amountEventActual, amountExpected)) + .isEqualTo(amountExpected); + assertThat(nameEventActual).as(ErrorMessageHelper + .wrongDataInLoanTransactionMakeRepaymentPostEventLoanChargePaidByListName(nameEventActual, nameExpected)) + .isEqualTo(nameExpected); + } + return null; + }); + } + + @And("Admin successfully creates a new customised Loan submitted on date: {string}, with Principal: {string}, a loanTermFrequency: {int} months, and numberOfRepayments: {int}") + public void createCustomizedLoan(String submitDate, String principal, Integer loanTermFrequency, Integer numberOfRepayments) + throws IOException { + Response clientResponse = testContext().get(TestContextKey.CLIENT_CREATE_RESPONSE); + Long clientId = clientResponse.body().getClientId(); + Integer repaymentFrequency = loanTermFrequency / numberOfRepayments; + + PostLoansRequest loansRequest = loanRequestFactory.defaultLoansRequest(clientId).principal(new BigDecimal(principal)) + .loanTermFrequency(loanTermFrequency).loanTermFrequencyType(LoanTermFrequencyType.MONTHS.value) + .numberOfRepayments(numberOfRepayments).repaymentEvery(repaymentFrequency) + .repaymentFrequencyType(RepaymentFrequencyType.MONTHS.value).submittedOnDate(submitDate) + .expectedDisbursementDate(submitDate); + + Response response = loansApi.calculateLoanScheduleOrSubmitLoanApplication(loansRequest, "").execute(); + testContext().set(TestContextKey.LOAN_CREATE_RESPONSE, response); + ErrorHelper.checkSuccessfulApiCall(response); + } + + @And("Customer makes {string} transaction with {string} payment type on {string} with {double} EUR transaction amount with the same Idempotency key as previous transaction") + public void createTransactionWithIdempotencyKeyOfPreviousTransaction(String transactionTypeInput, String transactionPaymentType, + String transactionDate, double transactionAmount) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + TransactionType transactionType = TransactionType.valueOf(transactionTypeInput); + String transactionTypeValue = transactionType.getValue(); + DefaultPaymentType paymentType = DefaultPaymentType.valueOf(transactionPaymentType); + Long paymentTypeValue = paymentTypeResolver.resolve(paymentType); + + PostLoansLoanIdTransactionsRequest paymentTransactionRequest = LoanRequestFactory.defaultPaymentTransactionRequest() + .transactionDate(transactionDate).transactionAmount(transactionAmount).paymentTypeId(paymentTypeValue); + + Map headerMap = new HashMap<>(); + String idempotencyKey = testContext().get(TestContextKey.TRANSACTION_IDEMPOTENCY_KEY); + headerMap.put("Idempotency-Key", idempotencyKey); + + Response paymentTransactionResponse = loanTransactionsApi + .executeLoanTransaction(loanId, paymentTransactionRequest, transactionTypeValue, headerMap).execute(); + testContext().set(TestContextKey.LOAN_PAYMENT_TRANSACTION_RESPONSE, paymentTransactionResponse); + ErrorHelper.checkSuccessfulApiCall(paymentTransactionResponse); + } + + @And("Customer makes {string} transaction on the second loan with {string} payment type on {string} with {double} EUR transaction amount with the same Idempotency key as previous transaction") + public void createTransactionOnSecondLoanWithIdempotencyKeyOfPreviousTransaction(String transactionTypeInput, + String transactionPaymentType, String transactionDate, double transactionAmount) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_SECOND_LOAN_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + TransactionType transactionType = TransactionType.valueOf(transactionTypeInput); + String transactionTypeValue = transactionType.getValue(); + DefaultPaymentType paymentType = DefaultPaymentType.valueOf(transactionPaymentType); + Long paymentTypeValue = paymentTypeResolver.resolve(paymentType); + + PostLoansLoanIdTransactionsRequest paymentTransactionRequest = LoanRequestFactory.defaultPaymentTransactionRequest() + .transactionDate(transactionDate).transactionAmount(transactionAmount).paymentTypeId(paymentTypeValue); + + Map headerMap = new HashMap<>(); + String idempotencyKey = testContext().get(TestContextKey.TRANSACTION_IDEMPOTENCY_KEY); + headerMap.put("Idempotency-Key", idempotencyKey); + + Response paymentTransactionResponse = loanTransactionsApi + .executeLoanTransaction(loanId, paymentTransactionRequest, transactionTypeValue, headerMap).execute(); + testContext().set(TestContextKey.LOAN_PAYMENT_TRANSACTION_RESPONSE, paymentTransactionResponse); + ErrorHelper.checkSuccessfulApiCall(paymentTransactionResponse); + } + + @Then("Admin can successfully modify the loan and changes the submitted on date to {string}") + public void modifyLoanSubmittedOnDate(String newSubmittedOnDate) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + Long loanId2 = loanResponse.body().getResourceId(); + Long clientId2 = loanResponse.body().getClientId(); + + PutLoansLoanIdRequest putLoansLoanIdRequest = loanRequestFactory.modifySubmittedOnDateOnLoan(clientId2, newSubmittedOnDate); + + Response responseMod = loansApi.modifyLoanApplication(loanId2, putLoansLoanIdRequest, "").execute(); + testContext().set(TestContextKey.LOAN_MODIFY_RESPONSE, responseMod); + ErrorHelper.checkSuccessfulApiCall(responseMod); + } + + @Then("Admin fails to create a new customised Loan submitted on date: {string}, with Principal: {string}, a loanTermFrequency: {int} months, and numberOfRepayments: {int}") + public void createCustomizedLoanFailure(String submitDate, String principal, Integer loanTermFrequency, Integer numberOfRepayments) + throws IOException { + Response clientResponse = testContext().get(TestContextKey.CLIENT_CREATE_RESPONSE); + Long clientId = clientResponse.body().getClientId(); + Integer repaymentFrequency = loanTermFrequency / numberOfRepayments; + + PostLoansRequest loansRequest = loanRequestFactory.defaultLoansRequest(clientId).principal(new BigDecimal(principal)) + .loanTermFrequency(loanTermFrequency).loanTermFrequencyType(LoanTermFrequencyType.MONTHS.value) + .numberOfRepayments(numberOfRepayments).repaymentEvery(repaymentFrequency) + .repaymentFrequencyType(RepaymentFrequencyType.MONTHS.value).submittedOnDate(submitDate) + .expectedDisbursementDate(submitDate); + + Response response = loansApi.calculateLoanScheduleOrSubmitLoanApplication(loansRequest, "").execute(); + testContext().set(TestContextKey.LOAN_CREATE_RESPONSE, response); + ErrorResponse errorDetails = ErrorResponse.from(response); + assertThat(errorDetails.getHttpStatusCode()).as(ErrorMessageHelper.dateFailureErrorCodeMsg()).isEqualTo(403); + assertThat(errorDetails.getSingleError().getDeveloperMessage()).isEqualTo(ErrorMessageHelper.loanSubmitDateInFutureFailureMsg()); + } + + @And("Admin successfully approves the loan on {string} with {string} amount and expected disbursement date on {string}") + public void approveLoan(String approveDate, String approvedAmount, String expectedDisbursementDate) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + PostLoansLoanIdRequest approveRequest = LoanRequestFactory.defaultLoanApproveRequest().approvedOnDate(approveDate) + .approvedLoanAmount(new BigDecimal(approvedAmount)).expectedDisbursementDate(expectedDisbursementDate); + + Response loanApproveResponse = loansApi.stateTransitions(loanId, approveRequest, "approve").execute(); + testContext().set(TestContextKey.LOAN_APPROVAL_RESPONSE, loanApproveResponse); + ErrorHelper.checkSuccessfulApiCall(loanApproveResponse); + assertThat(loanApproveResponse.body().getChanges().getStatus().getValue()).isEqualTo(LOAN_STATE_APPROVED); + assertThat(loanApproveResponse.body().getChanges().getStatus().getValue()).isEqualTo(LOAN_STATE_APPROVED); + + eventCheckHelper.approveLoanEventCheck(loanApproveResponse); + } + + @And("Admin successfully approves the second loan on {string} with {string} amount and expected disbursement date on {string}") + public void approveSecondLoan(String approveDate, String approvedAmount, String expectedDisbursementDate) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_SECOND_LOAN_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + PostLoansLoanIdRequest approveRequest = LoanRequestFactory.defaultLoanApproveRequest().approvedOnDate(approveDate) + .approvedLoanAmount(new BigDecimal(approvedAmount)).expectedDisbursementDate(expectedDisbursementDate); + + Response loanApproveResponse = loansApi.stateTransitions(loanId, approveRequest, "approve").execute(); + testContext().set(TestContextKey.LOAN_APPROVAL_SECOND_LOAN_RESPONSE, loanApproveResponse); + ErrorHelper.checkSuccessfulApiCall(loanApproveResponse); + assertThat(loanApproveResponse.body().getChanges().getStatus().getValue()).isEqualTo(LOAN_STATE_APPROVED); + assertThat(loanApproveResponse.body().getChanges().getStatus().getValue()).isEqualTo(LOAN_STATE_APPROVED); + } + + @Then("Admin can successfully undone the loan approval") + public void undoLoanApproval() throws IOException { + Response loanApproveResponse = testContext().get(TestContextKey.LOAN_APPROVAL_RESPONSE); + long loanId = loanApproveResponse.body().getLoanId(); + PostLoansLoanIdRequest undoApprovalRequest = new PostLoansLoanIdRequest().note(""); + + Response undoApprovalResponse = loansApi.stateTransitions(loanId, undoApprovalRequest, "undoapproval") + .execute(); + testContext().set(TestContextKey.LOAN_UNDO_APPROVAL_RESPONSE, loanApproveResponse); + ErrorHelper.checkSuccessfulApiCall(undoApprovalResponse); + assertThat(undoApprovalResponse.body().getChanges().getStatus().getValue()).isEqualTo(LOAN_STATE_SUBMITTED_AND_PENDING); + } + + @Then("Admin fails to approve the loan on {string} with {string} amount and expected disbursement date on {string} because of wrong date") + public void failedLoanApproveWithDate(String approveDate, String approvedAmount, String expectedDisbursementDate) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + PostLoansLoanIdRequest approveRequest = LoanRequestFactory.defaultLoanApproveRequest().approvedOnDate(approveDate) + .approvedLoanAmount(new BigDecimal(approvedAmount)).expectedDisbursementDate(expectedDisbursementDate); + + Response loanApproveResponse = loansApi.stateTransitions(loanId, approveRequest, "approve").execute(); + ErrorResponse errorDetails = ErrorResponse.from(loanApproveResponse); + assertThat(errorDetails.getHttpStatusCode()).as(ErrorMessageHelper.dateFailureErrorCodeMsg()).isEqualTo(403); + assertThat(errorDetails.getSingleError().getDeveloperMessage()).isEqualTo(ErrorMessageHelper.loanApproveDateInFutureFailureMsg()); + } + + @Then("Admin fails to approve the loan on {string} with {string} amount and expected disbursement date on {string} because of wrong amount") + public void failedLoanApproveWithAmount(String approveDate, String approvedAmount, String expectedDisbursementDate) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + PostLoansLoanIdRequest approveRequest = LoanRequestFactory.defaultLoanApproveRequest().approvedOnDate(approveDate) + .approvedLoanAmount(new BigDecimal(approvedAmount)).expectedDisbursementDate(expectedDisbursementDate); + + Response loanApproveResponse = loansApi.stateTransitions(loanId, approveRequest, "approve").execute(); + ErrorResponse errorDetails = ErrorResponse.from(loanApproveResponse); + assertThat(errorDetails.getHttpStatusCode()).as(ErrorMessageHelper.dateFailureErrorCodeMsg()).isEqualTo(403); + assertThat(errorDetails.getSingleError().getDeveloperMessage()).isEqualTo(ErrorMessageHelper.loanApproveMaxAmountFailureMsg()); + } + + @And("Admin successfully disburse the loan on {string} with {string} EUR transaction amount") + public void disburseLoan(String actualDisbursementDate, String transactionAmount) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + PostLoansLoanIdRequest disburseRequest = LoanRequestFactory.defaultLoanDisburseRequest() + .actualDisbursementDate(actualDisbursementDate).transactionAmount(new BigDecimal(transactionAmount)); + + Response loanDisburseResponse = loansApi.stateTransitions(loanId, disburseRequest, "disburse").execute(); + testContext().set(TestContextKey.LOAN_DISBURSE_RESPONSE, loanDisburseResponse); + ErrorHelper.checkSuccessfulApiCall(loanDisburseResponse); + Long statusActual = loanDisburseResponse.body().getChanges().getStatus().getId(); + + Response loanDetails = loansApi.retrieveLoan(loanId, false, "", "", "").execute(); + Long statusExpected = Long.valueOf(loanDetails.body().getStatus().getId()); + + assertThat(statusActual)// + .as(ErrorMessageHelper.wrongLoanStatus(Math.toIntExact(statusActual), Math.toIntExact(statusExpected)))// + .isEqualTo(statusExpected);// + eventCheckHelper.disburseLoanEventCheck(loanDisburseResponse); + eventCheckHelper.loanDisbursalTransactionEventCheck(loanDisburseResponse); + } + + @And("Admin successfully disburse the second loan on {string} with {string} EUR transaction amount") + public void disburseSecondLoan(String actualDisbursementDate, String transactionAmount) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_SECOND_LOAN_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + PostLoansLoanIdRequest disburseRequest = LoanRequestFactory.defaultLoanDisburseRequest() + .actualDisbursementDate(actualDisbursementDate).transactionAmount(new BigDecimal(transactionAmount)); + + Response loanDisburseResponse = loansApi.stateTransitions(loanId, disburseRequest, "disburse").execute(); + testContext().set(TestContextKey.LOAN_DISBURSE_SECOND_LOAN_RESPONSE, loanDisburseResponse); + ErrorHelper.checkSuccessfulApiCall(loanDisburseResponse); + assertThat(loanDisburseResponse.body().getChanges().getStatus().getValue()).isEqualTo(LOAN_STATE_ACTIVE); + + eventCheckHelper.disburseLoanEventCheck(loanDisburseResponse); + eventCheckHelper.loanDisbursalTransactionEventCheck(loanDisburseResponse); + } + + @And("Admin does charge-off the loan on {string}") + public void chargeOffLoan(String transactionDate) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + PostLoansLoanIdTransactionsRequest chargeOffRequest = LoanRequestFactory.defaultChargeOffRequest().transactionDate(transactionDate) + .dateFormat(DATE_FORMAT).locale(DEFAULT_LOCALE); + + Response chargeOffResponse = loanTransactionsApi + .executeLoanTransaction(loanId, chargeOffRequest, "charge-off").execute(); + testContext().set(TestContextKey.LOAN_CHARGE_OFF_RESPONSE, chargeOffResponse); + ErrorHelper.checkSuccessfulApiCall(chargeOffResponse); + + Long transactionId = chargeOffResponse.body().getResourceId(); + eventAssertion.assertEvent(LoanChargeOffEvent.class, transactionId).extractingData(LoanTransactionDataV1::getLoanId) + .isEqualTo(loanId).extractingData(LoanTransactionDataV1::getId).isEqualTo(chargeOffResponse.body().getResourceId()); + } + + @Then("Charge-off attempt on {string} results an error") + public void chargeOffOnLoanWithInterestFails(String transactionDate) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + PostLoansLoanIdTransactionsRequest chargeOffRequest = LoanRequestFactory.defaultChargeOffRequest().transactionDate(transactionDate) + .dateFormat(DATE_FORMAT).locale(DEFAULT_LOCALE); + + Response chargeOffResponse = loanTransactionsApi + .executeLoanTransaction(loanId, chargeOffRequest, "charge-off").execute(); + testContext().set(TestContextKey.LOAN_CHARGE_OFF_RESPONSE, chargeOffResponse); + + assertThat(chargeOffResponse.isSuccessful()).isFalse(); + + String string = chargeOffResponse.errorBody().string(); + ErrorResponse errorResponse = GSON.fromJson(string, ErrorResponse.class); + String developerMessage = errorResponse.getErrors().get(0).getDeveloperMessage(); + assertThat(developerMessage) + .isEqualTo(String.format("Loan: %s Charge-off is not allowed. Loan Account is interest bearing", loanId)); + } + + @Then("Second Charge-off is not possible on {string}") + public void secondChargeOffLoan(String transactionDate) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + PostLoansLoanIdTransactionsRequest chargeOffRequest = LoanRequestFactory.defaultChargeOffRequest().transactionDate(transactionDate) + .dateFormat(DATE_FORMAT).locale(DEFAULT_LOCALE); + + Response secondChargeOffResponse = loanTransactionsApi + .executeLoanTransaction(loanId, chargeOffRequest, "charge-off").execute(); + testContext().set(TestContextKey.LOAN_CHARGE_OFF_RESPONSE, secondChargeOffResponse); + ErrorResponse errorDetails = ErrorResponse.from(secondChargeOffResponse); + assertThat(errorDetails.getHttpStatusCode()).as(ErrorMessageHelper.chargeOffUndoFailureCodeMsg()).isEqualTo(403); + assertThat(errorDetails.getSingleError().getDeveloperMessage()).isEqualTo(ErrorMessageHelper.secondChargeOffFailure(loanId)); + } + + @And("Admin does a charge-off undo the loan") + public void chargeOffUndo() throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + PostLoansLoanIdTransactionsRequest chargeOffUndoRequest = LoanRequestFactory.defaultUndoChargeOffRequest(); + + Response chargeOffUndoResponse = loanTransactionsApi + .executeLoanTransaction(loanId, chargeOffUndoRequest, "undo-charge-off").execute(); + testContext().set(TestContextKey.LOAN_CHARGE_OFF_UNDO_RESPONSE, chargeOffUndoResponse); + ErrorHelper.checkSuccessfulApiCall(chargeOffUndoResponse); + + Long transactionId = chargeOffUndoResponse.body().getResourceId(); + eventAssertion.assertEventRaised(LoanChargeOffUndoEvent.class, transactionId); + } + + @Then("Charge-off undo is not possible on {string}") + public void chargeOffUndoFailure(String transactionDate) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + Long loanId = loanResponse.body().getLoanId(); + + PostLoansLoanIdTransactionsRequest chargeOffRequest = LoanRequestFactory.defaultChargeOffRequest().transactionDate(transactionDate) + .dateFormat(DATE_FORMAT).locale(DEFAULT_LOCALE); + + Response chargeOffResponse = loanTransactionsApi + .executeLoanTransaction(loanId, chargeOffRequest, "charge-off").execute(); + testContext().set(TestContextKey.LOAN_CHARGE_OFF_RESPONSE, chargeOffResponse); + ErrorResponse errorDetails = ErrorResponse.from(chargeOffResponse); + assertThat(errorDetails.getHttpStatusCode()).as(ErrorMessageHelper.chargeOffUndoFailureCodeMsg()).isEqualTo(403); + assertThat(errorDetails.getSingleError().getDeveloperMessage()).isEqualTo(ErrorMessageHelper.chargeOffUndoFailure(loanId)); + } + + @Then("Charge-off undo is not possible as the loan is not charged-off") + public void chargeOffNotPossibleFailure() throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + Long loanId = loanResponse.body().getLoanId(); + + PostLoansLoanIdTransactionsRequest chargeOffRequest = LoanRequestFactory.defaultUndoChargeOffRequest(); + + Response undoChargeOffResponse = loanTransactionsApi + .executeLoanTransaction(loanId, chargeOffRequest, "undo-charge-off").execute(); + testContext().set(TestContextKey.LOAN_CHARGE_OFF_RESPONSE, undoChargeOffResponse); + ErrorResponse errorDetails = ErrorResponse.from(undoChargeOffResponse); + assertThat(errorDetails.getHttpStatusCode()).as(ErrorMessageHelper.chargeOffUndoFailureCodeMsg()).isEqualTo(403); + assertThat(errorDetails.getSingleError().getDeveloperMessage()).isEqualTo(ErrorMessageHelper.notChargedOffFailure(loanId)); + } + + @When("Admin successfully undo disbursal") + public void undoDisbursal() throws IOException { + Response loanApproveResponse = testContext().get(TestContextKey.LOAN_APPROVAL_RESPONSE); + long loanId = loanApproveResponse.body().getLoanId(); + + PostLoansLoanIdRequest undoDisbursalRequest = new PostLoansLoanIdRequest().note(""); + Response undoLastDisbursalResponse = loansApi + .stateTransitions(loanId, undoDisbursalRequest, "undodisbursal").execute(); + ErrorHelper.checkSuccessfulApiCall(undoLastDisbursalResponse); + } + + @When("Admin successfully undo last disbursal") + public void undoLastDisbursal() throws IOException { + Response loanApproveResponse = testContext().get(TestContextKey.LOAN_APPROVAL_RESPONSE); + long loanId = loanApproveResponse.body().getLoanId(); + + PostLoansLoanIdRequest undoDisbursalRequest = new PostLoansLoanIdRequest().note(""); + Response undoLastDisbursalResponse = loansApi + .stateTransitions(loanId, undoDisbursalRequest, "undolastdisbursal").execute(); + ErrorHelper.checkSuccessfulApiCall(undoLastDisbursalResponse); + } + + @Then("Admin can successfully undone the loan disbursal") + public void checkUndoLoanDisbursal() throws IOException { + Response loanApproveResponse = testContext().get(TestContextKey.LOAN_APPROVAL_RESPONSE); + long loanId = loanApproveResponse.body().getLoanId(); + PostLoansLoanIdRequest undoDisbursalRequest = new PostLoansLoanIdRequest().note(""); + + Response undoDisbursalResponse = loansApi.stateTransitions(loanId, undoDisbursalRequest, "undodisbursal") + .execute(); + testContext().set(TestContextKey.LOAN_UNDO_DISBURSE_RESPONSE, undoDisbursalResponse); + ErrorHelper.checkSuccessfulApiCall(undoDisbursalResponse); + assertThat(undoDisbursalResponse.body().getChanges().getStatus().getValue()).isEqualTo(LOAN_STATE_APPROVED); + } + + @Then("Admin fails to disburse the loan on {string} with {string} EUR transaction amount because of wrong date") + public void disburseLoanFailureWithDate(String actualDisbursementDate, String transactionAmount) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + PostLoansLoanIdRequest disburseRequest = LoanRequestFactory.defaultLoanDisburseRequest() + .actualDisbursementDate(actualDisbursementDate).transactionAmount(new BigDecimal(transactionAmount)); + + Response loanDisburseResponse = loansApi.stateTransitions(loanId, disburseRequest, "disburse").execute(); + testContext().set(TestContextKey.LOAN_DISBURSE_RESPONSE, loanDisburseResponse); + ErrorResponse errorDetails = ErrorResponse.from(loanDisburseResponse); + assertThat(errorDetails.getHttpStatusCode()).as(ErrorMessageHelper.dateFailureErrorCodeMsg()).isEqualTo(403); + assertThat(errorDetails.getSingleError().getDeveloperMessage()).isEqualTo(ErrorMessageHelper.disburseDateFailure((int) loanId)); + } + + @Then("Admin fails to disburse the loan on {string} with {string} EUR transaction amount because of wrong amount") + public void disburseLoanFailureWithAmount(String actualDisbursementDate, String transactionAmount) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + PostLoansLoanIdRequest disburseRequest = LoanRequestFactory.defaultLoanDisburseRequest() + .actualDisbursementDate(actualDisbursementDate).transactionAmount(new BigDecimal(transactionAmount)); + + Response loanDisburseResponse = loansApi.stateTransitions(loanId, disburseRequest, "disburse").execute(); + testContext().set(TestContextKey.LOAN_DISBURSE_RESPONSE, loanDisburseResponse); + ErrorResponse errorDetails = ErrorResponse.from(loanDisburseResponse); + String developerMessage = errorDetails.getSingleError().getDeveloperMessage(); + + assertThat(errorDetails.getHttpStatusCode()).as(ErrorMessageHelper.dateFailureErrorCodeMsg()).isEqualTo(403); + assertThat(developerMessage).matches(ErrorMessageHelper.disburseMaxAmountFailure()); + log.info("Error message: {}", developerMessage); + } + + @Then("Loan has {double} outstanding amount") + public void loanOutstanding(double totalOutstandingExpected) throws IOException { + Response loanCreateResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanCreateResponse.body().getLoanId(); + + Response loanDetailsResponse = loansApi.retrieveLoan(loanId, false, "", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); + testContext().set(TestContextKey.LOAN_RESPONSE, loanDetailsResponse); + + Double totalOutstandingActual = loanDetailsResponse.body().getSummary().getTotalOutstanding(); + assertThat(totalOutstandingActual) + .as(ErrorMessageHelper.wrongAmountInTotalOutstanding(totalOutstandingActual, totalOutstandingExpected)) + .isEqualTo(totalOutstandingExpected); + } + + @Then("Loan has {double} overpaid amount") + public void loanOverpaid(double totalOverpaidExpected) throws IOException { + Response loanCreateResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanCreateResponse.body().getLoanId(); + + Response loanDetailsResponse = loansApi.retrieveLoan(loanId, false, "", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); + testContext().set(TestContextKey.LOAN_RESPONSE, loanDetailsResponse); + + Double totalOverpaidActual = loanDetailsResponse.body().getTotalOverpaid(); + Double totalOutstandingActual = loanDetailsResponse.body().getSummary().getTotalOutstanding(); + double totalOutstandingExpected = 0.0; + assertThat(totalOutstandingActual) + .as(ErrorMessageHelper.wrongAmountInTotalOutstanding(totalOutstandingActual, totalOutstandingExpected)) + .isEqualTo(totalOutstandingExpected); + assertThat(totalOverpaidActual) + .as(ErrorMessageHelper.wrongAmountInTransactionsOverpayment(totalOverpaidActual, totalOverpaidExpected)) + .isEqualTo(totalOverpaidExpected); + } + + @Then("Loan has {double} total overdue amount") + public void loanOverdue(double totalOverdueExpected) throws IOException { + Response loanCreateResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanCreateResponse.body().getLoanId(); + + Response loanDetailsResponse = loansApi.retrieveLoan(loanId, false, "", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); + testContext().set(TestContextKey.LOAN_RESPONSE, loanDetailsResponse); + + Double totalOverdueActual = loanDetailsResponse.body().getSummary().getTotalOverdue(); + assertThat(totalOverdueActual).as(ErrorMessageHelper.wrongAmountInTotalOverdue(totalOverdueActual, totalOverdueExpected)) + .isEqualTo(totalOverdueExpected); + } + + @Then("Loan has {double} last payment amount") + public void loanLastPaymentAmount(double lastPaymentAmountExpected) throws IOException { + Response loanCreateResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanCreateResponse.body().getLoanId(); + + Response loanDetailsResponse = loansApi.retrieveLoan(loanId, false, "", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); + testContext().set(TestContextKey.LOAN_RESPONSE, loanDetailsResponse); + + Double lastPaymentAmountActual = loanDetailsResponse.body().getDelinquent().getLastPaymentAmount(); + assertThat(lastPaymentAmountActual) + .as(ErrorMessageHelper.wrongLastPaymentAmount(lastPaymentAmountActual, lastPaymentAmountExpected)) + .isEqualTo(lastPaymentAmountExpected); + } + + @Then("Loan Repayment schedule has {int} periods, with the following data for periods:") + public void loanRepaymentSchedulePeriodsCheck(int linesExpected, DataTable table) throws IOException { + Response loanCreateResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanCreateResponse.body().getLoanId(); + + Response loanDetailsResponse = loansApi.retrieveLoan(loanId, false, "repaymentSchedule", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); + + List repaymentPeriods = loanDetailsResponse.body().getRepaymentSchedule().getPeriods(); + + List> data = table.asLists(); + int nrLines = data.size(); + int linesActual = (int) repaymentPeriods.stream().filter(r -> r.getPeriod() != null).count(); + for (int i = 1; i < nrLines; i++) { + List expectedValues = data.get(i); + String dueDateExpected = expectedValues.get(2); + + List> actualValuesList = repaymentPeriods.stream() + .filter(r -> dueDateExpected.equals(FORMATTER.format(r.getDueDate()))) + .map(r -> fetchValuesOfRepaymentSchedule(data.get(0), r)).collect(Collectors.toList()); + + boolean containsExpectedValues = actualValuesList.stream().anyMatch(actualValues -> actualValues.equals(expectedValues)); + assertThat(containsExpectedValues) + .as(ErrorMessageHelper.wrongValueInLineInRepaymentSchedule(i, actualValuesList, expectedValues)).isTrue(); + + assertThat(linesActual).as(ErrorMessageHelper.wrongNumberOfLinesInRepaymentSchedule(linesActual, linesExpected)) + .isEqualTo(linesExpected); + } + } + + @Then("Loan Repayment schedule has the following data in Total row:") + public void loanRepaymentScheduleAmountCheck(DataTable table) throws IOException { + List> data = table.asLists(); + List header = data.get(0); + List expectedValues = data.get(1); + Response loanCreateResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanCreateResponse.body().getLoanId(); + + Response loanDetailsResponse = loansApi.retrieveLoan(loanId, false, "repaymentSchedule", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); + + GetLoansLoanIdRepaymentSchedule repaymentSchedule = loanDetailsResponse.body().getRepaymentSchedule(); + validateRepaymentScheduleTotal(header, repaymentSchedule, expectedValues); + } + + @Then("Loan Transactions tab has a transaction with date: {string}, and with the following data:") + public void loanTransactionsTransactionWithGivenDateDataCheck(String date, DataTable table) throws IOException { + Response loanCreateResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanCreateResponse.body().getLoanId(); + + Response loanDetailsResponse = loansApi.retrieveLoan(loanId, false, "transactions", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); + + List transactions = loanDetailsResponse.body().getTransactions(); + + List> data = table.asLists(); + List expectedValues = data.get(1); + + List> actualValuesList = transactions.stream().filter(t -> date.equals(FORMATTER.format(t.getDate()))) + .map(t -> fetchValuesOfTransaction(data.get(0), t)).collect(Collectors.toList()); + boolean containsExpectedValues = actualValuesList.stream().anyMatch(actualValues -> actualValues.equals(expectedValues)); + + assertThat(containsExpectedValues).as(ErrorMessageHelper.wrongValueInLineInTransactionsTab(1, actualValuesList, expectedValues)) + .isTrue(); + } + + @Then("Loan Transactions tab has the following data:") + public void loanTransactionsTabCheck(DataTable table) throws IOException { + Response loanCreateResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanCreateResponse.body().getLoanId(); + Response loanDetailsResponse = loansApi.retrieveLoan(loanId, false, "transactions", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); + List transactions = loanDetailsResponse.body().getTransactions(); + List> data = table.asLists(); + for (int i = 1; i < data.size(); i++) { + List expectedValues = data.get(i); + String transactionDateExpected = expectedValues.get(0); + List> actualValuesList = transactions.stream()// + .filter(t -> transactionDateExpected.equals(FORMATTER.format(t.getDate())))// + .map(t -> fetchValuesOfTransaction(table.row(0), t))// + .collect(Collectors.toList());// + boolean containsExpectedValues = actualValuesList.stream()// + .anyMatch(actualValues -> actualValues.equals(expectedValues));// + assertThat(containsExpectedValues).as(ErrorMessageHelper.wrongValueInLineInTransactionsTab(i, actualValuesList, expectedValues)) + .isTrue(); + } + assertThat(transactions.size()).as(ErrorMessageHelper.nrOfLinesWrongInTransactionsTab(transactions.size(), data.size() - 1)) + .isEqualTo(data.size() - 1); + } + + @Then("In Loan Transactions the latest Transaction has Transaction type={string} and is reverted") + public void loanTransactionsLatestTransactionReverted(String transactionType) throws IOException { + loanTransactionsLatestTransactionReverted(null, transactionType); + } + + @Then("In Loan Transactions the {string}th Transaction has Transaction type={string} and is reverted") + public void loanTransactionsLatestTransactionReverted(String nthTransactionStr, String transactionType) throws IOException { + Response loanCreateResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanCreateResponse.body().getLoanId(); + + Response loanDetailsResponse = loansApi.retrieveLoan(loanId, false, "transactions", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); + + List transactions = loanDetailsResponse.body().getTransactions(); + int nthTransaction = nthTransactionStr == null ? transactions.size() - 1 : Integer.parseInt(nthTransactionStr) - 1; + GetLoansLoanIdTransactions latestTransaction = transactions.get(nthTransaction); + + String transactionTypeActual = latestTransaction.getType().getValue(); + Boolean isReversedActual = latestTransaction.getManuallyReversed(); + + assertThat(transactionTypeActual) + .as(ErrorMessageHelper.wrongDataInTransactionsTransactionType(transactionTypeActual, transactionType)) + .isEqualTo(transactionType); + assertThat(isReversedActual).as(ErrorMessageHelper.transactionIsNotReversedError(isReversedActual, true)).isEqualTo(true); + } + + @Then("On Loan Transactions tab the {string} Transaction with date {string} is reverted") + public void loanTransactionsGivenTransactionReverted(String transactionType, String transactionDate) throws IOException { + Response loanCreateResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanCreateResponse.body().getLoanId(); + + Response loanDetailsResponse = loansApi.retrieveLoan(loanId, false, "transactions", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); + + List transactions = loanDetailsResponse.body().getTransactions(); + List transactionsMatch = transactions// + .stream()// + .filter(t -> transactionDate.equals(FORMATTER.format(t.getDate())) && transactionType.equals(t.getType().getValue()))// + .collect(Collectors.toList());// + boolean isReverted = transactionsMatch.stream().anyMatch(t -> t.getManuallyReversed()); + + assertThat(isReverted).as(ErrorMessageHelper.transactionIsNotReversedError(isReverted, true)).isEqualTo(true); + } + + @Then("On Loan Transactions tab the {string} Transaction with date {string} is NOT reverted") + public void loanTransactionsGivenTransactionNotReverted(String transactionType, String transactionDate) throws IOException { + Response loanCreateResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanCreateResponse.body().getLoanId(); + + Response loanDetailsResponse = loansApi.retrieveLoan(loanId, false, "transactions", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); + + List transactions = loanDetailsResponse.body().getTransactions(); + List transactionsMatch = transactions// + .stream()// + .filter(t -> transactionDate.equals(FORMATTER.format(t.getDate())) && transactionType.equals(t.getType().getValue()))// + .collect(Collectors.toList());// + boolean isReverted = transactionsMatch.stream().anyMatch(t -> t.getManuallyReversed()); + + assertThat(isReverted).as(ErrorMessageHelper.transactionIsNotReversedError(isReverted, false)).isEqualTo(false); + } + + @Then("Loan Charges tab has a given charge with the following data:") + public void loanChargesGivenChargeDataCheck(DataTable table) throws IOException { + Response loanCreateResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanCreateResponse.body().getLoanId(); + + Response loanDetailsResponse = loansApi.retrieveLoan(loanId, false, "charges", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); + List charges = loanDetailsResponse.body().getCharges(); + + List> data = table.asLists(); + List expectedValues = data.get(1); + String paymentDueAtExpected = expectedValues.get(2); + String dueAsOfExpected = expectedValues.get(3); + List> actualValuesList = getActualValuesList(charges, paymentDueAtExpected, dueAsOfExpected); + + boolean containsExpectedValues = actualValuesList.stream().anyMatch(actualValues -> actualValues.equals(expectedValues)); + + assertThat(containsExpectedValues).as(ErrorMessageHelper.wrongValueInLineInChargesTab(1, actualValuesList, expectedValues)) + .isTrue(); + } + + @Then("Loan Charges tab has the following data:") + public void loanChargesTabCheck(DataTable table) throws IOException { + Response loanCreateResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanCreateResponse.body().getLoanId(); + + Response loanDetailsResponse = loansApi.retrieveLoan(loanId, false, "charges", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); + List charges = loanDetailsResponse.body().getCharges(); + + List> data = table.asLists(); + for (int i = 1; i < data.size(); i++) { + List expectedValues = data.get(i); + String paymentDueAtExpected = expectedValues.get(2); + String dueAsOfExpected = expectedValues.get(3); + List> actualValuesList = getActualValuesList(charges, paymentDueAtExpected, dueAsOfExpected); + + boolean containsExpectedValues = actualValuesList.stream().anyMatch(actualValues -> actualValues.equals(expectedValues)); + + assertThat(containsExpectedValues).as(ErrorMessageHelper.wrongValueInLineInChargesTab(i, actualValuesList, expectedValues)) + .isTrue(); + } + } + + private List> getActualValuesList(List charges, String paymentDueAtExpected, + String dueAsOfExpected) { + List result; + + if (dueAsOfExpected != null) { + result = charges.stream().filter(t -> { + LocalDate dueDate = t.getDueDate(); + return dueDate != null && dueAsOfExpected.equals(FORMATTER.format(dueDate)); + }).collect(Collectors.toList()); + } else { + result = charges.stream().filter(t -> paymentDueAtExpected.equals(t.getChargeTimeType().getValue())) + .collect(Collectors.toList()); + } + + return result.stream().map(t -> { + List actualValues = new ArrayList<>(); + actualValues.add(t.getName() == null ? null : t.getName()); + actualValues.add(String.valueOf(t.getPenalty() == null ? null : t.getPenalty())); + actualValues.add(t.getChargeTimeType().getValue() == null ? null : t.getChargeTimeType().getValue()); + actualValues.add(t.getDueDate() == null ? null : FORMATTER.format(t.getDueDate())); + actualValues.add(t.getChargeCalculationType().getValue() == null ? null : t.getChargeCalculationType().getValue()); + actualValues.add(t.getAmount() == null ? null : String.valueOf(t.getAmount())); + actualValues.add(t.getAmountPaid() == null ? null : String.valueOf(t.getAmountPaid())); + actualValues.add(t.getAmountWaived() == null ? null : String.valueOf(t.getAmountWaived())); + actualValues.add(t.getAmountOutstanding() == null ? null : String.valueOf(t.getAmountOutstanding())); + return actualValues; + }).collect(Collectors.toList()); + } + + @Then("Loan status will be {string}") + public void loanStatus(String statusExpected) throws IOException { + Response loanCreateResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanCreateResponse.body().getLoanId(); + + Response loanDetailsResponse = loansApi.retrieveLoan(loanId, false, "", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); + testContext().set(TestContextKey.LOAN_RESPONSE, loanDetailsResponse); + Integer loanStatusActualValue = loanDetailsResponse.body().getStatus().getId(); + + LoanStatus loanStatusExpected = LoanStatus.valueOf(statusExpected); + Integer loanStatusExpectedValue = loanStatusExpected.getValue(); + + assertThat(loanStatusActualValue).as(ErrorMessageHelper.wrongLoanStatus(loanStatusActualValue, loanStatusExpectedValue)) + .isEqualTo(loanStatusExpectedValue); + } + + @Then("Admin can successfully set Fraud flag to the loan") + public void setFraud() throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + Long loanId = loanResponse.body().getResourceId(); + + PutLoansLoanIdRequest putLoansLoanIdRequest = LoanRequestFactory.enableFraudFlag(); + + Response responseMod = loansApi.modifyLoanApplication(loanId, putLoansLoanIdRequest, "markAsFraud") + .execute(); + testContext().set(TestContextKey.LOAN_FRAUD_MODIFY_RESPONSE, responseMod); + + ErrorHelper.checkSuccessfulApiCall(responseMod); + + Response loanDetailsResponse = loansApi.retrieveLoan(loanId, false, "", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); + testContext().set(TestContextKey.LOAN_RESPONSE, loanDetailsResponse); + + Boolean fraudFlagActual = loanDetailsResponse.body().getFraud(); + assertThat(fraudFlagActual).as(ErrorMessageHelper.wrongFraudFlag(fraudFlagActual, true)).isEqualTo(true); + } + + @Then("Admin can successfully unset Fraud flag to the loan") + public void unsetFraud() throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + Long loanId = loanResponse.body().getResourceId(); + + PutLoansLoanIdRequest putLoansLoanIdRequest = LoanRequestFactory.disableFraudFlag(); + + Response responseMod = loansApi.modifyLoanApplication(loanId, putLoansLoanIdRequest, "markAsFraud") + .execute(); + testContext().set(TestContextKey.LOAN_FRAUD_MODIFY_RESPONSE, responseMod); + ErrorHelper.checkSuccessfulApiCall(responseMod); + + Response loanDetailsResponse = loansApi.retrieveLoan(loanId, false, "", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); + testContext().set(TestContextKey.LOAN_RESPONSE, loanDetailsResponse); + + Boolean fraudFlagActual = loanDetailsResponse.body().getFraud(); + assertThat(fraudFlagActual).as(ErrorMessageHelper.wrongFraudFlag(fraudFlagActual, false)).isEqualTo(false); + } + + @Then("Fraud flag modification fails") + public void failedFraudModification() throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + Long loanId = loanResponse.body().getResourceId(); + + PutLoansLoanIdRequest putLoansLoanIdRequest = LoanRequestFactory.disableFraudFlag(); + + Response responseMod = loansApi.modifyLoanApplication(loanId, putLoansLoanIdRequest, "markAsFraud") + .execute(); + testContext().set(TestContextKey.LOAN_FRAUD_MODIFY_RESPONSE, responseMod); + + ErrorResponse errorDetails = ErrorResponse.from(responseMod); + assertThat(errorDetails.getHttpStatusCode()).as(ErrorMessageHelper.dateFailureErrorCodeMsg()).isEqualTo(403); + assertThat(errorDetails.getSingleError().getDeveloperMessage()) + .isEqualTo(ErrorMessageHelper.loanFraudFlagModificationMsg(loanId.toString())); + } + + @Then("Transaction response has boolean value in header {string}: {string}") + public void transactionHeaderCheckBoolean(String headerKey, String headerValue) { + Response paymentTransactionResponse = testContext() + .get(TestContextKey.LOAN_PAYMENT_TRANSACTION_RESPONSE); + String headerValueActual = paymentTransactionResponse.headers().get(headerKey); + assertThat(headerValueActual).as(ErrorMessageHelper.wrongValueInResponseHeader(headerKey, headerValueActual, headerValue)) + .isEqualTo(headerValue); + } + + @Then("Transaction response has {double} EUR value for transaction amount") + public void transactionAmountCheck(double amountExpected) { + Response paymentTransactionResponse = testContext() + .get(TestContextKey.LOAN_PAYMENT_TRANSACTION_RESPONSE); + Double amountActual = Double.valueOf(paymentTransactionResponse.body().getChanges().getTransactionAmount()); + assertThat(amountActual).as(ErrorMessageHelper.wrongAmountInTransactionsResponse(amountActual, amountExpected)) + .isEqualTo(amountExpected); + } + + @Then("Transaction response has the correct clientId and the loanId of the first transaction") + public void transactionClientIdAndLoanIdCheck() { + Response clientResponse = testContext().get(TestContextKey.CLIENT_CREATE_RESPONSE); + Long clientIdExpected = clientResponse.body().getClientId(); + + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + Long loanIdExpected = Long.valueOf(loanResponse.body().getLoanId()); + + Response paymentTransactionResponse = testContext() + .get(TestContextKey.LOAN_PAYMENT_TRANSACTION_RESPONSE); + Long clientIdActual = paymentTransactionResponse.body().getClientId(); + Long loanIdActual = paymentTransactionResponse.body().getLoanId(); + + assertThat(clientIdActual).as(ErrorMessageHelper.wrongClientIdInTransactionResponse(clientIdActual, clientIdExpected)) + .isEqualTo(clientIdExpected); + assertThat(loanIdActual).as(ErrorMessageHelper.wrongLoanIdInTransactionResponse(loanIdActual, loanIdExpected)) + .isEqualTo(loanIdExpected); + } + + @Then("Transaction response has the clientId for the second client and the loanId of the second transaction") + public void transactionSecondClientIdAndSecondLoanIdCheck() { + Response clientResponse = testContext().get(TestContextKey.CLIENT_CREATE_SECOND_CLIENT_RESPONSE); + Long clientIdExpected = clientResponse.body().getClientId(); + + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_SECOND_LOAN_RESPONSE); + Long loanIdExpected = Long.valueOf(loanResponse.body().getLoanId()); + + Response paymentTransactionResponse = testContext() + .get(TestContextKey.LOAN_PAYMENT_TRANSACTION_RESPONSE); + Long clientIdActual = paymentTransactionResponse.body().getClientId(); + Long loanIdActual = paymentTransactionResponse.body().getLoanId(); + + assertThat(clientIdActual).as(ErrorMessageHelper.wrongClientIdInTransactionResponse(clientIdActual, clientIdExpected)) + .isEqualTo(clientIdExpected); + assertThat(loanIdActual).as(ErrorMessageHelper.wrongLoanIdInTransactionResponse(loanIdActual, loanIdExpected)) + .isEqualTo(loanIdExpected); + } + + @Then("Loan has {int} {string} transactions on Transactions tab") + public void checkNrOfTransactions(int nrOfTransactionsExpected, String transactionTypeInput) throws IOException { + TransactionType transactionType = TransactionType.valueOf(transactionTypeInput); + String transactionTypeValue = transactionType.getValue(); + + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + Response loanDetails = loansApi.retrieveLoan(loanId, false, "transactions", "", "").execute(); + + List transactions = loanDetails.body().getTransactions(); + List transactionsMatched = new ArrayList<>(); + + transactions.forEach(t -> { + String transactionTypeValueActual = t.getType().getCode(); + String transactionTypeValueExpected = "loanTransactionType." + transactionTypeValue; + + if (transactionTypeValueActual.equals(transactionTypeValueExpected)) { + transactionsMatched.add(transactionTypeValueActual); + } + }); + + int nrOfTransactionsActual = transactionsMatched.size(); + assertThat(nrOfTransactionsActual) + .as(ErrorMessageHelper.wrongNrOfTransactions(transactionTypeInput, nrOfTransactionsActual, nrOfTransactionsExpected)) + .isEqualTo(nrOfTransactionsExpected); + } + + @Then("Second loan has {int} {string} transactions on Transactions tab") + public void checkNrOfTransactionsOnSecondLoan(int nrOfTransactionsExpected, String transactionTypeInput) throws IOException { + TransactionType transactionType = TransactionType.valueOf(transactionTypeInput); + String transactionTypeValue = transactionType.getValue(); + + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_SECOND_LOAN_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + Response loanDetails = loansApi.retrieveLoan(loanId, false, "transactions", "", "").execute(); + + List transactions = loanDetails.body().getTransactions(); + List transactionsMatched = new ArrayList<>(); + + transactions.forEach(t -> { + String transactionTypeValueActual = t.getType().getCode(); + String transactionTypeValueExpected = "loanTransactionType." + transactionTypeValue; + + if (transactionTypeValueActual.equals(transactionTypeValueExpected)) { + transactionsMatched.add(transactionTypeValueActual); + } + }); + + int nrOfTransactionsActual = transactionsMatched.size(); + assertThat(nrOfTransactionsActual) + .as(ErrorMessageHelper.wrongNrOfTransactions(transactionTypeInput, nrOfTransactionsActual, nrOfTransactionsExpected)) + .isEqualTo(nrOfTransactionsExpected); + } + + @Then("Loan status has changed to {string}") + public void loanStatusHasChangedTo(String loanStatus) { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + LoanStatusEnumDataV1 expectedStatus = getExpectedStatus(loanStatus); + eventAssertion.assertEvent(LoanStatusChangedEvent.class, loanId).extractingData(LoanAccountDataV1::getStatus) + .isEqualTo(expectedStatus); + } + + @Then("Loan marked as charged-off on {string}") + public void isLoanChargedOff(String chargeOffDate) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Response loanDetailsResponse = loansApi.retrieveLoan(loanId, false, "", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); + testContext().set(TestContextKey.LOAN_RESPONSE, loanDetailsResponse); + + LocalDate expectedChargeOffDate = LocalDate.parse(chargeOffDate, FORMATTER); + + assertThat(loanDetailsResponse.body().getChargedOff()).isEqualTo(true); + assertThat(loanDetailsResponse.body().getTimeline().getChargedOffOnDate()).isEqualTo(expectedChargeOffDate); + } + + @And("Admin checks that last closed business date of loan is {string}") + public void getLoanLastCOBDate(String date) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Response loanDetails = loansApi.retrieveLoan(loanId, false, "", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetails); + if ("null".equals(date)) { + assertThat(loanDetails.body().getLastClosedBusinessDate()).isNull(); + } else { + assertThat(FORMATTER.format(Objects.requireNonNull(loanDetails.body().getLastClosedBusinessDate()))).isEqualTo(date); + } + } + + @When("Admin runs COB catch up") + public void runLoanCOBCatchUp() throws IOException { + Response catchUpResponse = loanCobCatchUpApi.executeLoanCOBCatchUp().execute(); + ErrorHelper.checkSuccessfulApiCall(catchUpResponse); + } + + @When("Admin checks that Loan COB is running until the current business date") + public void checkLoanCOBCatchUpRunningUntilCOBBusinessDate() { + await().pollInterval(2, TimeUnit.SECONDS).atMost(Duration.ofSeconds(20)).until(() -> { + Response isCatchUpRunningResponse = loanCobCatchUpApi.isCatchUpRunning().execute(); + ErrorHelper.checkSuccessfulApiCall(isCatchUpRunningResponse); + IsCatchUpRunningResponse isCatchUpRunning = isCatchUpRunningResponse.body(); + return isCatchUpRunning.getIsCatchUpRunning(); + }); + await().pollInterval(2, TimeUnit.SECONDS).atMost(Duration.ofSeconds(240)).until(() -> { + Response isCatchUpRunningResponse = loanCobCatchUpApi.isCatchUpRunning().execute(); + ErrorHelper.checkSuccessfulApiCall(isCatchUpRunningResponse); + IsCatchUpRunningResponse isCatchUpRunning = isCatchUpRunningResponse.body(); + return !isCatchUpRunning.getIsCatchUpRunning(); + }); + } + + @Then("Loan's actualMaturityDate is {string}") + public void checkActualMaturityDate(String actualMaturityDateExpected) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Response loanDetailsResponse = loansApi.retrieveLoan(loanId, false, "", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); + + LocalDate actualMaturityDate = loanDetailsResponse.body().getTimeline().getActualMaturityDate(); + String actualMaturityDateActual = FORMATTER.format(actualMaturityDate); + + assertThat(actualMaturityDateActual) + .as(ErrorMessageHelper.wrongDataInActualMaturityDate(actualMaturityDateActual, actualMaturityDateExpected)) + .isEqualTo(actualMaturityDateExpected); + } + + @Then("LoanAccrualTransactionCreatedBusinessEvent is raised on {string}") + public void checkLoanAccrualTransactionCreatedBusinessEvent(String date) throws IOException { + Response loanCreateResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanCreateResponse.body().getLoanId(); + + Response loanDetailsResponse = loansApi.retrieveLoan(loanId, false, "transactions", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); + + List transactions = loanDetailsResponse.body().getTransactions(); + GetLoansLoanIdTransactions accrualTransaction = transactions.stream() + .filter(t -> date.equals(FORMATTER.format(t.getDate())) && "Accrual".equals(t.getType().getValue())).findFirst() + .orElseThrow(() -> new IllegalStateException(String.format("No Accrual transaction found on %s", date))); + Long accrualTransactionId = accrualTransaction.getId(); + + eventAssertion.assertEventRaised(LoanAccrualTransactionCreatedBusinessEvent.class, accrualTransactionId); + } + + @Then("Loan details and event has the following last repayment related data:") + public void checkLastRepaymentData(DataTable table) throws IOException { + List> data = table.asLists(); + List expectedValues = data.get(1); + String lastPaymentAmountExpected = expectedValues.get(0); + String lastPaymentDateExpected = expectedValues.get(1); + String lastRepaymentAmountExpected = expectedValues.get(2); + String lastRepaymentDateExpected = expectedValues.get(3); + + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + Response loanDetailsResponse = loansApi.retrieveLoan(loanId, false, "collection", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); + + GetLoansLoanIdDelinquencySummary delinquent = loanDetailsResponse.body().getDelinquent(); + String lastPaymentAmountActual = String.valueOf(delinquent.getLastPaymentAmount()); + String lastPaymentDateActual = FORMATTER.format(delinquent.getLastPaymentDate()); + String lastRepaymentAmountActual = String.valueOf(delinquent.getLastRepaymentAmount()); + String lastRepaymentDateActual = FORMATTER.format(delinquent.getLastRepaymentDate()); + + assertThat(lastPaymentAmountActual) + .as(ErrorMessageHelper.wrongDataInLastPaymentAmount(lastPaymentAmountActual, lastPaymentAmountExpected)) + .isEqualTo(lastPaymentAmountExpected); + assertThat(lastPaymentDateActual).as(ErrorMessageHelper.wrongDataInLastPaymentDate(lastPaymentDateActual, lastPaymentDateExpected)) + .isEqualTo(lastPaymentDateExpected); + assertThat(lastRepaymentAmountActual) + .as(ErrorMessageHelper.wrongDataInLastRepaymentAmount(lastRepaymentAmountActual, lastRepaymentAmountExpected)) + .isEqualTo(lastRepaymentAmountExpected); + assertThat(lastRepaymentDateActual) + .as(ErrorMessageHelper.wrongDataInLastRepaymentDate(lastRepaymentDateActual, lastRepaymentDateExpected)) + .isEqualTo(lastRepaymentDateExpected); + + eventAssertion.assertEvent(LoanStatusChangedEvent.class, loanId).extractingData(loanAccountDataV1 -> { + String lastPaymentAmountEvent = String.valueOf(loanAccountDataV1.getDelinquent().getLastPaymentAmount().doubleValue()); + String lastPaymentDateEvent = FORMATTER.format(LocalDate.parse(loanAccountDataV1.getDelinquent().getLastPaymentDate())); + String lastRepaymentAmountEvent = String.valueOf(loanAccountDataV1.getDelinquent().getLastRepaymentAmount().doubleValue()); + String lastRepaymentDateEvent = FORMATTER.format(LocalDate.parse(loanAccountDataV1.getDelinquent().getLastRepaymentDate())); + + assertThat(lastPaymentAmountEvent) + .as(ErrorMessageHelper.wrongDataInLastPaymentAmount(lastPaymentAmountEvent, lastPaymentAmountExpected)) + .isEqualTo(lastPaymentAmountExpected); + assertThat(lastPaymentDateEvent) + .as(ErrorMessageHelper.wrongDataInLastPaymentDate(lastPaymentDateEvent, lastPaymentDateExpected)) + .isEqualTo(lastPaymentDateExpected); + assertThat(lastRepaymentAmountEvent) + .as(ErrorMessageHelper.wrongDataInLastRepaymentAmount(lastRepaymentAmountEvent, lastRepaymentAmountExpected)) + .isEqualTo(lastRepaymentAmountExpected); + assertThat(lastRepaymentDateEvent) + .as(ErrorMessageHelper.wrongDataInLastRepaymentDate(lastRepaymentDateEvent, lastRepaymentDateExpected)) + .isEqualTo(lastRepaymentDateExpected); + + return null; + }); + + } + + @And("Admin does a charge-off undo the loan with reversal external Id") + public void chargeOffUndoWithReversalExternalId() throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + String reversalExternalId = Utils.randomNameGenerator("reversalExtId_", 3); + PostLoansLoanIdTransactionsRequest chargeOffUndoRequest = LoanRequestFactory.defaultUndoChargeOffRequest() + .reversalExternalId(reversalExternalId); + + Response chargeOffUndoResponse = loanTransactionsApi + .executeLoanTransaction(loanId, chargeOffUndoRequest, "undo-charge-off").execute(); + testContext().set(TestContextKey.LOAN_CHARGE_OFF_UNDO_RESPONSE, chargeOffUndoResponse); + ErrorHelper.checkSuccessfulApiCall(chargeOffUndoResponse); + + Long transactionId = chargeOffUndoResponse.body().getResourceId(); + + Response transactionResponse = loanTransactionsApi + .retrieveTransaction(loanId, transactionId, "").execute(); + ErrorHelper.checkSuccessfulApiCall(transactionResponse); + assertThat(transactionResponse.body().getReversalExternalId()).isEqualTo(reversalExternalId); + } + + @Then("Loan Charge-off undo event has reversed on date {string} for charge-off undo") + public void reversedOnDateIsNotNullForEvent(String reversedDate) throws IOException { + Response loanCreateResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanCreateResponse.body().getLoanId(); + + Response loanDetailsResponse = loansApi.retrieveLoan(loanId, false, "transactions", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); + + List transactions = loanDetailsResponse.body().getTransactions(); + GetLoansLoanIdTransactions chargeOffTransaction = transactions.stream().filter(t -> "Charge-off".equals(t.getType().getValue())) + .findFirst().orElseThrow(() -> new IllegalStateException(String.format("No transaction found"))); + Long chargeOffTransactionId = chargeOffTransaction.getId(); + + eventAssertion.assertEvent(LoanChargeOffUndoEvent.class, chargeOffTransactionId).extractingData(loanTransactionDataV1 -> { + String reversedOnDate = FORMATTER.format(LocalDate.parse(loanTransactionDataV1.getReversedOnDate())); + assertThat(reversedOnDate).isEqualTo(reversedDate); + return null; + }); + } + + @Then("Loan has the following maturity data:") + public void checkMaturity(DataTable table) throws IOException { + List> data = table.asLists(); + List expectedValues = data.get(1); + String actualMaturityDateExpected = expectedValues.get(0); + String expectedMaturityDateExpected = expectedValues.get(1); + + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + Response loanDetailsResponse = loansApi.retrieveLoan(loanId, false, "", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); + GetLoansLoanIdTimeline timeline = loanDetailsResponse.body().getTimeline(); + String actualMaturityDateActual = FORMATTER.format(timeline.getActualMaturityDate()); + String expectedMaturityDateActual = FORMATTER.format(timeline.getExpectedMaturityDate()); + + assertThat(actualMaturityDateActual) + .as(ErrorMessageHelper.wrongDataInActualMaturityDate(actualMaturityDateActual, actualMaturityDateExpected)) + .isEqualTo(actualMaturityDateExpected); + assertThat(expectedMaturityDateActual) + .as(ErrorMessageHelper.wrongDataInExpectedMaturityDate(expectedMaturityDateActual, expectedMaturityDateExpected)) + .isEqualTo(expectedMaturityDateExpected); + } + + @Then("Admin successfully deletes the loan with external id") + public void deleteLoanWithExternalId() throws IOException { + Response loanCreateResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + Long loanId = loanCreateResponse.body().getLoanId(); + String loanExternalId = loanCreateResponse.body().getResourceExternalId(); + Response deleteLoanResponse = loansApi.deleteLoanApplication1(loanExternalId).execute(); + assertThat(deleteLoanResponse.body().getLoanId()).isEqualTo(loanId); + assertThat(deleteLoanResponse.body().getResourceExternalId()).isEqualTo(loanExternalId); + } + + @Then("Admin fails to delete the loan with incorrect external id") + public void failedDeleteLoanWithExternalId() throws IOException { + Response loanCreateResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + String loanExternalId = loanCreateResponse.body().getResourceExternalId(); + Response deleteLoanResponse = loansApi.deleteLoanApplication1(loanExternalId.substring(5)).execute(); + ErrorResponse errorDetails = ErrorResponse.from(deleteLoanResponse); + assertThat(errorDetails.getHttpStatusCode()).as(ErrorMessageHelper.dateFailureErrorCodeMsg()).isEqualTo(404); + } + + @When("Admin set {string} loan product {string} transaction type to {string} future installment allocation rule") + public void editFutureInstallmentAllocationTypeForLoanProduct(String loanProductName, String transactionTypeToChange, + String futureInstallmentAllocationRuleNew) throws IOException { + DefaultLoanProduct product = DefaultLoanProduct.valueOf(loanProductName); + Long loanProductId = loanProductResolver.resolve(product); + log.info("loanProductId {}", loanProductId); + + Response loanProductDetails = loanProductsApi.retrieveLoanProductDetails(loanProductId).execute(); + ErrorHelper.checkSuccessfulApiCall(loanProductDetails); + List paymentAllocation = loanProductDetails.body().getPaymentAllocation(); + + List newPaymentAllocation = new ArrayList<>(); + paymentAllocation.forEach(e -> { + String transactionTypeOriginal = e.getTransactionType(); + String futureInstallmentAllocationRule = e.getFutureInstallmentAllocationRule(); + if (transactionTypeToChange.equals(transactionTypeOriginal)) { + futureInstallmentAllocationRule = futureInstallmentAllocationRuleNew; + } + newPaymentAllocation.add( + LoanProductGlobalInitializerStep.createPaymentAllocation(transactionTypeOriginal, futureInstallmentAllocationRule)); + }); + + PutLoanProductsProductIdRequest putLoanProductsProductIdRequest = new PutLoanProductsProductIdRequest() + .transactionProcessingStrategyCode(ADVANCED_PAYMENT_ALLOCATION.getValue()).paymentAllocation(newPaymentAllocation); + + Response response = loanProductsApi + .updateLoanProduct(loanProductId, putLoanProductsProductIdRequest).execute(); + ErrorHelper.checkSuccessfulApiCall(response); + } + + @When("Admin sets repaymentStartDateType for {string} loan product to {string}") + public void editRepaymentStartDateType(String loanProductName, String repaymentStartDateType) throws IOException { + DefaultLoanProduct product = DefaultLoanProduct.valueOf(loanProductName); + Long loanProductId = loanProductResolver.resolve(product); + log.info("loanProductId {}", loanProductId); + + Map repaymentStartDateTypeMap = Map.of("DISBURSEMENT_DATE", 1, "SUBMITTED_ON_DATE", 2); + + if (!repaymentStartDateTypeMap.containsKey(repaymentStartDateType)) { + throw new IllegalArgumentException(String + .format("Invalid repaymentStartDateType: %s. Must be DISBURSEMENT_DATE or SUBMITTED_ON_DATE.", repaymentStartDateType)); + } + + int repaymentStartDateTypeValue = repaymentStartDateTypeMap.get(repaymentStartDateType); + PutLoanProductsProductIdRequest putLoanProductsProductIdRequest = new PutLoanProductsProductIdRequest()// + .repaymentStartDateType(repaymentStartDateTypeValue)// + .locale(DEFAULT_LOCALE);// + + Response response = loanProductsApi + .updateLoanProduct(loanProductId, putLoanProductsProductIdRequest).execute(); + ErrorHelper.checkSuccessfulApiCall(response); + } + + @And("Admin does write-off the loan on {string}") + public void writeOffLoan(String transactionDate) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + PostLoansLoanIdTransactionsRequest writeOffRequest = LoanRequestFactory.defaultWriteOffRequest().transactionDate(transactionDate) + .dateFormat(DATE_FORMAT).locale(DEFAULT_LOCALE); + + Response writeOffResponse = loanTransactionsApi + .executeLoanTransaction(loanId, writeOffRequest, "writeoff").execute(); + testContext().set(TestContextKey.LOAN_WRITE_OFF_RESPONSE, writeOffResponse); + ErrorHelper.checkSuccessfulApiCall(writeOffResponse); + } + + @Then("Admin fails to undo {string}th transaction made on {string}") + public void undoTransaction(String nthTransaction, String transactionDate) throws IOException { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DATE_FORMAT); + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + List transactions = loansApi.retrieveLoan(loanId, false, "transactions", "", "").execute().body() + .getTransactions(); + + int nthItem = Integer.parseInt(nthTransaction) - 1; + GetLoansLoanIdTransactions targetTransaction = transactions.stream() + .filter(t -> transactionDate.equals(formatter.format(t.getDate()))).toList().get(nthItem); + + PostLoansLoanIdTransactionsTransactionIdRequest transactionUndoRequest = LoanRequestFactory.defaultTransactionUndoRequest() + .transactionDate(transactionDate); + + Response transactionUndoResponse = loanTransactionsApi + .adjustLoanTransaction(loanId, targetTransaction.getId(), transactionUndoRequest, "").execute(); + ErrorResponse errorDetails = ErrorResponse.from(transactionUndoResponse); + assertThat(errorDetails.getHttpStatusCode()).as(ErrorMessageHelper.dateFailureErrorCodeMsg()).isEqualTo(503); + + } + + @Then("Loan {string} repayment transaction on {string} with {double} EUR transaction amount results in error") + public void loanTransactionWithErrorCheck(String repaymentType, String transactionDate, double transactionAmount) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + DefaultPaymentType paymentType = DefaultPaymentType.valueOf(repaymentType); + long paymentTypeValue = paymentTypeResolver.resolve(paymentType); + + Map headerMap = new HashMap<>(); + + PostLoansLoanIdTransactionsRequest repaymentRequest = LoanRequestFactory.defaultRepaymentRequest().transactionDate(transactionDate) + .transactionAmount(transactionAmount).paymentTypeId(paymentTypeValue).dateFormat(DATE_FORMAT).locale(DEFAULT_LOCALE); + + Response repaymentResponse = loanTransactionsApi + .executeLoanTransaction(loanId, repaymentRequest, "repayment", headerMap).execute(); + + ErrorResponse errorDetails = ErrorResponse.from(repaymentResponse); + assertThat(errorDetails.getHttpStatusCode()).as(ErrorMessageHelper.dateFailureErrorCodeMsg()).isEqualTo(400); + + } + + @Then("Loan details has the downpayment amount {string} in summary.totalRepaymentTransaction") + public void totalRepaymentTransaction(String expectedAmount) throws IOException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Response loanDetails = loansApi.retrieveLoan(loanId, false, "", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetails); + + Double expectedAmountParsed = Double.parseDouble(expectedAmount); + Double totalRepaymentTransaction = loanDetails.body().getSummary().getTotalRepaymentTransaction(); + + assertThat(totalRepaymentTransaction) + .as(ErrorMessageHelper.wrongAmountInTotalRepaymentTransaction(totalRepaymentTransaction, expectedAmountParsed)) + .isEqualTo(expectedAmountParsed); + } + + @Then("LoanDetails has fixedLength field with int value: {int}") + public void checkLoanDetailsFieldAndValueInt(int fieldValue) throws IOException, NoSuchMethodException { + Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanResponse.body().getLoanId(); + + Response loanDetails = loansApi.retrieveLoan(loanId, false, "", "", "").execute(); + ErrorHelper.checkSuccessfulApiCall(loanDetails); + + Integer fixedLengthactual = loanDetails.body().getFixedLength(); + assertThat(fixedLengthactual).as(ErrorMessageHelper.wrongfixedLength(fixedLengthactual, fieldValue)).isEqualTo(fieldValue); + } + + private LoanStatusEnumDataV1 getExpectedStatus(String loanStatus) { + LoanStatusEnumDataV1 result = new LoanStatusEnumDataV1(); + switch (loanStatus) { + case "Submitted and pending approval" -> { + result.setId(100); + result.setCode("loanStatusType.submitted.and.pending.approval"); + result.setValue("Submitted and pending approval"); + result.setPendingApproval(true); + result.setWaitingForDisbursal(false); + result.setActive(false); + result.setClosedObligationsMet(false); + result.setClosedWrittenOff(false); + result.setClosedRescheduled(false); + result.setClosed(false); + result.setOverpaid(false); + } + case "Approved" -> { + result.setId(200); + result.setCode("loanStatusType.approved"); + result.setValue("Approved"); + result.setPendingApproval(false); + result.setWaitingForDisbursal(true); + result.setActive(false); + result.setClosedObligationsMet(false); + result.setClosedWrittenOff(false); + result.setClosedRescheduled(false); + result.setClosed(false); + result.setOverpaid(false); + } + case "Active" -> { + result.setId(300); + result.setCode("loanStatusType.active"); + result.setValue("Active"); + result.setPendingApproval(false); + result.setWaitingForDisbursal(false); + result.setActive(true); + result.setClosedObligationsMet(false); + result.setClosedWrittenOff(false); + result.setClosedRescheduled(false); + result.setClosed(false); + result.setOverpaid(false); + } + case "Closed (obligations met)" -> { + result.setId(600); + result.setCode("loanStatusType.closed.obligations.met"); + result.setValue("Closed (obligations met)"); + result.setPendingApproval(false); + result.setWaitingForDisbursal(false); + result.setActive(false); + result.setClosedObligationsMet(true); + result.setClosedWrittenOff(false); + result.setClosedRescheduled(false); + result.setClosed(true); + result.setOverpaid(false); + } + case "Overpaid" -> { + result.setId(700); + result.setCode("loanStatusType.overpaid"); + result.setValue("Overpaid"); + result.setPendingApproval(false); + result.setWaitingForDisbursal(false); + result.setActive(false); + result.setClosedObligationsMet(false); + result.setClosedWrittenOff(false); + result.setClosedRescheduled(false); + result.setClosed(false); + result.setOverpaid(true); + + } + default -> throw new UnsupportedOperationException("Not yet covered loan status: " + loanStatus); + } + return result; + } + + @SuppressFBWarnings("SF_SWITCH_NO_DEFAULT") + private List fetchValuesOfTransaction(List header, GetLoansLoanIdTransactions t) { + List actualValues = new ArrayList<>(); + for (String headerName : header) { + switch (headerName) { + case "Transaction date" -> actualValues.add(t.getDate() == null ? null : FORMATTER.format(t.getDate())); + case "Transaction Type" -> actualValues.add(t.getType().getValue() == null ? null : t.getType().getValue()); + case "Amount" -> actualValues.add(t.getAmount() == null ? null : String.valueOf(t.getAmount())); + case "Principal" -> actualValues.add(t.getPrincipalPortion() == null ? null : String.valueOf(t.getPrincipalPortion())); + case "Interest" -> actualValues.add(t.getInterestPortion() == null ? null : String.valueOf(t.getInterestPortion())); + case "Fees" -> actualValues.add(t.getFeeChargesPortion() == null ? null : String.valueOf(t.getFeeChargesPortion())); + case "Penalties" -> + actualValues.add(t.getPenaltyChargesPortion() == null ? null : String.valueOf(t.getPenaltyChargesPortion())); + case "Loan Balance" -> + actualValues.add(t.getOutstandingLoanBalance() == null ? null : String.valueOf(t.getOutstandingLoanBalance())); + case "Overpayment" -> + actualValues.add(t.getOverpaymentPortion() == null ? null : String.valueOf(t.getOverpaymentPortion())); + case "Reverted" -> actualValues.add(t.getManuallyReversed() == null ? null : String.valueOf(t.getManuallyReversed())); + } + } + return actualValues; + } + + @SuppressFBWarnings("SF_SWITCH_NO_DEFAULT") + private List fetchValuesOfRepaymentSchedule(List header, GetLoansLoanIdRepaymentPeriod repaymentPeriod) { + List actualValues = new ArrayList<>(); + for (String headerName : header) { + switch (headerName) { + case "Nr" -> actualValues.add(repaymentPeriod.getPeriod() == null ? null : String.valueOf(repaymentPeriod.getPeriod())); + case "Days" -> + actualValues.add(repaymentPeriod.getDaysInPeriod() == null ? null : String.valueOf(repaymentPeriod.getDaysInPeriod())); + case "Date" -> + actualValues.add(repaymentPeriod.getDueDate() == null ? null : FORMATTER.format(repaymentPeriod.getDueDate())); + case "Paid date" -> actualValues.add(repaymentPeriod.getObligationsMetOnDate() == null ? null + : FORMATTER.format(repaymentPeriod.getObligationsMetOnDate())); + case "Balance of loan" -> actualValues.add(repaymentPeriod.getPrincipalLoanBalanceOutstanding() == null ? null + : String.valueOf(repaymentPeriod.getPrincipalLoanBalanceOutstanding())); + case "Principal due" -> + actualValues.add(repaymentPeriod.getPrincipalDue() == null ? null : String.valueOf(repaymentPeriod.getPrincipalDue())); + case "Interest" -> + actualValues.add(repaymentPeriod.getInterestDue() == null ? null : String.valueOf(repaymentPeriod.getInterestDue())); + case "Fees" -> actualValues + .add(repaymentPeriod.getFeeChargesDue() == null ? null : String.valueOf(repaymentPeriod.getFeeChargesDue())); + case "Penalties" -> actualValues.add( + repaymentPeriod.getPenaltyChargesDue() == null ? null : String.valueOf(repaymentPeriod.getPenaltyChargesDue())); + case "Due" -> actualValues.add( + repaymentPeriod.getTotalDueForPeriod() == null ? null : String.valueOf(repaymentPeriod.getTotalDueForPeriod())); + case "Paid" -> actualValues.add( + repaymentPeriod.getTotalPaidForPeriod() == null ? null : String.valueOf(repaymentPeriod.getTotalPaidForPeriod())); + case "In advance" -> actualValues.add(repaymentPeriod.getTotalPaidInAdvanceForPeriod() == null ? null + : String.valueOf(repaymentPeriod.getTotalPaidInAdvanceForPeriod())); + case "Late" -> actualValues.add(repaymentPeriod.getTotalPaidLateForPeriod() == null ? null + : String.valueOf(repaymentPeriod.getTotalPaidLateForPeriod())); + case "Waived" -> actualValues.add(repaymentPeriod.getTotalWaivedForPeriod() == null ? null + : String.valueOf(repaymentPeriod.getTotalWaivedForPeriod())); + case "Outstanding" -> actualValues.add(repaymentPeriod.getTotalOutstandingForPeriod() == null ? null + : String.valueOf(repaymentPeriod.getTotalOutstandingForPeriod())); + } + } + return actualValues; + } + + @SuppressFBWarnings("SF_SWITCH_NO_DEFAULT") + private List validateRepaymentScheduleTotal(List header, GetLoansLoanIdRepaymentSchedule repaymentSchedule, + List expectedAmounts) { + List actualValues = new ArrayList<>(); + // total paid for all periods + Double paidActual = 0.0; + List periods = repaymentSchedule.getPeriods(); + for (GetLoansLoanIdRepaymentPeriod period : periods) { + if (null != period.getTotalPaidForPeriod()) { + paidActual += period.getTotalPaidForPeriod(); + } + } + BigDecimal paidActualBd = new BigDecimal(paidActual).setScale(2, RoundingMode.HALF_DOWN); + + for (int i = 0; i < header.size(); i++) { + String headerName = header.get(i); + String expectedValue = expectedAmounts.get(i); + switch (headerName) { + case "Principal due" -> assertThat(repaymentSchedule.getTotalPrincipalExpected())// + .as(ErrorMessageHelper.wrongAmountInRepaymentSchedulePrincipal(repaymentSchedule.getTotalPrincipalExpected(), + Double.valueOf(expectedValue)))// + .isEqualTo(Double.valueOf(expectedValue));// + case "Interest" -> assertThat(repaymentSchedule.getTotalInterestCharged())// + .as(ErrorMessageHelper.wrongAmountInRepaymentScheduleInterest(repaymentSchedule.getTotalInterestCharged(), + Double.valueOf(expectedValue)))// + .isEqualTo(Double.valueOf(expectedValue));// + case "Fees" -> assertThat(repaymentSchedule.getTotalFeeChargesCharged())// + .as(ErrorMessageHelper.wrongAmountInRepaymentScheduleFees(repaymentSchedule.getTotalFeeChargesCharged(), + Double.valueOf(expectedValue)))// + .isEqualTo(Double.valueOf(expectedValue));// + case "Penalties" -> assertThat(repaymentSchedule.getTotalPenaltyChargesCharged())// + .as(ErrorMessageHelper.wrongAmountInRepaymentSchedulePenalties(repaymentSchedule.getTotalPenaltyChargesCharged(), + Double.valueOf(expectedValue)))// + .isEqualTo(Double.valueOf(expectedValue));// + case "Due" -> assertThat(repaymentSchedule.getTotalRepaymentExpected())// + .as(ErrorMessageHelper.wrongAmountInRepaymentScheduleDue(repaymentSchedule.getTotalRepaymentExpected(), + Double.valueOf(expectedValue)))// + .isEqualTo(Double.valueOf(expectedValue));// + case "Paid" -> assertThat(paidActualBd.doubleValue())// + .as(ErrorMessageHelper.wrongAmountInRepaymentSchedulePaid(paidActualBd.doubleValue(), + Double.valueOf(expectedValue)))// + .isEqualTo(Double.valueOf(expectedValue));// + case "In advance" -> assertThat(repaymentSchedule.getTotalPaidInAdvance())// + .as(ErrorMessageHelper.wrongAmountInRepaymentScheduleInAdvance(repaymentSchedule.getTotalPaidInAdvance(), + Double.valueOf(expectedValue)))// + .isEqualTo(Double.valueOf(expectedValue));// + case "Late" -> assertThat(repaymentSchedule.getTotalPaidLate())// + .as(ErrorMessageHelper.wrongAmountInRepaymentScheduleLate(repaymentSchedule.getTotalPaidLate(), + Double.valueOf(expectedValue)))// + .isEqualTo(Double.valueOf(expectedValue));// + case "Waived" -> assertThat(repaymentSchedule.getTotalWaived())// + .as(ErrorMessageHelper.wrongAmountInRepaymentScheduleWaived(repaymentSchedule.getTotalWaived(), + Double.valueOf(expectedValue)))// + .isEqualTo(Double.valueOf(expectedValue));// + case "Outstanding" -> assertThat(repaymentSchedule.getTotalOutstanding())// + .as(ErrorMessageHelper.wrongAmountInRepaymentScheduleOutstanding(repaymentSchedule.getTotalOutstanding(), + Double.valueOf(expectedValue)))// + .isEqualTo(Double.valueOf(expectedValue));// + } + } + return actualValues; + } +} diff --git a/fineract-e2e-tests-runner/src/test/resources/features/AssetExternalization.feature b/fineract-e2e-tests-runner/src/test/resources/features/AssetExternalization.feature new file mode 100644 index 00000000000..6a8dbbbd3d7 --- /dev/null +++ b/fineract-e2e-tests-runner/src/test/resources/features/AssetExternalization.feature @@ -0,0 +1,1768 @@ +@AssetExternalizationFeature +Feature: Asset Externalization + + @TestRailId:C2722 + Scenario: Verify that all fields and values are correct in case of a SALES request by loan id and user-generated transferExternalId + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, user-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + Then Fetching Asset externalization details by loan external id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + Then Fetching Asset externalization details by transfer external id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + Then Asset externalization details has the generated transferExternalId + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2723 + Scenario: Verify that all fields and values are correct in case of a SALES request by loan id system-generated transferExternalId + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + Then Fetching Asset externalization details by loan external id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + Then Fetching Asset externalization details by transfer external id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + Then Asset externalization details has the generated transferExternalId + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2724 + Scenario: Verify that all fields and values are correct in case of a SALES request by loan external id user-generated transferExternalId + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan external ID with unique ownerExternalId, user-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + Then Fetching Asset externalization details by loan external id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + Then Fetching Asset externalization details by transfer external id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + Then Asset externalization details has the generated transferExternalId + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2725 + Scenario: Verify that all fields and values are correct in case of a SALES request by loan external id system-generated transferExternalId + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan external ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + Then Fetching Asset externalization details by loan external id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + Then Fetching Asset externalization details by transfer external id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + Then Asset externalization details has the generated transferExternalId + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2727 + Scenario: Verify that Asset externalization details are correct after CoB in case of a SALES request by loan id + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + When Admin sets the business date to "22 May 2023" + When Admin runs inline COB job for Loan + Then Fetching Asset externalization details by loan id gives numberOfElements: 2 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2729 + Scenario: Verify that Asset externalization details has the correct data in case of a BUYBACK request placed before the settlementDate with a same settlementDate as the sales one + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + When Admin sets the business date to "10 May 2023" + When Admin runs inline COB job for Loan + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | buyback | 2023-05-21 | | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 2 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + | 2023-05-21 | 1 | BUYBACK | 2023-05-10 | 9999-12-31 | BUYBACK | + When Admin sets the business date to "22 May 2023" + When Admin runs inline COB job for Loan + Then Fetching Asset externalization details by loan id gives numberOfElements: 4 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | BUYBACK | 2023-05-10 | 2023-05-21 | BUYBACK | + | 2023-05-21 | 1 | CANCELLED | 2023-05-21 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | CANCELLED | 2023-05-21 | 2023-05-21 | BUYBACK | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2730 + Scenario: Verify that Asset externalization details has the correct data in case of a BUYBACK request placed on a business date before the settlementDate of sales request and with a settlementDate for buyback after the sales got active + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + When Admin sets the business date to "10 May 2023" + When Admin runs inline COB job for Loan + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | buyback | 2023-05-30 | | + Then Fetching Asset externalization details by loan id gives numberOfElements: 2 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-10 | 9999-12-31 | BUYBACK | + When Admin sets the business date to "22 May 2023" + When Admin runs inline COB job for Loan + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-10 | 9999-12-31 | BUYBACK | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + When Admin sets the business date to "31 May 2023" + When Admin runs inline COB job for Loan + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-10 | 2023-05-30 | BUYBACK | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 2023-05-30 | SALE | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2731 + Scenario: Verify that Asset externalization details has the correct data in case of a BUYBACK request placed after the settlementDate + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + When Admin sets the business date to "22 May 2023" + When Admin runs inline COB job for Loan + Then LoanOwnershipTransferBusinessEvent is created + Then LoanAccountSnapshotBusinessEvent is created + Then Fetching Asset externalization details by loan id gives numberOfElements: 2 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + When Admin sets the business date to "25 May 2023" + When Admin runs inline COB job for Loan + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | buyback | 2023-05-30 | | + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-25 | 9999-12-31 | BUYBACK | + When Admin sets the business date to "31 May 2023" + When Admin runs inline COB job for Loan + Then LoanOwnershipTransferBusinessEvent is created + Then LoanAccountSnapshotBusinessEvent is created + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 2023-05-30 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-25 | 2023-05-30 | BUYBACK | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2732 + Scenario: Verify that BUYBACK request on a loan with PENDING ownership where BUYBACK settlement date is earlier than SALE settlement date results an error + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + When Admin sets the business date to "10 May 2023" + When Admin runs inline COB job for Loan + Then BUYBACK transaction results a 403 error and proper error message when its settlementDate is earlier than the original settlementDate + | Transaction type | settlementDate | + | buyback | 2023-05-15 | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2733 + Scenario: Verify that SALES request on a fully paid loan results an error + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + When Admin sets the business date to "10 May 2023" + And Customer makes "AUTOPAY" repayment on "10 May 2023" with 1000 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Asset externalization transaction with the following data results a 403 error and "LOAN_NOT_ACTIVE" error message + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2734 + Scenario: Verify that SALES request on an overpaid loan results an error + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + When Admin sets the business date to "10 May 2023" + And Customer makes "AUTOPAY" repayment on "10 May 2023" with 1200 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Asset externalization transaction with the following data results a 403 error and "LOAN_NOT_ACTIVE" error message + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2735 + Scenario: Verify that SALES request on a loan with ACTIVE ownership results an error + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + When Admin sets the business date to "22 May 2023" + When Admin runs inline COB job for Loan + Then LoanOwnershipTransferBusinessEvent is created + Then LoanAccountSnapshotBusinessEvent is created + Then Fetching Asset externalization details by loan id gives numberOfElements: 2 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + When Admin sets the business date to "25 May 2023" + Then Asset externalization transaction with the following data results a 403 error and "ASSET_OWNED_CANNOT_BE_SOLD" error message + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-30 | 1 | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2736 + Scenario: Verify that BUYBACK request on a fully paid loan can be done successfully + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + When Admin sets the business date to "22 May 2023" + When Admin runs inline COB job for Loan + Then LoanOwnershipTransferBusinessEvent is created + Then LoanAccountSnapshotBusinessEvent is created + Then Fetching Asset externalization details by loan id gives numberOfElements: 2 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + When Admin sets the business date to "25 May 2023" + And Customer makes "AUTOPAY" repayment on "25 May 2023" with 1000 EUR transaction amount and check external owner + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | buyback | 2023-05-30 | | + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-25 | 9999-12-31 | BUYBACK | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2737 + Scenario: Verify that BUYBACK request on an overpaid loan can be done successfully + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + When Admin sets the business date to "22 May 2023" + When Admin runs inline COB job for Loan + Then LoanOwnershipTransferBusinessEvent is created + Then LoanAccountSnapshotBusinessEvent is created + Then Fetching Asset externalization details by loan id gives numberOfElements: 2 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + When Admin sets the business date to "25 May 2023" + And Customer makes "AUTOPAY" repayment on "25 May 2023" with 1200 EUR transaction amount and check external owner + Then Loan status will be "OVERPAID" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | buyback | 2023-05-30 | | + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-25 | 9999-12-31 | BUYBACK | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2738 + Scenario: Verify that BUYBACK request on a loan with INACTIVE ownership results an error + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + Then Asset externalization transaction with the following data results a 403 error and "ASSET_NOT_OWNED_CANNOT_BE_BOUGHT" error message + | Transaction type | settlementDate | purchasePriceRatio | + | buyback | 2023-05-21 | | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2739 + Scenario: Verify that SALES request can NOT be placed on a loan which is not APPROVED yet + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + Then Loan status will be "SUBMITTED_AND_PENDING_APPROVAL" + Then Asset externalization transaction with the following data results a 403 error and "LOAN_NOT_ACTIVE" error message + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-30 | 1 | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2740 + Scenario: Verify that SALES request can NOT be placed on a loan which is not DISBURSED yet + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + Then Loan status will be "APPROVED" + Then Asset externalization transaction with the following data results a 403 error and "LOAN_NOT_ACTIVE" error message + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-30 | 1 | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2741 + Scenario: Verify that SALES request on a loan with PENDING ownership results an error + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + When Admin sets the business date to "10 May 2023" + When Admin runs inline COB job for Loan + Then Asset externalization transaction with the following data results a 403 error and "ALREADY_PENDING" error message + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-30 | 1 | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2742 + Scenario: Verify that SALES with settlement date earlier than actual business date results an error + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + Then Asset externalization transaction with the following data results a 403 error and "SETTLEMENT_DATE_IN_THE_PAST" error message + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-04-21 | 1 | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2743 + Scenario: Verify that SALES with null owner external id results an error + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + Then Asset externalization SALES transaction with ownerExternalId = null and the following data results a 400 error and "INVALID_REQUEST" error message + | settlementDate | purchasePriceRatio | + | 2023-05-21 | 1 | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2744 + Scenario: Verify that SALES with null purchase price ratio results an error + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + Then Asset externalization transaction with the following data results a 400 error and "INVALID_REQUEST" error message + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2745 + Scenario: Verify that SALES with null settlement date results an error + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + Then Asset externalization transaction with the following data results a 400 error and "INVALID_REQUEST" error message + | Transaction type | settlementDate | purchasePriceRatio | + | sale | | 1 | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2746 + Scenario: Verify that BUYBACK request on a loan with PENDING BUYBACK ownership result an error + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + When Admin sets the business date to "22 May 2023" + When Admin runs inline COB job for Loan + Then LoanOwnershipTransferBusinessEvent is created + Then LoanAccountSnapshotBusinessEvent is created + Then Fetching Asset externalization details by loan id gives numberOfElements: 2 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + When Admin sets the business date to "25 May 2023" + When Admin runs inline COB job for Loan + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | buyback | 2023-05-30 | | + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-25 | 9999-12-31 | BUYBACK | + When Admin sets the business date to "28 May 2023" + When Admin runs inline COB job for Loan + Then Asset externalization transaction with the following data results a 403 error and "BUYBACK_ALREADY_IN_PROGRESS_CANNOT_BE_BOUGHT" error message + | Transaction type | settlementDate | purchasePriceRatio | + | buyback | 2023-05-30 | | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2747 + Scenario: Verify that BUYBACK with settlement date earlier than actual business date results an error + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + When Admin sets the business date to "22 May 2023" + When Admin runs inline COB job for Loan + Then LoanOwnershipTransferBusinessEvent is created + Then LoanAccountSnapshotBusinessEvent is created + Then Fetching Asset externalization details by loan id gives numberOfElements: 2 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + When Admin sets the business date to "25 May 2023" + When Admin runs inline COB job for Loan + Then Asset externalization transaction with the following data results a 403 error and "SETTLEMENT_DATE_IN_THE_PAST" error message + | Transaction type | settlementDate | purchasePriceRatio | + | buyback | 2023-05-21 | | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2748 + Scenario: Verify that BUYBACK with ownerExternalId=NULL can be placed, and results a 200OK response + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + When Admin sets the business date to "22 May 2023" + When Admin runs inline COB job for Loan + Then LoanOwnershipTransferBusinessEvent is created + Then LoanAccountSnapshotBusinessEvent is created + Then Fetching Asset externalization details by loan id gives numberOfElements: 2 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + When Admin sets the business date to "25 May 2023" + When Admin runs inline COB job for Loan + When Admin makes asset externalization BUYBACK request with ownerExternalId = null and settlement date "2023-05-30" by Loan ID with system-generated transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-25 | 9999-12-31 | BUYBACK | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2749 + Scenario: Verify that BUYBACK with purchasePriceRatio=NULL can be placed, and results a 200OK response + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + When Admin sets the business date to "22 May 2023" + When Admin runs inline COB job for Loan + Then LoanOwnershipTransferBusinessEvent is created + Then LoanAccountSnapshotBusinessEvent is created + Then Fetching Asset externalization details by loan id gives numberOfElements: 2 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + When Admin sets the business date to "25 May 2023" + When Admin runs inline COB job for Loan + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | buyback | 2023-05-30 | | + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-25 | 9999-12-31 | BUYBACK | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2750 + Scenario: Verify that SALES with null settlement date results an error + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + When Admin sets the business date to "22 May 2023" + When Admin runs inline COB job for Loan + Then LoanOwnershipTransferBusinessEvent is created + Then LoanAccountSnapshotBusinessEvent is created + Then Fetching Asset externalization details by loan id gives numberOfElements: 2 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + When Admin sets the business date to "25 May 2023" + When Admin runs inline COB job for Loan + Then Asset externalization transaction with the following data results a 400 error and "INVALID_REQUEST" error message + | Transaction type | settlementDate | purchasePriceRatio | + | buyback | | | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2751 @AssetExternalizationJournalEntry + Scenario: Verify that Asset externalization SALES and BUYBACK has the correct Journal entries: no other transactions + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + When Admin sets the business date to "22 May 2023" + When Admin runs inline COB job for Loan + Then LoanOwnershipTransferBusinessEvent is created + Then LoanAccountSnapshotBusinessEvent is created + Then Fetching Asset externalization details by loan id gives numberOfElements: 2 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + Then The latest asset externalization transaction with "ACTIVE" status has the following TRANSFER Journal entries: + | glAccountType | glAccountCode | glAccountName | entryType | amount | + | ASSET | 112601 | Loans Receivable | CREDIT | 1000.00 | + | ASSET | 146000 | Asset transfer | DEBIT | 1000.00 | + | ASSET | 112601 | Loans Receivable | DEBIT | 1000.00 | + | ASSET | 146000 | Asset transfer | CREDIT | 1000.00 | + Then The asset external owner has the following OWNER Journal entries: + | glAccountType | glAccountCode | glAccountName | entryType | amount | + | ASSET | 112601 | Loans Receivable | DEBIT | 1000.00 | + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | buyback | 2023-05-30 | | + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-22 | 9999-12-31 | BUYBACK | + When Admin sets the business date to "31 May 2023" + When Admin runs inline COB job for Loan + Then LoanOwnershipTransferBusinessEvent is created + Then LoanAccountSnapshotBusinessEvent is created + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 2023-05-30 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-22 | 2023-05-30 | BUYBACK | + Then The latest asset externalization transaction with "BUYBACK" status has the following TRANSFER Journal entries: + | glAccountType | glAccountCode | glAccountName | entryType | amount | + | ASSET | 112601 | Loans Receivable | DEBIT | 1000.00 | + | ASSET | 146000 | Asset transfer | CREDIT | 1000.00 | + | ASSET | 112601 | Loans Receivable | CREDIT | 1000.00 | + | ASSET | 146000 | Asset transfer | DEBIT | 1000.00 | + Then The asset external owner has the following OWNER Journal entries: + | glAccountType | glAccountCode | glAccountName | entryType | amount | + | ASSET | 112601 | Loans Receivable | DEBIT | 1000.00 | + | ASSET | 112601 | Loans Receivable | CREDIT | 1000.00 | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2752 @AssetExternalizationJournalEntry + Scenario: Verify that Asset externalization SALES and BUYBACK has the correct Journal entries: fee applied before sale, and penalty applied before buyback + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "10 May 2023" due date and 10 EUR transaction amount + When Admin sets the business date to "10 May 2023" + When Admin runs inline COB job for Loan + When Admin sets the business date to "22 May 2023" + When Admin runs inline COB job for Loan + Then LoanOwnershipTransferBusinessEvent is created + Then LoanAccountSnapshotBusinessEvent is created + Then Fetching Asset externalization details by loan id gives numberOfElements: 2 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + Then The latest asset externalization transaction with "ACTIVE" status has the following TRANSFER Journal entries: + | glAccountType | glAccountCode | glAccountName | entryType | amount | + | ASSET | 112601 | Loans Receivable | CREDIT | 1000.00 | + | ASSET | 112603 | Interest/Fee Receivable | CREDIT | 10.00 | + | ASSET | 146000 | Asset transfer | DEBIT | 1010.00 | + | ASSET | 112601 | Loans Receivable | DEBIT | 1000.00 | + | ASSET | 112603 | Interest/Fee Receivable | DEBIT | 10.00 | + | ASSET | 146000 | Asset transfer | CREDIT | 1010.00 | + Then The asset external owner has the following OWNER Journal entries: + | glAccountType | glAccountCode | glAccountName | entryType | amount | + | ASSET | 112601 | Loans Receivable | DEBIT | 1000.00 | + | ASSET | 112603 | Interest/Fee Receivable | DEBIT | 10.00 | + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | buyback | 2023-05-30 | | + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-22 | 9999-12-31 | BUYBACK | + When Admin adds "LOAN_NSF_FEE" due date charge with "25 May 2023" due date and 20 EUR transaction amount + When Admin sets the business date to "26 May 2023" + When Admin runs inline COB job for Loan + When Admin sets the business date to "31 May 2023" + When Admin runs inline COB job for Loan + Then LoanOwnershipTransferBusinessEvent is created + Then LoanAccountSnapshotBusinessEvent is created + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 2023-05-30 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-22 | 2023-05-30 | BUYBACK | + Then The latest asset externalization transaction with "BUYBACK" status has the following TRANSFER Journal entries: + | glAccountType | glAccountCode | glAccountName | entryType | amount | + | ASSET | 112601 | Loans Receivable | DEBIT | 1000.00 | + | ASSET | 112603 | Interest/Fee Receivable | DEBIT | 30.00 | + | ASSET | 146000 | Asset transfer | CREDIT | 1030.00 | + | ASSET | 112601 | Loans Receivable | CREDIT | 1000.00 | + | ASSET | 112603 | Interest/Fee Receivable | CREDIT | 30.00 | + | ASSET | 146000 | Asset transfer | DEBIT | 1030.00 | + Then The asset external owner has the following OWNER Journal entries: + | glAccountType | glAccountCode | glAccountName | entryType | amount | + | ASSET | 112601 | Loans Receivable | DEBIT | 1000.00 | + | ASSET | 112603 | Interest/Fee Receivable | DEBIT | 10.00 | + | ASSET | 112603 | Interest/Fee Receivable | DEBIT | 20.00 | + | INCOME | 404007 | Fee Income | CREDIT | 20.00 | + | ASSET | 112601 | Loans Receivable | CREDIT | 1000.00 | + | ASSET | 112603 | Interest/Fee Receivable | CREDIT | 30.00 | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2753 @AssetExternalizationJournalEntry + Scenario: Verify that Asset externalization SALES and BUYBACK has the correct Journal entries: Repyment while status is ACTIVE + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + When Admin sets the business date to "22 May 2023" + When Admin runs inline COB job for Loan + Then LoanOwnershipTransferBusinessEvent is created + Then LoanAccountSnapshotBusinessEvent is created + Then Fetching Asset externalization details by loan id gives numberOfElements: 2 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + Then The latest asset externalization transaction with "ACTIVE" status has the following TRANSFER Journal entries: + | glAccountType | glAccountCode | glAccountName | entryType | amount | + | ASSET | 112601 | Loans Receivable | CREDIT | 1000.00 | + | ASSET | 146000 | Asset transfer | DEBIT | 1000.00 | + | ASSET | 112601 | Loans Receivable | DEBIT | 1000.00 | + | ASSET | 146000 | Asset transfer | CREDIT | 1000.00 | + Then The asset external owner has the following OWNER Journal entries: + | glAccountType | glAccountCode | glAccountName | entryType | amount | + | ASSET | 112601 | Loans Receivable | DEBIT | 1000.00 | + When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "22 May 2023" with 200 EUR transaction amount and system-generated Idempotency key and check external owner + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | buyback | 2023-05-30 | | + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-22 | 9999-12-31 | BUYBACK | + When Admin sets the business date to "31 May 2023" + When Admin runs inline COB job for Loan + Then LoanOwnershipTransferBusinessEvent is created + Then LoanAccountSnapshotBusinessEvent is created + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 2023-05-30 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-22 | 2023-05-30 | BUYBACK | + Then The latest asset externalization transaction with "BUYBACK" status has the following TRANSFER Journal entries: + | glAccountType | glAccountCode | glAccountName | entryType | amount | + | ASSET | 112601 | Loans Receivable | DEBIT | 800.00 | + | ASSET | 146000 | Asset transfer | CREDIT | 800.00 | + | ASSET | 112601 | Loans Receivable | CREDIT | 800.00 | + | ASSET | 146000 | Asset transfer | DEBIT | 800.00 | + Then The asset external owner has the following OWNER Journal entries: + | glAccountType | glAccountCode | glAccountName | entryType | amount | + | ASSET | 112601 | Loans Receivable | DEBIT | 1000.00 | + | ASSET | 112601 | Loans Receivable | CREDIT | 200.00 | + | LIABILITY | 145023 | Suspense/Clearing account | DEBIT | 200.00 | + | ASSET | 112601 | Loans Receivable | CREDIT | 800.00 | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2754 @AssetExternalizationJournalEntry + Scenario: Verify that Asset externalization SALES and BUYBACK has the correct Journal entries: GOODWILL_CREDIT transaction while status is ACTIVE + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + When Admin sets the business date to "22 May 2023" + When Admin runs inline COB job for Loan + Then LoanOwnershipTransferBusinessEvent is created + Then LoanAccountSnapshotBusinessEvent is created + Then Fetching Asset externalization details by loan id gives numberOfElements: 2 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + Then The latest asset externalization transaction with "ACTIVE" status has the following TRANSFER Journal entries: + | glAccountType | glAccountCode | glAccountName | entryType | amount | + | ASSET | 112601 | Loans Receivable | CREDIT | 1000.00 | + | ASSET | 146000 | Asset transfer | DEBIT | 1000.00 | + | ASSET | 112601 | Loans Receivable | DEBIT | 1000.00 | + | ASSET | 146000 | Asset transfer | CREDIT | 1000.00 | + Then The asset external owner has the following OWNER Journal entries: + | glAccountType | glAccountCode | glAccountName | entryType | amount | + | ASSET | 112601 | Loans Receivable | DEBIT | 1000.00 | + When Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "22 May 2023" with 200 EUR transaction amount and system-generated Idempotency key and check external owner + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | buyback | 2023-05-30 | | + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-22 | 9999-12-31 | BUYBACK | + When Admin sets the business date to "31 May 2023" + When Admin runs inline COB job for Loan + Then LoanOwnershipTransferBusinessEvent is created + Then LoanAccountSnapshotBusinessEvent is created + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 2023-05-30 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-22 | 2023-05-30 | BUYBACK | + Then The latest asset externalization transaction with "BUYBACK" status has the following TRANSFER Journal entries: + | glAccountType | glAccountCode | glAccountName | entryType | amount | + | ASSET | 112601 | Loans Receivable | DEBIT | 800.00 | + | ASSET | 146000 | Asset transfer | CREDIT | 800.00 | + | ASSET | 112601 | Loans Receivable | CREDIT | 800.00 | + | ASSET | 146000 | Asset transfer | DEBIT | 800.00 | + Then The asset external owner has the following OWNER Journal entries: + | glAccountType | glAccountCode | glAccountName | entryType | amount | + | ASSET | 112601 | Loans Receivable | DEBIT | 1000.00 | + | ASSET | 112601 | Loans Receivable | CREDIT | 200.00 | + | EXPENSE | 744003 | Goodwill Expense Account | DEBIT | 200.00 | + | ASSET | 112601 | Loans Receivable | CREDIT | 800.00 | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2755 @AssetExternalizationJournalEntry + Scenario: Verify that Asset externalization SALES and BUYBACK has the correct Journal entries: MERCHANT_ISSUED_REFUND transaction while status is ACTIVE + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + When Admin sets the business date to "22 May 2023" + When Admin runs inline COB job for Loan + Then LoanOwnershipTransferBusinessEvent is created + Then LoanAccountSnapshotBusinessEvent is created + Then Fetching Asset externalization details by loan id gives numberOfElements: 2 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + Then The latest asset externalization transaction with "ACTIVE" status has the following TRANSFER Journal entries: + | glAccountType | glAccountCode | glAccountName | entryType | amount | + | ASSET | 112601 | Loans Receivable | CREDIT | 1000.00 | + | ASSET | 146000 | Asset transfer | DEBIT | 1000.00 | + | ASSET | 112601 | Loans Receivable | DEBIT | 1000.00 | + | ASSET | 146000 | Asset transfer | CREDIT | 1000.00 | + Then The asset external owner has the following OWNER Journal entries: + | glAccountType | glAccountCode | glAccountName | entryType | amount | + | ASSET | 112601 | Loans Receivable | DEBIT | 1000.00 | + When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "22 May 2023" with 200 EUR transaction amount and system-generated Idempotency key and check external owner + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | buyback | 2023-05-30 | | + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-22 | 9999-12-31 | BUYBACK | + When Admin sets the business date to "31 May 2023" + When Admin runs inline COB job for Loan + Then LoanOwnershipTransferBusinessEvent is created + Then LoanAccountSnapshotBusinessEvent is created + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 2023-05-30 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-22 | 2023-05-30 | BUYBACK | + Then The latest asset externalization transaction with "BUYBACK" status has the following TRANSFER Journal entries: + | glAccountType | glAccountCode | glAccountName | entryType | amount | + | ASSET | 112601 | Loans Receivable | DEBIT | 800.00 | + | ASSET | 146000 | Asset transfer | CREDIT | 800.00 | + | ASSET | 112601 | Loans Receivable | CREDIT | 800.00 | + | ASSET | 146000 | Asset transfer | DEBIT | 800.00 | + Then The asset external owner has the following OWNER Journal entries: + | glAccountType | glAccountCode | glAccountName | entryType | amount | + | ASSET | 112601 | Loans Receivable | DEBIT | 1000.00 | + | ASSET | 112601 | Loans Receivable | CREDIT | 200.00 | + | LIABILITY | 145023 | Suspense/Clearing account | DEBIT | 200.00 | + | ASSET | 112601 | Loans Receivable | CREDIT | 800.00 | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2756 @AssetExternalizationJournalEntry + Scenario: Verify that Asset externalization SALES and BUYBACK has the correct Journal entries: PAYOUT_REFUND transaction while status is ACTIVE + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + When Admin sets the business date to "22 May 2023" + When Admin runs inline COB job for Loan + Then LoanOwnershipTransferBusinessEvent is created + Then LoanAccountSnapshotBusinessEvent is created + Then Fetching Asset externalization details by loan id gives numberOfElements: 2 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + Then The latest asset externalization transaction with "ACTIVE" status has the following TRANSFER Journal entries: + | glAccountType | glAccountCode | glAccountName | entryType | amount | + | ASSET | 112601 | Loans Receivable | CREDIT | 1000.00 | + | ASSET | 146000 | Asset transfer | DEBIT | 1000.00 | + | ASSET | 112601 | Loans Receivable | DEBIT | 1000.00 | + | ASSET | 146000 | Asset transfer | CREDIT | 1000.00 | + Then The asset external owner has the following OWNER Journal entries: + | glAccountType | glAccountCode | glAccountName | entryType | amount | + | ASSET | 112601 | Loans Receivable | DEBIT | 1000.00 | + When Customer makes "PAYOUT_REFUND" transaction with "AUTOPAY" payment type on "22 May 2023" with 200 EUR transaction amount and system-generated Idempotency key and check external owner + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | buyback | 2023-05-30 | | + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-22 | 9999-12-31 | BUYBACK | + When Admin sets the business date to "31 May 2023" + When Admin runs inline COB job for Loan + Then LoanOwnershipTransferBusinessEvent is created + Then LoanAccountSnapshotBusinessEvent is created + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 2023-05-30 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-22 | 2023-05-30 | BUYBACK | + Then The latest asset externalization transaction with "BUYBACK" status has the following TRANSFER Journal entries: + | glAccountType | glAccountCode | glAccountName | entryType | amount | + | ASSET | 112601 | Loans Receivable | DEBIT | 800.00 | + | ASSET | 146000 | Asset transfer | CREDIT | 800.00 | + | ASSET | 112601 | Loans Receivable | CREDIT | 800.00 | + | ASSET | 146000 | Asset transfer | DEBIT | 800.00 | + Then The asset external owner has the following OWNER Journal entries: + | glAccountType | glAccountCode | glAccountName | entryType | amount | + | ASSET | 112601 | Loans Receivable | DEBIT | 1000.00 | + | ASSET | 112601 | Loans Receivable | CREDIT | 200.00 | + | LIABILITY | 145023 | Suspense/Clearing account | DEBIT | 200.00 | + | ASSET | 112601 | Loans Receivable | CREDIT | 800.00 | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2757 @AssetExternalizationJournalEntry + Scenario: Verify that Asset externalization SALES and BUYBACK has the correct Journal entries: REPAYMENT_ADJUSTMENT_REFUND chargeback transaction while status is ACTIVE + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + When Admin sets the business date to "22 May 2023" + When Admin runs inline COB job for Loan + Then LoanOwnershipTransferBusinessEvent is created + Then LoanAccountSnapshotBusinessEvent is created + Then Fetching Asset externalization details by loan id gives numberOfElements: 2 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + Then The latest asset externalization transaction with "ACTIVE" status has the following TRANSFER Journal entries: + | glAccountType | glAccountCode | glAccountName | entryType | amount | + | ASSET | 112601 | Loans Receivable | CREDIT | 1000.00 | + | ASSET | 146000 | Asset transfer | DEBIT | 1000.00 | + | ASSET | 112601 | Loans Receivable | DEBIT | 1000.00 | + | ASSET | 146000 | Asset transfer | CREDIT | 1000.00 | + Then The asset external owner has the following OWNER Journal entries: + | glAccountType | glAccountCode | glAccountName | entryType | amount | + | ASSET | 112601 | Loans Receivable | DEBIT | 1000.00 | + When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "22 May 2023" with 1000 EUR transaction amount and system-generated Idempotency key and check external owner + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | buyback | 2023-05-30 | | + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-22 | 9999-12-31 | BUYBACK | + When Admin sets the business date to "25 May 2023" + When Admin makes "REPAYMENT_ADJUSTMENT_REFUND" chargeback with 800 EUR transaction amount + When Admin sets the business date to "31 May 2023" + When Admin runs inline COB job for Loan + Then LoanOwnershipTransferBusinessEvent is created + Then LoanAccountSnapshotBusinessEvent is created + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 2023-05-30 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-22 | 2023-05-30 | BUYBACK | + Then The latest asset externalization transaction with "BUYBACK" status has the following TRANSFER Journal entries: + | glAccountType | glAccountCode | glAccountName | entryType | amount | + | ASSET | 112601 | Loans Receivable | DEBIT | 800.00 | + | ASSET | 146000 | Asset transfer | CREDIT | 800.00 | + | ASSET | 112601 | Loans Receivable | CREDIT | 800.00 | + | ASSET | 146000 | Asset transfer | DEBIT | 800.00 | + Then The asset external owner has the following OWNER Journal entries: + | glAccountType | glAccountCode | glAccountName | entryType | amount | + | ASSET | 112601 | Loans Receivable | DEBIT | 1000.00 | + | ASSET | 112601 | Loans Receivable | CREDIT | 1000.00 | + | LIABILITY | 145023 | Suspense/Clearing account | DEBIT | 1000.00 | + | ASSET | 112601 | Loans Receivable | DEBIT | 800.00 | + | LIABILITY | 145023 | Suspense/Clearing account | CREDIT | 800.00 | + | ASSET | 112601 | Loans Receivable | CREDIT | 800.00 | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2758 @AssetExternalizationJournalEntry + Scenario: Verify that Asset externalization SALES and BUYBACK has the correct Journal entries: CHARGE ADJUSTMENT transaction while status is ACTIVE + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + When Admin sets the business date to "22 May 2023" + When Admin runs inline COB job for Loan + Then LoanOwnershipTransferBusinessEvent is created + Then LoanAccountSnapshotBusinessEvent is created + Then Fetching Asset externalization details by loan id gives numberOfElements: 2 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + Then The latest asset externalization transaction with "ACTIVE" status has the following TRANSFER Journal entries: + | glAccountType | glAccountCode | glAccountName | entryType | amount | + | ASSET | 112601 | Loans Receivable | CREDIT | 1000.00 | + | ASSET | 146000 | Asset transfer | DEBIT | 1000.00 | + | ASSET | 112601 | Loans Receivable | DEBIT | 1000.00 | + | ASSET | 146000 | Asset transfer | CREDIT | 1000.00 | + Then The asset external owner has the following OWNER Journal entries: + | glAccountType | glAccountCode | glAccountName | entryType | amount | + | ASSET | 112601 | Loans Receivable | DEBIT | 1000.00 | + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "24 May 2023" due date and 300 EUR transaction amount + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | buyback | 2023-05-30 | | + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-22 | 9999-12-31 | BUYBACK | + When Admin sets the business date to "25 May 2023" + When Admin runs inline COB job for Loan + When Admin makes a charge adjustment for the last "LOAN_SNOOZE_FEE" type charge which is due on "24 May 2023" with 100 EUR transaction amount and externalId "" + When Admin sets the business date to "31 May 2023" + When Admin runs inline COB job for Loan + Then LoanOwnershipTransferBusinessEvent is created + Then LoanAccountSnapshotBusinessEvent is created + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 2023-05-30 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-22 | 2023-05-30 | BUYBACK | + Then The latest asset externalization transaction with "BUYBACK" status has the following TRANSFER Journal entries: + | glAccountType | glAccountCode | glAccountName | entryType | amount | + | ASSET | 112601 | Loans Receivable | DEBIT | 1000.00 | + | ASSET | 112603 | Interest/Fee Receivable | DEBIT | 200.00 | + | ASSET | 146000 | Asset transfer | CREDIT | 1200.00 | + | ASSET | 112601 | Loans Receivable | CREDIT | 1000.00 | + | ASSET | 112603 | Interest/Fee Receivable | CREDIT | 200.00 | + | ASSET | 146000 | Asset transfer | DEBIT | 1200.00 | + Then The asset external owner has the following OWNER Journal entries: + | glAccountType | glAccountCode | glAccountName | entryType | amount | + | ASSET | 112601 | Loans Receivable | DEBIT | 1000.00 | + | ASSET | 112603 | Interest/Fee Receivable | DEBIT | 300.00 | + | INCOME | 404007 | Fee Income | CREDIT | 300.00 | + | ASSET | 112603 | Interest/Fee Receivable | CREDIT | 100.00 | + | INCOME | 404007 | Fee Income | DEBIT | 100.00 | + | ASSET | 112601 | Loans Receivable | CREDIT | 1000.00 | + | ASSET | 112603 | Interest/Fee Receivable | CREDIT | 200.00 | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2759 + Scenario: Verify that LoanOwnershipTransferBusinessEvent and LoanAccountSnapshotBusinessEvent is created with correct data + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + Then Asset externalization details has the generated transferExternalId + When Admin sets the business date to "22 May 2023" + When Admin runs inline COB job for Loan + Then Fetching Asset externalization details by loan id gives numberOfElements: 2 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + Then LoanOwnershipTransferBusinessEvent is created + Then LoanAccountSnapshotBusinessEvent is created + When Admin sets the business date to "25 May 2023" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | buyback | 2023-05-30 | | + When Admin sets the business date to "31 May 2023" + When Admin runs inline COB job for Loan + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 2023-05-30 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-25 | 2023-05-30 | BUYBACK | + Then LoanOwnershipTransferBusinessEvent is created + Then LoanAccountSnapshotBusinessEvent is created + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2760 + Scenario: Verify that LoanOwnershipTransferBusinessEvent and LoanAccountSnapshotBusinessEvent is created with correct data for partial repayment, fee, penalty + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "1 May 2023" with 500 EUR transaction amount and system-generated Idempotency key + When Admin adds "LOAN_NSF_FEE" due date charge with "1 May 2023" due date and 15 EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "1 May 2023" due date and 20 EUR transaction amount + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + Then Asset externalization details has the generated transferExternalId + When Admin sets the business date to "22 May 2023" + When Admin runs inline COB job for Loan + Then Fetching Asset externalization details by loan id gives numberOfElements: 2 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + Then LoanOwnershipTransferBusinessEvent is created + Then LoanAccountSnapshotBusinessEvent is created + When Admin sets the business date to "25 May 2023" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | buyback | 2023-05-30 | | + When Admin sets the business date to "31 May 2023" + When Admin runs inline COB job for Loan + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 2023-05-30 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-25 | 2023-05-30 | BUYBACK | + Then LoanOwnershipTransferBusinessEvent is created + Then LoanAccountSnapshotBusinessEvent is created + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + # TODO right now COB does not pick up closed loans + @Skip @temp600 + Scenario: Verify that when loan got fully paid while SALES on PENDING .......... + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + When Admin sets the business date to "10 May 2023" + When Admin runs inline COB job for Loan + And Customer makes "AUTOPAY" repayment on "10 May 2023" with 1000 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + When Admin sets the business date to "22 May 2023" + When Admin runs inline COB job for Loan +# Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with the following data: +# | settlementDate | ownerExternalId | purchasePriceRatio | status | effectiveFrom | effectiveTo |Transaction type | +# | 2023-05-21 | TestOwner | 1 | PENDING | 2023-05-01 | 9999-12-31 |SALE | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + +# TODO right now COB does not pick up closed loans + @Skip @temp700 + Scenario: Verify that when loan got overpaid while SALES on PENDING .......... + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + When Admin sets the business date to "10 May 2023" + When Admin runs inline COB job for Loan + And Customer makes "AUTOPAY" repayment on "10 May 2023" with 1200 EUR transaction amount + Then Loan status will be "OVERPAID" + When Admin sets the business date to "22 May 2023" + When Admin runs inline COB job for Loan +# Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with the following data: +# | settlementDate | ownerExternalId | purchasePriceRatio | status | effectiveFrom | effectiveTo |Transaction type | +# | 2023-05-21 | TestOwner | 1 | PENDING | 2023-05-01 | 9999-12-31 |SALE | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + +# it is for making easier the event check manually on Postman / when event check automation scenarios implemented, it should be deleted + @Skip @events + Scenario: Verify that Asset externalization details are correct after CoB in case of a SALES request by loan id + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + When Admin sets the business date to "22 May 2023" + When Admin runs inline COB job for Loan + Then Fetching Asset externalization details by loan id gives numberOfElements: 2 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + When Admin sets the business date to "25 May 2023" + When Admin runs inline COB job for Loan + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "25 May 2023" due date and 10 EUR transaction amount + When Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "25 May 2023" with 200 EUR transaction amount and self-generated Idempotency key and check external owner + When Customer makes "PAYOUT_REFUND" transaction with "AUTOPAY" payment type on "25 May 2023" with 200 EUR transaction amount and self-generated Idempotency key and check external owner + When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "25 May 2023" with 200 EUR transaction amount and self-generated Idempotency key and check external owner + And Customer makes "AUTOPAY" repayment on "25 May 2023" with 200 EUR transaction amount and check external owner + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2771 + Scenario: Verify that SALE and BUYBACK can be cancelled in right order + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request for type "SALE" by Loan ID with unique ownerExternalId, user-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId, ignore transactionExternalId and contain the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | + When Admin sets the business date to "10 May 2023" + When Admin makes asset externalization request for type "BUYBACK" by Loan ID with unique ownerExternalId, user-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | buyback | 2023-05-21 | | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 2 with correct ownerExternalId, ignore transactionExternalId and contain the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | + | 2023-05-21 | 1 | BUYBACK | 2023-05-10 | 9999-12-31 | + When Admin send "cancel" command to the transaction type "SALE" will throw error + When Admin send "cancel" command to the transaction type "BUYBACK" + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId, ignore transactionExternalId and contain the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | + | 2023-05-21 | 1 | BUYBACK | 2023-05-10 | 2023-05-10 | + | 2023-05-21 | 1 | CANCELLED | 2023-05-10 | 2023-05-10 | + When Admin send "cancel" command to the transaction type "SALE" + Then Fetching Asset externalization details by loan id gives numberOfElements: 4 with correct ownerExternalId, ignore transactionExternalId and contain the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-10 | + | 2023-05-21 | 1 | BUYBACK | 2023-05-10 | 2023-05-10 | + | 2023-05-21 | 1 | CANCELLED | 2023-05-10 | 2023-05-10 | + | 2023-05-21 | 1 | CANCELLED | 2023-05-01 | 2023-05-10 | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2772 + Scenario: Verify that SALE can be cancelled + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, user-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId, ignore transactionExternalId and contain the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | + When Admin sets the business date to "10 May 2023" + When Admin send "cancel" command on "SALE" transaction + Then Fetching Asset externalization details by loan id gives numberOfElements: 2 with correct ownerExternalId, ignore transactionExternalId and contain the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-10 | + | 2023-05-21 | 1 | CANCELLED | 2023-05-01 | 2023-05-10 | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2773 + Scenario: Verify that active SALE can not be cancelled + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, user-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + When Admin sets the business date to "22 May 2023" + When Admin runs inline COB job for Loan + Then Fetching Asset externalization details by loan id gives numberOfElements: 2 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + When Admin send "cancel" command on "SALE" transaction it will throw an error + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2774 + Scenario: Verify that Asset cannot be cancelled after SALE and BUYBACK is completed + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + When Admin sets the business date to "10 May 2023" + When Admin runs inline COB job for Loan + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | buyback | 2023-05-30 | | + Then Fetching Asset externalization details by loan id gives numberOfElements: 2 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-10 | 9999-12-31 | BUYBACK | + When Admin sets the business date to "22 May 2023" + When Admin runs inline COB job for Loan + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-10 | 9999-12-31 | BUYBACK | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + When Admin sets the business date to "31 May 2023" + When Admin runs inline COB job for Loan + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-10 | 2023-05-30 | BUYBACK | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 2023-05-30 | SALE | + When Admin send "cancel" command on "SALE" transaction it will throw an error + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2775 + Scenario: Verify that SALE and BUYBACK can be cancelled in right order with double cancel test + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request for type "SALE" by Loan ID with unique ownerExternalId, user-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId, ignore transactionExternalId and contain the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | + When Admin send "cancel" command to the transaction type "SALE" + Then Fetching Asset externalization details by loan id gives numberOfElements: 2 with correct ownerExternalId, ignore transactionExternalId and contain the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-01 | + | 2023-05-21 | 1 | CANCELLED | 2023-05-01 | 2023-05-01 | + When Admin makes asset externalization request for type "SALE" by Loan ID with unique ownerExternalId, force generated transferExternalId and without change test owner with following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId, ignore transactionExternalId and contain the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-01 | + | 2023-05-21 | 1 | CANCELLED | 2023-05-01 | 2023-05-01 | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | + When Admin sets the business date to "10 May 2023" + When Admin makes asset externalization request for type "BUYBACK" by Loan ID with unique ownerExternalId, user-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | buyback | 2023-05-21 | | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 4 with correct ownerExternalId, ignore transactionExternalId and contain the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-01 | + | 2023-05-21 | 1 | CANCELLED | 2023-05-01 | 2023-05-01 | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | + | 2023-05-21 | 1 | BUYBACK | 2023-05-10 | 9999-12-31 | + When Admin send "cancel" command to the transaction type "SALE" will throw error + When Admin send "cancel" command to the transaction type "BUYBACK" + Then Fetching Asset externalization details by loan id gives numberOfElements: 5 with correct ownerExternalId, ignore transactionExternalId and contain the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-01 | + | 2023-05-21 | 1 | CANCELLED | 2023-05-01 | 2023-05-01 | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | + | 2023-05-21 | 1 | BUYBACK | 2023-05-10 | 2023-05-10 | + | 2023-05-21 | 1 | CANCELLED | 2023-05-10 | 2023-05-10 | + When Admin send "cancel" command to the transaction type "SALE" + Then Fetching Asset externalization details by loan id gives numberOfElements: 6 with correct ownerExternalId, ignore transactionExternalId and contain the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-01 | + | 2023-05-21 | 1 | CANCELLED | 2023-05-01 | 2023-05-01 | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-10 | + | 2023-05-21 | 1 | BUYBACK | 2023-05-10 | 2023-05-10 | + | 2023-05-21 | 1 | CANCELLED | 2023-05-10 | 2023-05-10 | + | 2023-05-21 | 1 | CANCELLED | 2023-05-01 | 2023-05-10 | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2785 + Scenario: Verify that when a loan with PENDING SALES is fully paid asset transfer status will be DECLINED + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + When Admin sets the business date to "15 May 2023" + And Customer makes "AUTOPAY" repayment on "15 May 2023" with 1000 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Fetching Asset externalization details by loan id gives numberOfElements: 2 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-15 | SALE | + | 2023-05-21 | 1 | DECLINED | 2023-05-15 | 2023-05-15 | SALE | + Then LoanOwnershipTransferBusinessEvent with transfer status: "DECLINED" and transfer status reason "BALANCE_ZERO" is created + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2786 + Scenario: Verify that when a loan with PENDING SALES is overpaid asset transfer status will be DECLINED + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + When Admin sets the business date to "15 May 2023" + And Customer makes "AUTOPAY" repayment on "15 May 2023" with 1200 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Fetching Asset externalization details by loan id gives numberOfElements: 2 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-15 | SALE | + | 2023-05-21 | 1 | DECLINED | 2023-05-15 | 2023-05-15 | SALE | + Then LoanOwnershipTransferBusinessEvent with transfer status: "DECLINED" and transfer status reason "BALANCE_NEGATIVE" is created + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2787 + Scenario: Verify that when a loan with PENDING BUYBACK is fully paid BUYBACK transaction can be done successfully + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + When Admin sets the business date to "22 May 2023" + When Admin runs inline COB job for Loan + Then Fetching Asset externalization details by loan id gives numberOfElements: 2 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | buyback | 2023-05-30 | | + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-22 | 9999-12-31 | BUYBACK | + When Admin sets the business date to "25 May 2023" + And Customer makes "AUTOPAY" repayment on "25 May 2023" with 1000 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + When Admin sets the business date to "31 May 2023" + When Admin runs inline COB job for Loan + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 2023-05-25 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-22 | 2023-05-25 | BUYBACK | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2788 + Scenario: Verify that when a loan with PENDING BUYBACK is overpaid BUYBACK transaction can be done successfully + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + When Admin sets the business date to "22 May 2023" + When Admin runs inline COB job for Loan + Then Fetching Asset externalization details by loan id gives numberOfElements: 2 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, system-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | buyback | 2023-05-30 | | + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-22 | 9999-12-31 | BUYBACK | + When Admin sets the business date to "25 May 2023" + And Customer makes "AUTOPAY" repayment on "25 May 2023" with 1200 EUR transaction amount + Then Loan status will be "OVERPAID" + When Admin sets the business date to "31 May 2023" + When Admin runs inline COB job for Loan + Then Fetching Asset externalization details by loan id gives numberOfElements: 3 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 2023-05-25 | SALE | + | 2023-05-30 | 1 | BUYBACK | 2023-05-22 | 2023-05-25 | BUYBACK | + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow + + @TestRailId:C2811 + Scenario: Verify that transaction and transaction adjustment events has the proper external owner + Given Admin puts EXTERNAL_ASSET_OWNER_TRANSFER job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 May 2023" + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin makes asset externalization request by Loan ID with unique ownerExternalId, user-generated transferExternalId and the following data: + | Transaction type | settlementDate | purchasePriceRatio | + | sale | 2023-05-21 | 1 | + Then Asset externalization response has the correct Loan ID, transferExternalId + Then Fetching Asset externalization details by loan id gives numberOfElements: 1 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 9999-12-31 | SALE | + And Customer makes "AUTOPAY" repayment on "1 May 2023" with 10 EUR transaction amount + When Admin sets the business date to "22 May 2023" + When Admin runs inline COB job for Loan + Then Fetching Asset externalization details by loan id gives numberOfElements: 2 with correct ownerExternalId and the following data: + | settlementDate | purchasePriceRatio | status | effectiveFrom | effectiveTo | Transaction type | + | 2023-05-21 | 1 | PENDING | 2023-05-01 | 2023-05-21 | SALE | + | 2023-05-21 | 1 | ACTIVE | 2023-05-22 | 9999-12-31 | SALE | + And Customer makes "AUTOPAY" repayment on "22 May 2023" with 10 EUR transaction amount and check external owner + When Customer adjust "1"th repayment on "22 May 2023" with amount "9" and check external owner + Then Admin removes EXTERNAL_ASSET_OWNER_TRANSFER job from LOAN_CLOSE_OF_BUSINESS workflow diff --git a/fineract-e2e-tests-runner/src/test/resources/features/BusinessDate.feature b/fineract-e2e-tests-runner/src/test/resources/features/BusinessDate.feature new file mode 100644 index 00000000000..90f8eeb5080 --- /dev/null +++ b/fineract-e2e-tests-runner/src/test/resources/features/BusinessDate.feature @@ -0,0 +1,28 @@ +@BusinessDateFeature +Feature: BusinessDate + + @TestRailId:C38 + Scenario: As a user I would like to enable the Business date configuration + Given Global configuration "enable_business_date" is enabled + + @TestRailId:C39 + Scenario: As a user I would like to disable the Business date configuration + Given Global configuration "enable_business_date" is disabled + + @TestRailId:C40 + Scenario: As a user I would like to set the business date + When Admin sets the business date to "10 July 2022" + Then Admin checks that the business date is correctly set to "10 July 2022" + + @TestRailId:C41 + Scenario: As a user I would like to change the business date manually + When Admin sets the business date to "10 July 2022" + Then Admin checks that the business date is correctly set to "10 July 2022" + When Admin sets the business date to "11 July 2022" + Then Admin checks that the business date is correctly set to "11 July 2022" + + @TestRailId:C27 + Scenario: As a user I would like to change the business date with scheduled job + When Admin sets the business date to "10 July 2022" + When Admin runs the Increase Business Date by 1 day job + Then Admin checks that the business date is correctly set to "11 July 2022" diff --git a/fineract-e2e-tests-runner/src/test/resources/features/COB.feature b/fineract-e2e-tests-runner/src/test/resources/features/COB.feature new file mode 100644 index 00000000000..c034933cccb --- /dev/null +++ b/fineract-e2e-tests-runner/src/test/resources/features/COB.feature @@ -0,0 +1,232 @@ +@COBFeature +Feature: COBFeature + + @TestRailId:C2501 @Skip + Scenario: As an admin I would like to see that last closed business date got updated after COB catch up job finished + When Admin sets the business date to "01 January 2022" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2022" + And Admin successfully approves the loan on "01 January 2022" with "1000" amount and expected disbursement date on "01 January 2022" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + Then Admin checks that last closed business date of loan is "null" + When Admin sets the business date to "02 January 2022" + When Admin runs COB job + Then Admin checks that last closed business date of loan is "01 January 2022" + When Admin sets the business date to "05 January 2022" + When Admin runs COB job + Then Admin checks that last closed business date of loan is "01 January 2022" + When Admin runs COB catch up + When Admin checks that Loan COB is running until the current business date + Then Admin checks that last closed business date of loan is "04 January 2022" + And Customer makes "AUTOPAY" repayment on "05 January 2022" with 1000 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + + + @TestRailId:C2681 @Skip + Scenario: As an admin I would like to check that the Delinquency bucket set on the loan correctly when the arrears setting is 3 on the product + When Admin sets the business date to "1 January 2022" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2022" + And Admin successfully approves the loan on "1 January 2022" with "1000" amount and expected disbursement date on "1 January 2022" + When Admin successfully disburse the loan on "1 January 2022" with "1000" EUR transaction amount + When Admin sets the business date to "4 February 2022" + When Admin runs COB job + Then Admin checks that delinquency range is: "RANGE_1" and has delinquentDate "2022-02-03" + + @TestRailId:C2791 @Skip + Scenario: Verify that COB processes loans which are not closed/overpaid and has a last_closed_business_date exactly 1 day behind COB date + When Admin sets the business date to "01 July 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 July 2023" + And Admin successfully approves the loan on "01 July 2023" with "1000" amount and expected disbursement date on "01 July 2023" + When Admin successfully disburse the loan on "01 July 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + Then Admin checks that last closed business date of loan is "null" + When Admin sets the business date to "02 July 2023" + When Admin runs COB job + Then Admin checks that last closed business date of loan is "01 July 2023" + When Admin sets the business date to "03 July 2023" + When Admin runs COB job + Then Admin checks that last closed business date of loan is "02 July 2023" + + @TestRailId:C2792 + Scenario: Verify that COB doesn’t touch loans with last closed business date behind COB date + When Admin sets the business date to "01 July 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 July 2023" + And Admin successfully approves the loan on "01 July 2023" with "1000" amount and expected disbursement date on "01 July 2023" + When Admin successfully disburse the loan on "01 July 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + Then Admin checks that last closed business date of loan is "null" + When Admin sets the business date to "10 August 2023" + When Admin runs inline COB job for Loan + Then Admin checks that last closed business date of loan is "09 August 2023" + Then Admin checks that delinquency range is: "RANGE_3" and has delinquentDate "2023-08-03" + Then Loan delinquency history has the following details: + | Range (Classification) | Added on date | Lifted on date | + | RANGE_3 | 09 August 2023 | | + | RANGE_1 | 04 August 2023 | 09 August 2023 | + When Admin sets the business date to "12 August 2023" + When Admin runs COB job + Then Admin checks that last closed business date of loan is "09 August 2023" + Then Loan delinquency history has the following details: + | Range (Classification) | Added on date | Lifted on date | + | RANGE_3 | 09 August 2023 | | + | RANGE_1 | 04 August 2023 | 09 August 2023 | + + @TestRailId:C2793 + Scenario: Verify that COB doesn’t touch CLOSED loans + When Admin sets the business date to "01 July 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 July 2023" + And Admin successfully approves the loan on "01 July 2023" with "1000" amount and expected disbursement date on "01 July 2023" + When Admin successfully disburse the loan on "01 July 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + Then Admin checks that last closed business date of loan is "null" + When Admin sets the business date to "10 August 2023" + When Admin runs inline COB job for Loan + Then Admin checks that last closed business date of loan is "09 August 2023" + Then Admin checks that delinquency range is: "RANGE_3" and has delinquentDate "2023-08-03" + Then Loan delinquency history has the following details: + | Range (Classification) | Added on date | Lifted on date | + | RANGE_3 | 09 August 2023 | | + | RANGE_1 | 04 August 2023 | 09 August 2023 | + And Customer makes "AUTOPAY" repayment on "10 August 2023" with 1000 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Admin checks that delinquency range is: "NO_DELINQUENCY" and has delinquentDate "" + Then Loan delinquency history has the following details: + | Range (Classification) | Added on date | Lifted on date | + | RANGE_3 | 09 August 2023 | 10 August 2023 | + | RANGE_1 | 04 August 2023 | 09 August 2023 | + When Admin sets the business date to "11 August 2023" + When Admin runs COB job + Then Admin checks that last closed business date of loan is "09 August 2023" + Then Loan delinquency history has the following details: + | Range (Classification) | Added on date | Lifted on date | + | RANGE_3 | 09 August 2023 | 10 August 2023 | + | RANGE_1 | 04 August 2023 | 09 August 2023 | + + @TestRailId:C2794 + Scenario: Verify that COB doesn’t touch OVERPAID loans + When Admin sets the business date to "01 July 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 July 2023" + And Admin successfully approves the loan on "01 July 2023" with "1000" amount and expected disbursement date on "01 July 2023" + When Admin successfully disburse the loan on "01 July 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + Then Admin checks that last closed business date of loan is "null" + When Admin sets the business date to "10 August 2023" + When Admin runs inline COB job for Loan + Then Admin checks that last closed business date of loan is "09 August 2023" + Then Admin checks that delinquency range is: "RANGE_3" and has delinquentDate "2023-08-03" + Then Loan delinquency history has the following details: + | Range (Classification) | Added on date | Lifted on date | + | RANGE_3 | 09 August 2023 | | + | RANGE_1 | 04 August 2023 | 09 August 2023 | + And Customer makes "AUTOPAY" repayment on "10 August 2023" with 1200 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Admin checks that delinquency range is: "NO_DELINQUENCY" and has delinquentDate "" + Then Loan delinquency history has the following details: + | Range (Classification) | Added on date | Lifted on date | + | RANGE_3 | 09 August 2023 | 10 August 2023 | + | RANGE_1 | 04 August 2023 | 09 August 2023 | + When Admin sets the business date to "11 August 2023" + When Admin runs COB job + Then Admin checks that last closed business date of loan is "09 August 2023" + Then Loan delinquency history has the following details: + | Range (Classification) | Added on date | Lifted on date | + | RANGE_3 | 09 August 2023 | 10 August 2023 | + | RANGE_1 | 04 August 2023 | 09 August 2023 | + + @TestRailId:C2795 @Skip + Scenario: Verify that COB catch up runs properly on loan which is behind date because of locked with error + When Admin sets the business date to "01 January 2022" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2022" + And Admin successfully approves the loan on "01 January 2022" with "1000" amount and expected disbursement date on "01 January 2022" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + Then Admin checks that last closed business date of loan is "null" + When Admin sets the business date to "02 January 2022" + When Admin runs COB job + Then Admin checks that last closed business date of loan is "01 January 2022" + When Admin sets the business date to "03 January 2022" + Then Admin places a lock on loan account with an error message + Then Admin checks that last closed business date of loan is "01 January 2022" + When Admin sets the business date to "05 January 2022" + Then Admin checks that last closed business date of loan is "01 January 2022" + When Admin runs COB catch up + When Admin checks that Loan COB is running until the current business date + Then Admin checks that last closed business date of loan is "04 January 2022" + And Customer makes "AUTOPAY" repayment on "05 January 2022" with 1000 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + + @TestRailId:C2796 + Scenario: Verify that after COB runs there are no unreleased loan locks + When Admin sets the business date to "01 July 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 July 2023" + And Admin successfully approves the loan on "01 July 2023" with "1000" amount and expected disbursement date on "01 July 2023" + When Admin successfully disburse the loan on "01 July 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + Then Admin checks that last closed business date of loan is "null" + When Admin sets the business date to "02 July 2023" + When Admin runs COB job + Then The loan account is not locked + + @TestRailId:C2797 @Skip + Scenario: Verify that Inline COB is executed for stuck loans - when payment happened on a loan with last closed business date in the past, COB got executed before the repayment + When Admin sets the business date to "01 July 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 July 2023" + And Admin successfully approves the loan on "01 July 2023" with "1000" amount and expected disbursement date on "01 July 2023" + When Admin successfully disburse the loan on "01 July 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + Then Admin checks that last closed business date of loan is "null" + When Admin sets the business date to "02 July 2023" + When Admin runs COB job + Then Admin checks that last closed business date of loan is "01 July 2023" + When Admin sets the business date to "04 July 2023" + When Admin creates new user with "NO_BYPASS_AUTOTEST" username, "NO_BYPASS_AUTOTEST_ROLE" role name and given permissions: + | REPAYMENT_LOAN | + When Created user makes externalID controlled "AUTOPAY" repayment on "04 July 2023" with 500 EUR transaction amount + Then Admin checks that last closed business date of loan is "03 July 2023" + +# On a hard locked loan, in case of the lock has an error message, payment by a non-bypass user should trigger inlineCob and it should be executed +# this functionality is not implemented yet + @Skip @TestRailId:C2798 + Scenario: Verify that Inline COB is executed for stuck loans - when payment happened on a locked loan COB got executed before the repayment + When Admin sets the business date to "01 July 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 July 2023" + And Admin successfully approves the loan on "01 July 2023" with "1000" amount and expected disbursement date on "01 July 2023" + When Admin successfully disburse the loan on "01 July 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + Then Admin checks that last closed business date of loan is "null" + When Admin sets the business date to "02 July 2023" + When Admin runs COB job + Then Admin checks that last closed business date of loan is "01 July 2023" + When Admin places a lock on loan account with an error message + When Admin sets the business date to "04 July 2023" + When Admin creates new user with "NO_BYPASS_AUTOTEST" username, "NO_BYPASS_AUTOTEST_ROLE" role name and given permissions: + | REPAYMENT_LOAN | + When Created user makes externalID controlled "AUTOPAY" repayment on "04 July 2023" with 500 EUR transaction amount + Then Admin checks that last closed business date of loan is "03 July 2023" + + @TestRailId:C3044 @AdvancedPaymentAllocation + Scenario: Verify that LoanAccountCustomSnapshotBusinessEvent is created with proper business date when installment is due date and COB runs + Given Admin puts CHECK_DUE_INSTALLMENTS job into LOAN_CLOSE_OF_BUSINESS workflow + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "1000" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "1000" EUR transaction amount + When Admin sets the business date to "17 January 2024" + When Admin runs inline COB job for Loan + Then LoanAccountCustomSnapshotBusinessEvent is created with business date "17 January 2024" + Then Admin removes CHECK_DUE_INSTALLMENTS job from LOAN_CLOSE_OF_BUSINESS workflow + + diff --git a/fineract-e2e-tests-runner/src/test/resources/features/InlineCOB.feature b/fineract-e2e-tests-runner/src/test/resources/features/InlineCOB.feature new file mode 100644 index 00000000000..1bbed7df81d --- /dev/null +++ b/fineract-e2e-tests-runner/src/test/resources/features/InlineCOB.feature @@ -0,0 +1,143 @@ +@InlineCOBFeature +Feature: InlineCOBFeature + + @TestRailId:C2457 + Scenario: As an admin I would like to see that inline COB Happy Path scenario is working properly + When Admin sets the business date to "1 January 2022" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2022" + And Admin successfully approves the loan on "1 January 2022" with "1000" amount and expected disbursement date on "1 January 2022" + When Admin successfully disburse the loan on "1 January 2022" with "1000" EUR transaction amount + When Admin sets the business date to "1 March 2022" + When Admin runs inline COB job for Loan + Then Admin checks that delinquency range is: "RANGE_3" and has delinquentDate "2022-02-03" + + @TestRailId:C2473 + Scenario: As an admin I would like to see that loan was catching up with inline COB + When Admin sets the business date to "1 January 2022" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2022" + And Admin successfully approves the loan on "1 January 2022" with "1000" amount and expected disbursement date on "1 January 2022" + When Admin successfully disburse the loan on "1 January 2022" with "1000" EUR transaction amount + Then Admin checks that last closed business date of loan is "null" + When Admin sets the business date to "2 January 2022" + When Admin runs inline COB job for Loan + Then Admin checks that last closed business date of loan is "01 January 2022" + When Admin sets the business date to "5 January 2022" + When Admin runs inline COB job for Loan + Then Admin checks that last closed business date of loan is "04 January 2022" + + @TestRailId:C2554 + Scenario: As an admin I would like to see that loan was catching up with inline COB on a repayment + When Admin sets the business date to "1 January 2022" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2022" + And Admin successfully approves the loan on "1 January 2022" with "1000" amount and expected disbursement date on "1 January 2022" + When Admin successfully disburse the loan on "1 January 2022" with "1000" EUR transaction amount + Then Admin checks that last closed business date of loan is "null" + When Admin sets the business date to "2 January 2022" + When Admin runs inline COB job for Loan + Then Admin checks that last closed business date of loan is "01 January 2022" + When Admin sets the business date to "5 January 2022" + When Admin creates new user with "NO_BYPASS_AUTOTEST" username, "NO_BYPASS_AUTOTEST_ROLE" role name and given permissions: + | REPAYMENT_LOAN | + And Created user makes "AUTOPAY" repayment on "5 January 2022" with 100 EUR transaction amount + Then Admin checks that last closed business date of loan is "04 January 2022" + + @TestRailId:C2602 + Scenario: Verify that LoanCOBApiFilter works fine in the background and loanId controlled transaction does not trigger inlineCOB if COB had not been applied on loan before + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new Loan with date: "01 January 2023" and with 1 day loan term and repayment + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + Then Admin checks that last closed business date of loan is "null" + When Admin sets the business date to "07 January 2023" + When Admin creates new user with "NO_BYPASS_AUTOTEST" username, "NO_BYPASS_AUTOTEST_ROLE" role name and given permissions: + | REPAYMENT_LOAN | + And Created user makes "AUTOPAY" repayment on "07 January 2023" with 1000 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + Then Loan Transactions tab has a "REPAYMENT" transaction with date "07 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 1000.0 | | + Then Loan delinquency history has the following details: + | Range (Classification) | Added on date | Lifted on date | + | RANGE_1 | 06 January 2023 | 07 January 2023 | + Then Admin checks that last closed business date of loan is "null" + + @TestRailId:C2603 + Scenario: Verify that LoanCOBApiFilter works fine in the background and externalId controlled transaction does not trigger inlineCOB if COB had not been applied on loan before + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new Loan with date: "01 January 2023" and with 1 day loan term and repayment + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + Then Admin checks that last closed business date of loan is "null" + When Admin sets the business date to "07 January 2023" + When Admin creates new user with "NO_BYPASS_AUTOTEST" username, "NO_BYPASS_AUTOTEST_ROLE" role name and given permissions: + | REPAYMENT_LOAN | + When Created user makes externalID controlled "AUTOPAY" repayment on "07 January 2023" with 1000 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + Then Loan Transactions tab has a "REPAYMENT" transaction with date "07 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 1000.0 | | + Then Loan delinquency history has the following details: + | Range (Classification) | Added on date | Lifted on date | + | RANGE_1 | 06 January 2023 | 07 January 2023 | + Then Admin checks that last closed business date of loan is "null" + + @TestRailId:C2604 + Scenario: Verify that LoanCOBApiFilter works fine in the background and loanId controlled transaction triggers inlineCOB if COB had been applied on loan before + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new Loan with date: "01 January 2023" and with 1 day loan term and repayment + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + Then Admin checks that last closed business date of loan is "null" + When Admin sets the business date to "2 January 2023" + When Admin runs inline COB job for Loan + Then Admin checks that last closed business date of loan is "01 January 2023" + When Admin sets the business date to "07 January 2023" + When Admin creates new user with "NO_BYPASS_AUTOTEST" username, "NO_BYPASS_AUTOTEST_ROLE" role name and given permissions: + | REPAYMENT_LOAN | + And Created user makes "AUTOPAY" repayment on "07 January 2023" with 1000 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + Then Loan Transactions tab has a "REPAYMENT" transaction with date "07 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 1000.0 | | + Then Loan delinquency history has the following details: + | Range (Classification) | Added on date | Lifted on date | + | RANGE_1 | 06 January 2023 | 07 January 2023 | + Then Admin checks that last closed business date of loan is "06 January 2023" + + @TestRailId:C2605 + Scenario: Verify that LoanCOBApiFilter works fine in the background and externalId controlled transaction triggers inlineCOB if COB had been applied on loan before + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new Loan with date: "01 January 2023" and with 1 day loan term and repayment + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + Then Admin checks that last closed business date of loan is "null" + When Admin sets the business date to "2 January 2023" + When Admin runs inline COB job for Loan + Then Admin checks that last closed business date of loan is "01 January 2023" + When Admin sets the business date to "07 January 2023" + When Admin creates new user with "NO_BYPASS_AUTOTEST" username, "NO_BYPASS_AUTOTEST_ROLE" role name and given permissions: + | REPAYMENT_LOAN | + When Created user makes externalID controlled "AUTOPAY" repayment on "07 January 2023" with 1000 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + Then Loan Transactions tab has a "REPAYMENT" transaction with date "07 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 1000.0 | | + Then Loan delinquency history has the following details: + | Range (Classification) | Added on date | Lifted on date | + | RANGE_1 | 06 January 2023 | 07 January 2023 | + Then Admin checks that last closed business date of loan is "06 January 2023" diff --git a/fineract-e2e-tests-runner/src/test/resources/features/Loan.feature b/fineract-e2e-tests-runner/src/test/resources/features/Loan.feature new file mode 100644 index 00000000000..139754dfc83 --- /dev/null +++ b/fineract-e2e-tests-runner/src/test/resources/features/Loan.feature @@ -0,0 +1,5510 @@ +@LoanFeature +Feature: Loan + + @TestRailId:C16 @Smoke + Scenario: Loan creation functionality in Fineract + When Admin sets the business date to the actual date + When Admin creates a client with random data + When Admin creates a new Loan + + @TestRailId:C17 + Scenario: Loan creation functionality in Fineract + When Admin sets the business date to "1 July 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 July 2022", with Principal: "5000", a loanTermFrequency: 24 months, and numberOfRepayments: 24 + + @TestRailId:C42 + Scenario: As a user I would like to see that the loan is not created if the loan submission date is after the business date + When Admin sets the business date to "25 June 2022" + When Admin creates a client with random data + Then Admin fails to create a new customised Loan submitted on date: "1 July 2022", with Principal: "5000", a loanTermFrequency: 24 months, and numberOfRepayments: 24 + + @TestRailId:C43 + Scenario: As a user I would like to see that the loan is created if the loan submission date is equal to business date + When Admin sets the business date to "1 July 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 July 2022", with Principal: "5000", a loanTermFrequency: 24 months, and numberOfRepayments: 24 + + @TestRailId:C46 + Scenario: As a user I would like to see that the loan is approved at the business date + When Admin sets the business date to "1 July 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 July 2022", with Principal: "5000", a loanTermFrequency: 24 months, and numberOfRepayments: 24 + And Admin successfully approves the loan on "1 July 2022" with "5000" amount and expected disbursement date on "2 July 2022" + + @TestRailId:C30 @single + Scenario: As a user I would like to see that the loan is cannot be approved with future approval date + When Admin sets the business date to "1 July 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 July 2022", with Principal: "5000", a loanTermFrequency: 24 months, and numberOfRepayments: 24 + Then Admin fails to approve the loan on "2 July 2022" with "5000" amount and expected disbursement date on "2 July 2022" because of wrong date + + @TestRailId:C47 @multi + Scenario: As a user I would like to see that the loan can be disbursed at the business date + When Admin sets the business date to "1 July 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 July 2022", with Principal: "5000", a loanTermFrequency: 24 months, and numberOfRepayments: 24 + And Admin successfully approves the loan on "1 July 2022" with "5000" amount and expected disbursement date on "2 July 2022" + When Admin successfully disburse the loan on "1 July 2022" with "5000" EUR transaction amount + + @TestRailId:C31 + Scenario: As a user I would like to see that the loan is cannot be disbursed with future disburse date + When Admin sets the business date to "1 July 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 July 2022", with Principal: "5000", a loanTermFrequency: 24 months, and numberOfRepayments: 24 + And Admin successfully approves the loan on "1 July 2022" with "5000" amount and expected disbursement date on "2 July 2022" + Then Admin fails to disburse the loan on "2 July 2022" with "5000" EUR transaction amount because of wrong date + + @TestRailId:C64 + Scenario: As a user I would like to see that 50% over applied amount can be approved and disbursed on loan correctly + When Admin sets the business date to "1 September 2022" + When Admin creates a client with random data + When Admin successfully creates a new customised Loan submitted on date: "1 September 2022", with Principal: "1000", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 September 2022" with "1500" amount and expected disbursement date on "1 September 2022" + When Admin successfully disburse the loan on "1 September 2022" with "1500" EUR transaction amount + + @TestRailId:C65 + Scenario: As a user I would like to see that 50% over applied amount can be approved but more than 50% cannot be disbursed on loan + When Admin sets the business date to "1 September 2022" + When Admin creates a client with random data + When Admin successfully creates a new customised Loan submitted on date: "1 September 2022", with Principal: "1000", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 September 2022" with "1500" amount and expected disbursement date on "1 September 2022" + Then Admin fails to disburse the loan on "1 September 2022" with "1501" EUR transaction amount because of wrong amount + + @TestRailId:C66 + Scenario: As a user I would like to see that more than 50% over applied amount can not be approved on loan + When Admin sets the business date to "1 September 2022" + When Admin creates a client with random data + When Admin successfully creates a new customised Loan submitted on date: "1 September 2022", with Principal: "1000", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + Then Admin fails to approve the loan on "1 September 2022" with "1501" amount and expected disbursement date on "1 September 2022" because of wrong amount + + @TestRailId:C2769 + Scenario: As a user I would like to see that more than 50% over applied amount in total can not be disbursed on loan + When Admin sets the business date to "1 September 2022" + When Admin creates a client with random data + When Admin successfully creates a new customised Loan submitted on date: "1 September 2022", with Principal: "1000", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 September 2022" with "1500" amount and expected disbursement date on "1 September 2022" + And Admin successfully disburse the loan on "1 September 2022" with "1400" EUR transaction amount + Then Admin fails to disburse the loan on "1 September 2022" with "101" EUR transaction amount because of wrong amount + + @TestRailId:C67 + Scenario: As admin I would like to check that amounts are distributed equally in loan repayment schedule + When Admin sets the business date to "1 September 2022" + When Admin creates a client with random data + When Admin successfully creates a new customised Loan submitted on date: "1 September 2022", with Principal: "1000", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 September 2022" with "1000" amount and expected disbursement date on "1 September 2022" + Then Amounts are distributed equally in loan repayment schedule in case of total amount 1000 + When Admin successfully disburse the loan on "1 September 2022" with "900" EUR transaction amount + Then Amounts are distributed equally in loan repayment schedule in case of total amount 900 + + @TestRailId:C68 + Scenario: As admin I would like to be sure that approval of on loan can be undone + When Admin sets the business date to "1 September 2022" + When Admin creates a client with random data + When Admin successfully creates a new customised Loan submitted on date: "1 September 2022", with Principal: "1000", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 September 2022" with "1000" amount and expected disbursement date on "1 September 2022" + Then Admin can successfully undone the loan approval + + @TestRailId:C69 + Scenario: As admin I would like to be sure that disbursal of on loan can be undone + When Admin sets the business date to "1 September 2022" + When Admin creates a client with random data + When Admin successfully creates a new customised Loan submitted on date: "1 September 2022", with Principal: "1000", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 September 2022" with "1000" amount and expected disbursement date on "1 September 2022" + When Admin successfully disburse the loan on "1 September 2022" with "1000" EUR transaction amount + Then Admin can successfully undone the loan disbursal + Then Admin can successfully undone the loan approval + And Admin successfully approves the loan on "1 September 2022" with "1000" amount and expected disbursement date on "1 September 2022" + + @TestRailId:C70 + Scenario: As admin I would like to be sure that submitted on date can be edited on loan + When Admin sets the business date to "1 September 2022" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 September 2022" + Then Admin can successfully modify the loan and changes the submitted on date to "31 August 2022" + + @TestRailId:C2454 @fraud + Scenario: As admin I would like to set Fraud flag to a loan + When Admin sets the business date to "1 September 2022" + When Admin creates a client with random data + When Admin successfully creates a new customised Loan submitted on date: "1 September 2022", with Principal: "1000", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 September 2022" with "1000" amount and expected disbursement date on "1 September 2022" + When Admin successfully disburse the loan on "1 September 2022" with "1000" EUR transaction amount + Then Admin can successfully set Fraud flag to the loan + + @TestRailId:C2455 @fraud + Scenario: As admin I would like to unset Fraud flag to a loan + When Admin sets the business date to "1 September 2022" + When Admin creates a client with random data + When Admin successfully creates a new customised Loan submitted on date: "1 September 2022", with Principal: "1000", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 September 2022" with "1000" amount and expected disbursement date on "1 September 2022" + When Admin successfully disburse the loan on "1 September 2022" with "1000" EUR transaction amount + Then Admin can successfully set Fraud flag to the loan + Then Admin can successfully unset Fraud flag to the loan + + + @TestRailId:C2456 @fraud + Scenario: As admin I would like to try to add fraud flag on a not active loan + When Admin sets the business date to "25 October 2022" + When Admin creates a client with random data + When Admin successfully creates a new customised Loan submitted on date: "25 October 2022", with Principal: "1000", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "25 October 2022" with "1000" amount and expected disbursement date on "25 October 2022" + Then Admin can successfully unset Fraud flag to the loan + + @TestRailId:C2473 @idempotency + Scenario: As admin I would like to verify that idempotency APIs can be called with the Idempotency-Key header + When Admin sets the business date to "1 November 2022" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 November 2022" + And Admin successfully approves the loan on "1 November 2022" with "1000" amount and expected disbursement date on "1 November 2022" + When Admin successfully disburse the loan on "1 November 2022" with "1000" EUR transaction amount + When Admin sets the business date to "15 November 2022" + When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "15 November 2022" with 200 EUR transaction amount and self-generated Idempotency key + Then Loan has 1 "DISBURSEMENT" transactions on Transactions tab + Then Loan has 1 "REPAYMENT" transactions on Transactions tab + + @TestRailId:C2474 @idempotency + Scenario: As admin I would like to verify that idempotency APIs can be called without the Idempotency-Key header + When Admin sets the business date to "1 November 2022" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 November 2022" + And Admin successfully approves the loan on "1 November 2022" with "1000" amount and expected disbursement date on "1 November 2022" + When Admin successfully disburse the loan on "1 November 2022" with "1000" EUR transaction amount + When Admin sets the business date to "15 November 2022" + When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "15 November 2022" with 200 EUR transaction amount and system-generated Idempotency key + Then Loan has 1 "DISBURSEMENT" transactions on Transactions tab + Then Loan has 1 "REPAYMENT" transactions on Transactions tab + + @TestRailId:C2475 @idempotency + Scenario: As admin I would like to verify that idempotency applies correctly in a happy path scenario in case of REPAYMENT transaction + When Admin sets the business date to "1 November 2022" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 November 2022" + And Admin successfully approves the loan on "1 November 2022" with "1000" amount and expected disbursement date on "1 November 2022" + When Admin successfully disburse the loan on "1 November 2022" with "1000" EUR transaction amount + When Admin sets the business date to "15 November 2022" + When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "15 November 2022" with 200 EUR transaction amount and self-generated Idempotency key + And Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "15 November 2022" with 300 EUR transaction amount with the same Idempotency key as previous transaction + Then Transaction response has boolean value in header "x-served-from-cache": "true" + Then Transaction response has 200 EUR value for transaction amount + Then Transaction response has the correct clientId and the loanId of the first transaction + Then Loan has 1 "REPAYMENT" transactions on Transactions tab + + @TestRailId:C2476 @idempotency + Scenario: As admin I would like to verify that idempotency applies correctly in a happy path scenario in case of GOODWILL_CREDIT transaction + When Admin sets the business date to "1 November 2022" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 November 2022" + And Admin successfully approves the loan on "1 November 2022" with "1000" amount and expected disbursement date on "1 November 2022" + When Admin successfully disburse the loan on "1 November 2022" with "1000" EUR transaction amount + When Admin sets the business date to "15 November 2022" + When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "15 November 2022" with 1000 EUR transaction amount and system-generated Idempotency key + When Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "15 November 2022" with 200 EUR transaction amount and self-generated Idempotency key + And Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "15 November 2022" with 300 EUR transaction amount with the same Idempotency key as previous transaction + Then Transaction response has boolean value in header "x-served-from-cache": "true" + Then Transaction response has 200 EUR value for transaction amount + Then Transaction response has the correct clientId and the loanId of the first transaction + Then Loan has 1 "GOODWILL_CREDIT" transactions on Transactions tab + + @TestRailId:C2477 @idempotency + Scenario: As admin I would like to verify that idempotency applies correctly in a happy path scenario in case of PAYOUT_REFUND transaction + When Admin sets the business date to "1 November 2022" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 November 2022" + And Admin successfully approves the loan on "1 November 2022" with "1000" amount and expected disbursement date on "1 November 2022" + When Admin successfully disburse the loan on "1 November 2022" with "1000" EUR transaction amount + When Admin sets the business date to "15 November 2022" + When Customer makes "PAYOUT_REFUND" transaction with "AUTOPAY" payment type on "15 November 2022" with 200 EUR transaction amount and self-generated Idempotency key + And Customer makes "PAYOUT_REFUND" transaction with "AUTOPAY" payment type on "15 November 2022" with 300 EUR transaction amount with the same Idempotency key as previous transaction + Then Transaction response has boolean value in header "x-served-from-cache": "true" + Then Transaction response has 200 EUR value for transaction amount + Then Transaction response has the correct clientId and the loanId of the first transaction + Then Loan has 1 "PAYOUT_REFUND" transactions on Transactions tab + + @TestRailId:C2478 @idempotency + Scenario: As admin I would like to verify that idempotency applies correctly in a happy path scenario in case of MERCHANT_ISSUED_REFUND transaction + When Admin sets the business date to "1 November 2022" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 November 2022" + And Admin successfully approves the loan on "1 November 2022" with "1000" amount and expected disbursement date on "1 November 2022" + When Admin successfully disburse the loan on "1 November 2022" with "1000" EUR transaction amount + When Admin sets the business date to "15 November 2022" + When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "15 November 2022" with 200 EUR transaction amount and self-generated Idempotency key + And Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "15 November 2022" with 300 EUR transaction amount with the same Idempotency key as previous transaction + Then Transaction response has boolean value in header "x-served-from-cache": "true" + Then Transaction response has 200 EUR value for transaction amount + Then Transaction response has the correct clientId and the loanId of the first transaction + Then Loan has 1 "MERCHANT_ISSUED_REFUND" transactions on Transactions tab + + @TestRailId:C2482 @idempotency + Scenario: As admin I would like to verify that idempotency applies correctly in case of client calls the same idempotency key on a second loan + When Admin sets the business date to "1 November 2022" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 November 2022" + And Admin successfully approves the loan on "1 November 2022" with "1000" amount and expected disbursement date on "1 November 2022" + When Admin successfully disburse the loan on "1 November 2022" with "1000" EUR transaction amount + When Admin crates a second default loan with date: "1 November 2022" + And Admin successfully approves the second loan on "1 November 2022" with "1000" amount and expected disbursement date on "1 November 2022" + When Admin successfully disburse the second loan on "1 November 2022" with "1000" EUR transaction amount + When Admin sets the business date to "15 November 2022" + When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "15 November 2022" with 200 EUR transaction amount and self-generated Idempotency key + And Customer makes "REPAYMENT" transaction on the second loan with "AUTOPAY" payment type on "15 November 2022" with 300 EUR transaction amount with the same Idempotency key as previous transaction + Then Transaction response has boolean value in header "x-served-from-cache": "true" + Then Transaction response has 200 EUR value for transaction amount + Then Transaction response has the correct clientId and the loanId of the first transaction + Then Loan has 1 "REPAYMENT" transactions on Transactions tab + Then Second loan has 0 "REPAYMENT" transactions on Transactions tab + +# TODO it will fail until different client can see each other cached response with same idempotent key is fixed + @Skip @TestRailId:C2483 @idempotency + Scenario: As admin I would like to verify that idempotency applies correctly in case of a second client calls the same idempotency key on a second loan + When Admin sets the business date to "1 November 2022" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 November 2022" + And Admin successfully approves the loan on "1 November 2022" with "1000" amount and expected disbursement date on "1 November 2022" + When Admin successfully disburse the loan on "1 November 2022" with "1000" EUR transaction amount + When Admin creates a second client with random data + When Admin crates a second default loan for the second client with date: "1 November 2022" + And Admin successfully approves the second loan on "1 November 2022" with "1000" amount and expected disbursement date on "1 November 2022" + When Admin successfully disburse the second loan on "1 November 2022" with "1000" EUR transaction amount + When Admin sets the business date to "15 November 2022" + When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "15 November 2022" with 200 EUR transaction amount and self-generated Idempotency key + And Customer makes "REPAYMENT" transaction on the second loan with "AUTOPAY" payment type on "15 November 2022" with 300 EUR transaction amount with the same Idempotency key as previous transaction + Then Transaction response has boolean value in header "x-served-from-cache": "true" + Then Transaction response has 300 EUR value for transaction amount + Then Transaction response has the clientId for the second client and the loanId of the second transaction + Then Loan has 1 "REPAYMENT" transactions on Transactions tab + Then Second loan has 1 "REPAYMENT" transactions on Transactions tab + + @TestRailId:C2479 + Scenario: As admin I would like to be sure that goodwill credit transaction is working properly + When Admin sets the business date to "1 November 2022" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 November 2022" + And Admin successfully approves the loan on "1 November 2022" with "1000" amount and expected disbursement date on "1 November 2022" + When Admin successfully disburse the loan on "1 November 2022" with "1000" EUR transaction amount + When Admin sets the business date to "15 November 2022" + And Customer makes "AUTOPAY" repayment on "15 November 2022" with 1000 EUR transaction amount + When Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "15 November 2022" with 200 EUR transaction amount and self-generated Idempotency key + Then Loan has 1 "GOODWILL_CREDIT" transactions on Transactions tab + + @TestRailId:C2480 + Scenario: As admin I would like to be sure that payout refund transaction is working properly + When Admin sets the business date to "1 November 2022" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 November 2022" + And Admin successfully approves the loan on "1 November 2022" with "1000" amount and expected disbursement date on "1 November 2022" + When Admin successfully disburse the loan on "1 November 2022" with "1000" EUR transaction amount + When Admin sets the business date to "15 November 2022" + And Customer makes "AUTOPAY" repayment on "15 November 2022" with 1000 EUR transaction amount + When Customer makes "PAYOUT_REFUND" transaction with "AUTOPAY" payment type on "15 November 2022" with 200 EUR transaction amount and self-generated Idempotency key + Then Loan has 1 "PAYOUT_REFUND" transactions on Transactions tab + + @TestRailId:C2481 + Scenario: As admin I would like to be sure that merchant issued refund transaction is working properly + When Admin sets the business date to "1 November 2022" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 November 2022" + And Admin successfully approves the loan on "1 November 2022" with "1000" amount and expected disbursement date on "1 November 2022" + When Admin successfully disburse the loan on "1 November 2022" with "1000" EUR transaction amount + When Admin sets the business date to "15 November 2022" + And Customer makes "AUTOPAY" repayment on "15 November 2022" with 1000 EUR transaction amount + When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "15 November 2022" with 200 EUR transaction amount and self-generated Idempotency key + Then Loan has 1 "MERCHANT_ISSUED_REFUND" transactions on Transactions tab + + @TestRailId:C2488 + Scenario: As admin I would like to be sure that no multiple status change event got raised during transaction replaying + When Admin sets the business date to "1 November 2022" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 November 2022" + And Admin successfully approves the loan on "1 November 2022" with "1000" amount and expected disbursement date on "1 November 2022" + Then Loan status has changed to "Approved" + When Admin successfully disburse the loan on "1 November 2022" with "1000" EUR transaction amount + Then Loan status has changed to "Active" + When Admin sets the business date to "2 November 2022" + And Customer makes "AUTOPAY" repayment on "2 November 2022" with 500 EUR transaction amount + When Admin sets the business date to "3 November 2022" + And Customer makes "AUTOPAY" repayment on "3 November 2022" with 100 EUR transaction amount + When Admin sets the business date to "4 November 2022" + And Customer makes "AUTOPAY" repayment on "4 November 2022" with 600 EUR transaction amount + Then Loan status has changed to "Overpaid" + When Customer undo "2"th repayment on "4 November 2022" + Then No new event with type "LoanStatusChangedEvent" has been raised for the loan + When Customer undo "1"th repayment on "4 November 2022" + Then Loan status has changed to "Active" + + @TestRailId:C2489 + Scenario: As admin I would like to charge-off a loan and be sure the event was triggered + When Admin sets the business date to "1 November 2022" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 November 2022" + And Admin successfully approves the loan on "1 November 2022" with "1000" amount and expected disbursement date on "1 November 2022" + When Admin successfully disburse the loan on "1 November 2022" with "1000" EUR transaction amount + When Admin sets the business date to "2 November 2022" + And Customer makes "AUTOPAY" repayment on "2 November 2022" with 500 EUR transaction amount + When Admin sets the business date to "3 November 2022" + And Admin does charge-off the loan on "3 November 2022" + Then Loan marked as charged-off on "03 November 2022" + + @TestRailId:C2491 + Scenario: As a user I would like to do multiple repayment, overpay the loan and reverse-replaying transactions and check outstanding balance + When Admin sets the business date to "01 November 2022" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 November 2022" + And Admin successfully approves the loan on "01 November 2022" with "1000" amount and expected disbursement date on "01 November 2022" + When Admin successfully disburse the loan on "01 November 2022" with "1000" EUR transaction amount + Then Loan has 1000 outstanding amount + When Admin sets the business date to "02 November 2022" + And Customer makes "AUTOPAY" repayment on "02 November 2022" with 500 EUR transaction amount + Then Loan Transactions tab has a transaction with date: "02 November 2022", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Repayment | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan has 500 outstanding amount + When Admin sets the business date to "03 November 2022" + And Customer makes "AUTOPAY" repayment on "03 November 2022" with 10 EUR transaction amount + Then Loan Transactions tab has a transaction with date: "03 November 2022", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Repayment | 10.0 | 10.0 | 0.0 | 0.0 | 0.0 | 490.0 | + Then Loan has 490 outstanding amount + When Admin sets the business date to "04 November 2022" + And Customer makes "AUTOPAY" repayment on "04 November 2022" with 400 EUR transaction amount + Then Loan Transactions tab has a transaction with date: "04 November 2022", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Repayment | 400.0 | 400.0 | 0.0 | 0.0 | 0.0 | 90.0 | + Then Loan has 90 outstanding amount + When Admin sets the business date to "05 November 2022" + And Customer makes "AUTOPAY" repayment on "05 November 2022" with 390 EUR transaction amount + Then Loan Transactions tab has a transaction with date: "05 November 2022", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Repayment | 390.0 | 90.0 | 0.0 | 0.0 | 0.0 | 0.0 | + Then Loan has 300 overpaid amount + When Customer undo "2"th repayment on "04 November 2022" + Then In Loan Transactions the "3"th Transaction has Transaction type="Repayment" and is reverted + Then Loan Transactions tab has a transaction with date: "04 November 2022", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Repayment | 400.0 | 400.0 | 0.0 | 0.0 | 0.0 | 100.0 | + Then Loan Transactions tab has a transaction with date: "05 November 2022", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Repayment | 390.0 | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | + Then Loan has 290 overpaid amount + When Customer undo "1"th repayment on "04 November 2022" + Then In Loan Transactions the "2"th Transaction has Transaction type="Repayment" and is reverted + Then In Loan Transactions the "3"th Transaction has Transaction type="Repayment" and is reverted + Then Loan Transactions tab has a transaction with date: "04 November 2022", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Repayment | 400.0 | 400.0 | 0.0 | 0.0 | 0.0 | 600.0 | + Then Loan Transactions tab has a transaction with date: "05 November 2022", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Repayment | 390.0 | 390.0 | 0.0 | 0.0 | 0.0 | 210.0 | + Then Loan has 210 outstanding amount + And Customer makes "AUTOPAY" repayment on "02 November 2022" with 500 EUR transaction amount + Then Loan has 290 overpaid amount + + @TestRailId:C2502 + Scenario: Verify that Loan status goes from active to overpaid in case of Goodwill credit transaction when transaction amount is greater than balance + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "3 January 2023" + And Customer makes "AUTOPAY" repayment on "3 January 2023" with 450 EUR transaction amount + When Admin sets the business date to "5 January 2023" + And Customer makes "AUTOPAY" repayment on "5 January 2023" with 250 EUR transaction amount + Then Loan status will be "ACTIVE" + Then Loan has 300 outstanding amount + When Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "5 January 2023" with 400 EUR transaction amount and system-generated Idempotency key + Then Loan status will be "OVERPAID" + Then Loan has 0 outstanding amount + Then Loan has 100 overpaid amount + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "03 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 450.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 450.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "05 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "GOODWILL_CREDIT" transaction with date "05 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 300.0 | + | LIABILITY | l1 | Overpayment account | | 100.0 | + | EXPENSE | 744003 | Goodwill Expense Account | 400.0 | | + + @TestRailId:C2503 + Scenario: Verify that Loan status goes from active to overpaid in case of Backdated 3rd repayment when transaction amount is greater than balance + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "3 January 2023" + And Customer makes "AUTOPAY" repayment on "3 January 2023" with 450 EUR transaction amount + When Admin sets the business date to "5 January 2023" + And Customer makes "AUTOPAY" repayment on "5 January 2023" with 250 EUR transaction amount + Then Loan status will be "ACTIVE" + Then Loan has 300 outstanding amount + And Customer makes "AUTOPAY" repayment on "2 January 2023" with 400 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 0 outstanding amount + Then Loan has 100 overpaid amount + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "02 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 400.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 400.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "03 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 450.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 450.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "05 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 150.0 | + | LIABILITY | l1 | Overpayment account | | 100.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + + + @TestRailId:C2504 + Scenario: Verify that Loan status goes from overpaid to active in case of Chargeback transaction when transaction amount is greater than overpaid amount + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "3 January 2023" + And Customer makes "AUTOPAY" repayment on "3 January 2023" with 450 EUR transaction amount + When Admin sets the business date to "5 January 2023" + And Customer makes "AUTOPAY" repayment on "5 January 2023" with 450 EUR transaction amount + And Customer makes "AUTOPAY" repayment on "5 January 2023" with 300 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 0 outstanding amount + Then Loan has 200 overpaid amount + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 300 EUR transaction amount + Then Loan status will be "ACTIVE" + Then Loan has 100 outstanding amount + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "03 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 450.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 450.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "05 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 450.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 450.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "05 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 100.0 | + | LIABILITY | l1 | Overpayment account | | 200.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 300.0 | | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "05 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 100.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 300.0 | + | LIABILITY | l1 | Overpayment account | 200.0 | | + + @TestRailId:C2506 + Scenario: Verify that Loan status goes from overpaid to active in case of 1st repayment is undone + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "3 January 2023" + And Customer makes "AUTOPAY" repayment on "3 January 2023" with 450 EUR transaction amount + When Admin sets the business date to "5 January 2023" + And Customer makes "AUTOPAY" repayment on "5 January 2023" with 450 EUR transaction amount + And Customer makes "AUTOPAY" repayment on "5 January 2023" with 300 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 0 outstanding amount + Then Loan has 200 overpaid amount + When Customer undo "1"th repayment on "3 January 2023" + Then Loan status will be "ACTIVE" + Then Loan has 250 outstanding amount + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "03 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 450.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 450.0 | | + | ASSET | 112601 | Loans Receivable | 450.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 450.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "05 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 450.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 450.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "05 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 300.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 300.0 | | + + @TestRailId:C2507 + Scenario: Verify that Loan status goes from active to closed in case of Goodwill credit transaction when transaction amount equals balance + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "3 January 2023" + And Customer makes "AUTOPAY" repayment on "3 January 2023" with 450 EUR transaction amount + When Admin sets the business date to "5 January 2023" + And Customer makes "AUTOPAY" repayment on "5 January 2023" with 250 EUR transaction amount + Then Loan status will be "ACTIVE" + Then Loan has 300 outstanding amount + When Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "5 January 2023" with 300 EUR transaction amount and system-generated Idempotency key + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "03 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 450.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 450.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "05 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "GOODWILL_CREDIT" transaction with date "05 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 300.0 | + | EXPENSE | 744003 | Goodwill Expense Account | 300.0 | | + + @TestRailId:C2508 + Scenario: Verify that Loan status goes from active to closed in case of Backdated 3rd repayment when transaction amount equals balance + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "3 January 2023" + And Customer makes "AUTOPAY" repayment on "3 January 2023" with 450 EUR transaction amount + When Admin sets the business date to "5 January 2023" + And Customer makes "AUTOPAY" repayment on "5 January 2023" with 250 EUR transaction amount + Then Loan status will be "ACTIVE" + Then Loan has 300 outstanding amount + And Customer makes "AUTOPAY" repayment on "2 January 2023" with 300 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "02 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 300.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 300.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "03 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 450.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 450.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "05 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + + @TestRailId:C2509 + Scenario: Verify that Loan status goes from closed to overpaid in case of Goodwill credit transaction + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "3 January 2023" + And Customer makes "AUTOPAY" repayment on "3 January 2023" with 500 EUR transaction amount + When Admin sets the business date to "5 January 2023" + And Customer makes "AUTOPAY" repayment on "5 January 2023" with 300 EUR transaction amount + When Admin sets the business date to "7 January 2023" + And Customer makes "AUTOPAY" repayment on "7 January 2023" with 200 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + When Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "7 January 2023" with 100 EUR transaction amount and system-generated Idempotency key + Then Loan status will be "OVERPAID" + Then Loan has 0 outstanding amount + Then Loan has 100 overpaid amount + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "03 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 500.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "05 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 300.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 300.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "07 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 200.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 200.0 | | + Then Loan Transactions tab has a "GOODWILL_CREDIT" transaction with date "07 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | LIABILITY | l1 | Overpayment account | | 100.0 | + | EXPENSE | 744003 | Goodwill Expense Account | 100.0 | | + + + @TestRailId:C2510 + Scenario: Verify that Loan status goes from overpaid to closed in case of Chargeback transaction when transaction amount equals overpaid amount + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "3 January 2023" + And Customer makes "AUTOPAY" repayment on "3 January 2023" with 450 EUR transaction amount + When Admin sets the business date to "5 January 2023" + And Customer makes "AUTOPAY" repayment on "5 January 2023" with 450 EUR transaction amount + And Customer makes "AUTOPAY" repayment on "5 January 2023" with 300 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 0 outstanding amount + Then Loan has 200 overpaid amount + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 200 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "03 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 450.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 450.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "05 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 450.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 450.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "05 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 100.0 | + | LIABILITY | l1 | Overpayment account | | 200.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 300.0 | | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "05 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | LIABILITY | l1 | Overpayment account | 200.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 200.0 | + + + @TestRailId:C2512 + Scenario: Verify that Loan status goes from overpaid to closed in case of 1st repayment is undone + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "3 January 2023" + And Customer makes "AUTOPAY" repayment on "3 January 2023" with 200 EUR transaction amount + When Admin sets the business date to "5 January 2023" + And Customer makes "AUTOPAY" repayment on "5 January 2023" with 700 EUR transaction amount + And Customer makes "AUTOPAY" repayment on "5 January 2023" with 300 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 0 outstanding amount + Then Loan has 200 overpaid amount + When Customer undo "1"th repayment on "3 January 2023" + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "03 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 200.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 200.0 | | + | ASSET | 112601 | Loans Receivable | 200.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 200.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "05 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 700.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 700.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "05 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 300.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 300.0 | | + + @TestRailId:C2513 + Scenario: Verify that Loan status goes from closed to active in case of Chargeback transaction + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "3 January 2023" + And Customer makes "AUTOPAY" repayment on "3 January 2023" with 500 EUR transaction amount + When Admin sets the business date to "5 January 2023" + And Customer makes "AUTOPAY" repayment on "5 January 2023" with 300 EUR transaction amount + When Admin sets the business date to "7 January 2023" + And Customer makes "AUTOPAY" repayment on "7 January 2023" with 200 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 200 EUR transaction amount + Then Loan status will be "ACTIVE" + Then Loan has 200 outstanding amount + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "03 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 500.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "05 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 300.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 300.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "07 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 200.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 200.0 | | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "07 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 200.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 200.0 | + + @TestRailId:C2514 + Scenario: Verify that Loan status goes from closed to active in case of 1st repayment is undone + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "3 January 2023" + And Customer makes "AUTOPAY" repayment on "3 January 2023" with 200 EUR transaction amount + When Admin sets the business date to "5 January 2023" + And Customer makes "AUTOPAY" repayment on "5 January 2023" with 600 EUR transaction amount + When Admin sets the business date to "7 January 2023" + And Customer makes "AUTOPAY" repayment on "7 January 2023" with 200 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + When Customer undo "1"th repayment on "3 January 2023" + Then Loan status will be "ACTIVE" + Then Loan has 200 outstanding amount + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "03 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 200.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 200.0 | | + | ASSET | 112601 | Loans Receivable | 200.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 200.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "05 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 600.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 600.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "07 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 200.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 200.0 | | + + + @TestRailId:C2539 + Scenario: Verify that loan overdue calculation is updated upon Goodwill credit transaction + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "1 March 2023" + When Admin runs inline COB job for Loan + Then Admin checks that delinquency range is: "RANGE_3" and has delinquentDate "2023-02-03" + Then Loan status will be "ACTIVE" + Then Loan has 1000 outstanding amount + When Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "1 March 2023" with 1000 EUR transaction amount and system-generated Idempotency key + Then Admin checks that delinquency range is: "NO_DELINQUENCY" and has delinquentDate "" + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + + @TestRailId:C2540 + Scenario: Verify that loan overdue calculation is updated upon Payout refund transaction + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "1 March 2023" + When Admin runs inline COB job for Loan + Then Admin checks that delinquency range is: "RANGE_3" and has delinquentDate "2023-02-03" + Then Loan status will be "ACTIVE" + Then Loan has 1000 outstanding amount + When Customer makes "PAYOUT_REFUND" transaction with "AUTOPAY" payment type on "1 March 2023" with 1000 EUR transaction amount and system-generated Idempotency key + Then Admin checks that delinquency range is: "NO_DELINQUENCY" and has delinquentDate "" + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + + @TestRailId:C2541 + Scenario: Verify that loan overdue calculation is updated upon Merchant issued refund transaction + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "1 March 2023" + When Admin runs inline COB job for Loan + Then Admin checks that delinquency range is: "RANGE_3" and has delinquentDate "2023-02-03" + Then Loan status will be "ACTIVE" + Then Loan has 1000 outstanding amount + When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "1 March 2023" with 1000 EUR transaction amount and system-generated Idempotency key + Then Admin checks that delinquency range is: "NO_DELINQUENCY" and has delinquentDate "" + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + + @TestRailId:C2552 + Scenario: Verify that delinquency event contains the correct delinquentDate in case of one repayment is overdue + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "5 March 2023" + When Admin runs inline COB job for Loan + Then Admin checks that delinquency range is: "RANGE_3" and has delinquentDate "2023-02-03" + + @TestRailId:C2553 + Scenario: Verify that delinquency event contains the correct delinquentDate in case of multiple repayments are overdue + When Admin sets the business date to "1 January 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 | + | PIN30 | 1 January 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "5 April 2023" + When Admin runs inline COB job for Loan + Then Admin checks that delinquency range is: "RANGE_30" and has delinquentDate "2023-02-04" + + @TestRailId:C2583 + Scenario: Verify last payment related fields when retrieving loan details with 1 repayment + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "03 January 2023" + And Customer makes "AUTOPAY" repayment on "03 January 2023" with 200 EUR transaction amount + Then Loan details has the following last payment related data: + | lastPaymentAmount | lastPaymentDate | lastRepaymentAmount | lastRepaymentDate | + | 200.0 | 03 January 2023 | 200.0 | 03 January 2023 | + + @TestRailId:C2586 + Scenario: Verify last payment related fields when retrieving loan details with 2 repayments on different day + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "03 January 2023" + And Customer makes "AUTOPAY" repayment on "03 January 2023" with 200 EUR transaction amount + When Admin sets the business date to "05 January 2023" + And Customer makes "AUTOPAY" repayment on "05 January 2023" with 300 EUR transaction amount + Then Loan details has the following last payment related data: + | lastPaymentAmount | lastPaymentDate | lastRepaymentAmount | lastRepaymentDate | + | 300.0 | 05 January 2023 | 300.0 | 05 January 2023 | + + @TestRailId:C2587 + Scenario: Verify last payment related fields when retrieving loan details with 2 repayments on the same day + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "03 January 2023" + And Customer makes "AUTOPAY" repayment on "03 January 2023" with 200 EUR transaction amount + And Customer makes "AUTOPAY" repayment on "03 January 2023" with 300 EUR transaction amount + Then Loan details has the following last payment related data: + | lastPaymentAmount | lastPaymentDate | lastRepaymentAmount | lastRepaymentDate | + | 300.0 | 03 January 2023 | 300.0 | 03 January 2023 | + + @TestRailId:C2588 + Scenario: Verify last payment related fields when retrieving loan details with 2 repayments on different day then the second repayment reversed + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "03 January 2023" + And Customer makes "AUTOPAY" repayment on "03 January 2023" with 200 EUR transaction amount + When Admin sets the business date to "05 January 2023" + And Customer makes "AUTOPAY" repayment on "05 January 2023" with 300 EUR transaction amount + Then Loan details has the following last payment related data: + | lastPaymentAmount | lastPaymentDate | lastRepaymentAmount | lastRepaymentDate | + | 300.0 | 05 January 2023 | 300.0 | 05 January 2023 | + When Customer undo "1"th transaction made on "05 January 2023" + Then Loan details has the following last payment related data: + | lastPaymentAmount | lastPaymentDate | lastRepaymentAmount | lastRepaymentDate | + | 200.0 | 03 January 2023 | 200.0 | 03 January 2023 | + + @TestRailId:C2589 + Scenario: Verify last payment related fields when retrieving loan details with 1 repayment and 1 goodwill credit transaction + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "03 January 2023" + And Customer makes "AUTOPAY" repayment on "03 January 2023" with 200 EUR transaction amount + When Admin sets the business date to "05 January 2023" + When Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "5 January 2023" with 400 EUR transaction amount and system-generated Idempotency key + Then Loan details has the following last payment related data: + | lastPaymentAmount | lastPaymentDate | lastRepaymentAmount | lastRepaymentDate | + | 400.0 | 05 January 2023 | 200.0 | 03 January 2023 | + + @TestRailId:C2590 + Scenario: Verify last payment related fields when retrieving loan details with 1 repayment, 1 goodwill credit transaction and 1 more repayment then the second repayment reversed + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "03 January 2023" + And Customer makes "AUTOPAY" repayment on "03 January 2023" with 200 EUR transaction amount + When Admin sets the business date to "05 January 2023" + When Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "5 January 2023" with 400 EUR transaction amount and system-generated Idempotency key + When Admin sets the business date to "07 January 2023" + And Customer makes "AUTOPAY" repayment on "07 January 2023" with 300 EUR transaction amount + Then Loan details has the following last payment related data: + | lastPaymentAmount | lastPaymentDate | lastRepaymentAmount | lastRepaymentDate | + | 300.0 | 07 January 2023 | 300.0 | 07 January 2023 | + When Customer undo "1"th transaction made on "07 January 2023" + Then Loan details has the following last payment related data: + | lastPaymentAmount | lastPaymentDate | lastRepaymentAmount | lastRepaymentDate | + | 400.0 | 05 January 2023 | 200.0 | 03 January 2023 | + + @TestRailId:C2678 + Scenario: Verify that after loan is closed loan details and event has last repayment date and amount + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + Then Loan status has changed to "Approved" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + Then Loan status has changed to "Active" + When Admin sets the business date to "02 January 2023" + And Customer makes "AUTOPAY" repayment on "02 January 2023" with 1000 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan details and event has the following last repayment related data: + | lastPaymentAmount | lastPaymentDate | lastRepaymentAmount | lastRepaymentDate | + | 1000.0 | 02 January 2023 | 1000.0 | 02 January 2023 | + + @TestRailId:C2679 + Scenario: Verify that after loan is overpaid loan details and event has last repayment date and amount + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + Then Loan status has changed to "Approved" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + Then Loan status has changed to "Active" + When Admin sets the business date to "02 January 2023" + And Customer makes "AUTOPAY" repayment on "02 January 2023" with 1100 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan details and event has the following last repayment related data: + | lastPaymentAmount | lastPaymentDate | lastRepaymentAmount | lastRepaymentDate | + | 1100.0 | 02 January 2023 | 1100.0 | 02 January 2023 | + + @TestRailId:C2687 @fraud + Scenario: Verify that closed loan can be marked as Fraud + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "15 January 2023" + And Customer makes "AUTOPAY" repayment on "15 January 2023" with 1000 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Admin can successfully set Fraud flag to the loan + + @TestRailId:C2688 @fraud + Scenario: Verify that overpaid loan can be marked as Fraud + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "15 January 2023" + And Customer makes "AUTOPAY" repayment on "15 January 2023" with 1100 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Admin can successfully set Fraud flag to the loan + + @TestRailId:C2690 + Scenario: Verify that the repayment schedule is correct when the loan has a fee and multi disbursement happens + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 May 2023", with Principal: "1000", a loanTermFrequency: 1 months, and numberOfRepayments: 1 + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + And Admin successfully disburse the loan on "1 May 2023" with "750" EUR transaction amount + Then Loan has 750 outstanding amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "1 May 2023" due date and 8 EUR transaction amount + Then Loan Repayment schedule has 1 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 May 2023 | | 750.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 June 2023 | | 0.0 | 750.0 | 0.0 | 8.0 | 0.0 | 758.0 | 0.0 | 0.0 | 0.0 | 758.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 750 | 0 | 8 | 0 | 758 | 0 | 0 | 0 | 758 | + And Admin successfully disburse the loan on "1 May 2023" with "750" EUR transaction amount + Then Loan Repayment schedule has 1 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 May 2023 | | 750.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | | | 01 May 2023 | | 750.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 June 2023 | | 0.0 | 1500.0 | 0.0 | 8.0 | 0.0 | 1508.0 | 0.0 | 0.0 | 0.0 | 1508.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1500 | 0 | 8 | 0 | 1508 | 0 | 0 | 0 | 1508 | + + @TestRailId:C2691 + Scenario: As an admin I would like to do a chargeback for Goodwill Credit + When Admin sets the business date to "8 May 2023" + 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 | + | PIN30 | 8 May 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "8 May 2023" with "1000" amount and expected disbursement date on "8 May 2023" + And Admin successfully disburse the loan on "8 May 2023" with "1000" EUR transaction amount + When Admin sets the business date to "9 May 2023" + When Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "9 May 2023" with 300 EUR transaction amount and system-generated Idempotency key + When Admin sets the business date to "10 May 2023" + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 300 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 | + | | | 08 May 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 08 June 2023 | | 667.0 | 633.0 | 0.0 | 0.0 | 0.0 | 633.0 | 300.0 | 300.0 | 0.0 | 333.0 | + | 2 | 30 | 08 July 2023 | | 334.0 | 333.0 | 0.0 | 0.0 | 0.0 | 333.0 | 0.0 | 0.0 | 0.0 | 333.0 | + | 3 | 31 | 08 August 2023 | | 0.0 | 334.0 | 0.0 | 0.0 | 0.0 | 334.0 | 0.0 | 0.0 | 0.0 | 334.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1300 | 0 | 0 | 0 | 1300 | 300 | 300 | 0 | 1000 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 08 May 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 09 May 2023 | Goodwill Credit | 300.0 | 300.0 | 0.0 | 0.0 | 0.0 | 700.0 | + | 10 May 2023 | Chargeback | 300.0 | 300.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + + @TestRailId:C2692 + Scenario: As an admin I would like to do a chargeback for Payout Refund + When Admin sets the business date to "8 May 2023" + 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 | + | PIN30 | 8 May 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "8 May 2023" with "1000" amount and expected disbursement date on "8 May 2023" + And Admin successfully disburse the loan on "8 May 2023" with "1000" EUR transaction amount + When Admin sets the business date to "9 May 2023" + When Customer makes "PAYOUT_REFUND" transaction with "AUTOPAY" payment type on "9 May 2023" with 300 EUR transaction amount and system-generated Idempotency key + When Admin sets the business date to "10 May 2023" + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 300 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 | + | | | 08 May 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 08 June 2023 | | 667.0 | 633.0 | 0.0 | 0.0 | 0.0 | 633.0 | 300.0 | 300.0 | 0.0 | 333.0 | + | 2 | 30 | 08 July 2023 | | 334.0 | 333.0 | 0.0 | 0.0 | 0.0 | 333.0 | 0.0 | 0.0 | 0.0 | 333.0 | + | 3 | 31 | 08 August 2023 | | 0.0 | 334.0 | 0.0 | 0.0 | 0.0 | 334.0 | 0.0 | 0.0 | 0.0 | 334.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1300 | 0 | 0 | 0 | 1300 | 300 | 300 | 0 | 1000 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 08 May 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 09 May 2023 | Payout Refund | 300.0 | 300.0 | 0.0 | 0.0 | 0.0 | 700.0 | + | 10 May 2023 | Chargeback | 300.0 | 300.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + + @TestRailId:C2693 + Scenario: As an admin I would like to do a chargeback for Merchant Issued Refund + When Admin sets the business date to "8 May 2023" + 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 | + | PIN30 | 8 May 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "8 May 2023" with "1000" amount and expected disbursement date on "8 May 2023" + And Admin successfully disburse the loan on "8 May 2023" with "1000" EUR transaction amount + When Admin sets the business date to "9 May 2023" + When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "9 May 2023" with 300 EUR transaction amount and system-generated Idempotency key + When Admin sets the business date to "10 May 2023" + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 300 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 | + | | | 08 May 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 08 June 2023 | | 667.0 | 633.0 | 0.0 | 0.0 | 0.0 | 633.0 | 300.0 | 300.0 | 0.0 | 333.0 | + | 2 | 30 | 08 July 2023 | | 334.0 | 333.0 | 0.0 | 0.0 | 0.0 | 333.0 | 0.0 | 0.0 | 0.0 | 333.0 | + | 3 | 31 | 08 August 2023 | | 0.0 | 334.0 | 0.0 | 0.0 | 0.0 | 334.0 | 0.0 | 0.0 | 0.0 | 334.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1300 | 0 | 0 | 0 | 1300 | 300 | 300 | 0 | 1000 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 08 May 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 09 May 2023 | Merchant Issued Refund | 300.0 | 300.0 | 0.0 | 0.0 | 0.0 | 700.0 | + | 10 May 2023 | Chargeback | 300.0 | 300.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + + @TestRailId:C2770 + Scenario: As an admin I would like to do two merchant issued refund and charge adjustment to close the loan + When Global config "charge-accrual-date" value set to "submitted-date" + When Admin sets the business date to "14 May 2023" + 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 | + | PIN30 | 14 May 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 30 | DAYS | 30 | DAYS | 1 | 0 | 0 | 0 | DUE_PENALTY_FEE_INTEREST_PRINCIPAL_IN_ADVANCE_PRINCIPAL_PENALTY_FEE_INTEREST | + And Admin successfully approves the loan on "14 May 2023" with "127.95" amount and expected disbursement date on "14 May 2023" + And Admin successfully disburse the loan on "14 May 2023" with "127.95" EUR transaction amount + When Admin sets the business date to "11 June 2023" + When Batch API call with steps: rescheduleLoan from "13 June 2023" to "13 July 2023" submitted on date: "11 June 2023", approveReschedule on date: "11 June 2023" runs with enclosingTransaction: "true" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "13 July 2023" due date and 3.65 EUR transaction amount + When Admin sets the business date to "12 June 2023" + When Admin runs inline COB job for Loan + Then Loan Repayment schedule has 1 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 | + | | | 14 May 2023 | | 127.95 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 60 | 13 July 2023 | | 0.0 | 127.95 | 0.0 | 3.65 | 0.0 | 131.6 | 0.0 | 0.0 | 0.0 | 131.6 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 127.95 | 0 | 3.65 | 0 | 131.60 | 0 | 0 | 0 | 131.60 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 14 May 2023 | Disbursement | 127.95 | 0.0 | 0.0 | 0.0 | 0.0 | 127.95 | + | 11 June 2023 | Accrual | 3.65 | 0.0 | 0.0 | 3.65 | 0.0 | 0.0 | + When Admin sets the business date to "17 June 2023" + When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "17 June 2023" with 125 EUR transaction amount and system-generated Idempotency key + Then Loan Repayment schedule has 1 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 | + | | | 14 May 2023 | | 127.95 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 60 | 13 July 2023 | | 0.0 | 127.95 | 0.0 | 3.65 | 0.0 | 131.6 | 125.0 | 125.0 | 0.0 | 6.6 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 127.95 | 0 | 3.65 | 0 | 131.6 | 125.0 | 125.0 | 0 | 6.60 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 14 May 2023 | Disbursement | 127.95 | 0.0 | 0.0 | 0.0 | 0.0 | 127.95 | + | 11 June 2023 | Accrual | 3.65 | 0.0 | 0.0 | 3.65 | 0.0 | 0.0 | + | 17 June 2023 | Merchant Issued Refund | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 2.95 | + When Admin makes a charge adjustment for the last "LOAN_SNOOZE_FEE" type charge which is due on "13 July 2023" with 3.65 EUR transaction amount and externalId "" + Then Loan Repayment schedule has 1 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 | + | | | 14 May 2023 | | 127.95 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 60 | 13 July 2023 | | 0.0 | 127.95 | 0.0 | 3.65 | 0.0 | 131.6 | 128.65 | 128.65 | 0.0 | 2.95 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 127.95 | 0 | 3.65 | 0 | 131.6 | 128.65 | 128.65 | 0 | 2.95 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 14 May 2023 | Disbursement | 127.95 | 0.0 | 0.0 | 0.0 | 0.0 | 127.95 | + | 11 June 2023 | Accrual | 3.65 | 0.0 | 0.0 | 3.65 | 0.0 | 0.0 | + | 17 June 2023 | Merchant Issued Refund | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 2.95 | + | 17 June 2023 | Charge Adjustment | 3.65 | 2.95 | 0.0 | 0.7 | 0.0 | 0.0 | + When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "17 June 2023" with 2.95 EUR transaction amount and system-generated Idempotency key + Then Loan Repayment schedule has 1 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 | + | | | 14 May 2023 | | 127.95 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 60 | 13 July 2023 | 17 June 2023 | 0.0 | 127.95 | 0.0 | 3.65 | 0.0 | 131.6 | 131.6 | 131.6 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 127.95 | 0 | 3.65 | 0 | 131.6 | 131.6 | 131.6 | 0 | 0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 14 May 2023 | Disbursement | 127.95 | 0.0 | 0.0 | 0.0 | 0.0 | 127.95 | + | 11 June 2023 | Accrual | 3.65 | 0.0 | 0.0 | 3.65 | 0.0 | 0.0 | + | 17 June 2023 | Merchant Issued Refund | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 2.95 | + | 17 June 2023 | Charge Adjustment | 3.65 | 2.95 | 0.0 | 0.7 | 0.0 | 0.0 | + | 17 June 2023 | Merchant Issued Refund | 2.95 | 0.0 | 0.0 | 2.95 | 0.0 | 0.0 | + When Global config "charge-accrual-date" value set to "due-date" + + @TestRailId:C2776 + Scenario: Verify that maturity date is updated on repayment reversal + When Admin sets the business date to "01 June 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 June 2023" + And Admin successfully approves the loan on "01 June 2023" with "1000" amount and expected disbursement date on "01 June 2023" + When Admin successfully disburse the loan on "01 June 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + Then Loan has the following maturity data: + | actualMaturityDate | expectedMaturityDate | + | 01 July 2023 | 01 July 2023 | + When Admin sets the business date to "20 June 2023" + And Customer makes "AUTOPAY" repayment on "20 June 2023" with 1000 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has the following maturity data: + | actualMaturityDate | expectedMaturityDate | + | 20 June 2023 | 01 July 2023 | + When Admin sets the business date to "20 June 2023" + When Customer undo "1"th "Repayment" transaction made on "20 June 2023" + Then Loan status will be "ACTIVE" + Then Loan has the following maturity data: + | actualMaturityDate | expectedMaturityDate | + | 01 July 2023 | 01 July 2023 | + + @TestRailId:C2777 + Scenario: As an admin I would like to delete a loan using external id + When Admin sets the business date to the actual date + And Admin creates a client with random data + When Admin creates a new Loan + Then Admin successfully deletes the loan with external id + + @TestRailId:C2778 + Scenario: As an admin I would like to verify that deleting loan using incorrect external id gives error + When Admin sets the business date to the actual date + And Admin creates a client with random data + When Admin creates a new Loan + Then Admin fails to delete the loan with incorrect external id + + @TestRailId:C2784 + Scenario: As a user I would like to do multiple repayment after reverse transactions and check the order of transactions + When Admin sets the business date to "01 November 2022" + 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 | + | PIN30 | 01 November 2022 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 30 | DAYS | 30 | DAYS | 1 | 0 | 0 | 0 | DUE_PENALTY_FEE_INTEREST_PRINCIPAL_IN_ADVANCE_PRINCIPAL_PENALTY_FEE_INTEREST | + And Admin successfully approves the loan on "01 November 2022" with "1000" amount and expected disbursement date on "01 November 2022" + When Admin successfully disburse the loan on "01 November 2022" with "1000" EUR transaction amount + Then Loan has 1000 outstanding amount + When Admin adds "LOAN_NSF_FEE" due date charge with "2 November 2022" due date and 10 EUR transaction amount + When Admin sets the business date to "02 November 2022" + And Customer makes "AUTOPAY" repayment on "02 November 2022" with 9 EUR transaction amount + And Customer makes "AUTOPAY" repayment on "02 November 2022" with 8 EUR transaction amount + And Customer makes "AUTOPAY" repayment on "02 November 2022" with 7 EUR transaction amount + Then Loan Transactions tab has a transaction with date: "02 November 2022", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Repayment | 9.0 | 0.0 | 0.0 | 0.0 | 9.0 | 1000.0 | + | Repayment | 8.0 | 7.0 | 0.0 | 0.0 | 1.0 | 993.0 | + | Repayment | 7.0 | 7.0 | 0.0 | 0.0 | 0.0 | 986.0 | + When Customer undo "1"th repayment on "02 November 2022" + Then Loan Transactions tab has a transaction with date: "02 November 2022", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Repayment | 9.0 | 0.0 | 0.0 | 0.0 | 9.0 | 1000.0 | + | Repayment | 8.0 | 0.0 | 0.0 | 0.0 | 8.0 | 1000.0 | + | Repayment | 7.0 | 5.0 | 0.0 | 0.0 | 2.0 | 993.0 | + When Customer undo "2"th repayment on "02 November 2022" + Then Loan Transactions tab has a transaction with date: "02 November 2022", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Repayment | 9.0 | 0.0 | 0.0 | 0.0 | 9.0 | 1000.0 | + | Repayment | 8.0 | 0.0 | 0.0 | 0.0 | 8.0 | 1000.0 | + | Repayment | 7.0 | 0.0 | 0.0 | 0.0 | 7.0 | 1000.0 | + + @TestRailId:C2783 + Scenario: As an admin I would like to verify that only one active repayment schedule exits for loan multiple disbursement + When Admin sets the business date to "07 July 2023" + 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 | + | PIN30 | 07 July 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 30 | DAYS | 30 | DAYS | 1 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "07 July 2023" with "1000" amount and expected disbursement date on "07 July 2023" + And Admin successfully disburse the loan on "07 July 2023" with "370.55" EUR transaction amount + When Admin sets the business date to "12 July 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "11 July 2023" due date and 5.15 EUR transaction amount + When Admin runs inline COB job for Loan + Then Loan Repayment schedule has 1 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 | + | | | 07 July 2023 | | 370.55 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 06 August 2023 | | 0.0 | 370.55 | 0.0 | 5.15 | 0.0 | 375.7 | 0.0 | 0.0 | 0.0 | 375.7 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 370.55 | 0 | 5.15 | 0 | 375.70 | 0 | 0 | 0 | 375.70 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 07 July 2023 | Disbursement | 370.55 | 0.0 | 0.0 | 0.0 | 0.0 | 370.55 | + | 11 July 2023 | Accrual | 5.15 | 0.0 | 0.0 | 5.15 | 0.0 | 0.0 | + When Admin sets the business date to "21 July 2023" + When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "21 July 2023" with 167.4 EUR transaction amount and system-generated Idempotency key + Then Loan Repayment schedule has 1 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 | + | | | 07 July 2023 | | 370.55 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 06 August 2023 | | 0.0 | 370.55 | 0.0 | 5.15 | 0.0 | 375.7 | 167.4 | 167.4 | 0.0 | 208.3 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 370.55 | 0 | 5.15 | 0 | 375.7 | 167.4 | 167.4 | 0 | 208.3 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 07 July 2023 | Disbursement | 370.55 | 0.0 | 0.0 | 0.0 | 0.0 | 370.55 | + | 11 July 2023 | Accrual | 5.15 | 0.0 | 0.0 | 5.15 | 0.0 | 0.0 | + | 21 July 2023 | Merchant Issued Refund | 167.4 | 162.25 | 0.0 | 5.15 | 0.0 | 208.3 | + When Admin runs inline COB job for Loan + When Admin sets the business date to "24 July 2023" + And Admin successfully disburse the loan on "24 July 2023" with "18" EUR transaction amount + Then Loan Repayment schedule has 1 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 | + | | | 07 July 2023 | | 370.55 | | | 0.0 | | 0.0 | 0.0 | | | | + | | | 24 July 2023 | | 18.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 06 August 2023 | | 0.0 | 388.55 | 0.0 | 5.15 | 0.0 | 393.7 | 167.4 | 167.4 | 0.0 | 226.3 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 388.55 | 0 | 5.15 | 0 | 393.7 | 167.4 | 167.4 | 0 | 226.3 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 07 July 2023 | Disbursement | 370.55 | 0.0 | 0.0 | 0.0 | 0.0 | 370.55 | + | 11 July 2023 | Accrual | 5.15 | 0.0 | 0.0 | 5.15 | 0.0 | 0.0 | + | 21 July 2023 | Merchant Issued Refund | 167.4 | 162.25 | 0.0 | 5.15 | 0.0 | 208.3 | + | 24 July 2023 | Disbursement | 18.0 | 0.0 | 0.0 | 0.0 | 0.0 | 226.3 | + + @TestRailId:C2842 @AdvancedPaymentAllocation + Scenario: As an admin I would like to verify that simple payments are working with advanced payment allocation (UC1) + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + When Admin sets the business date to "01 January 2023" + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2023 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2023" with "500" amount and expected disbursement date on "01 January 2023" + Then Loan status has changed to "Approved" + And Admin successfully disburse the loan on "01 January 2023" with "500" EUR transaction amount + Then Loan status has changed to "Active" + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 01 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2023 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 125.0 | 0 | 0 | 375.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + When Admin sets the business date to "16 January 2023" + And Customer makes "AUTOPAY" repayment on "16 January 2023" with 125 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 01 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2023 | 16 January 2023 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 250.0 | 0 | 0 | 250.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 16 January 2023 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 250.0 | + When Admin sets the business date to "31 January 2023" + And Customer makes "AUTOPAY" repayment on "31 January 2023" with 125 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 01 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2023 | 16 January 2023 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2023 | 31 January 2023 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 375.0 | 0 | 0 | 125.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 16 January 2023 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 31 January 2023 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + When Admin sets the business date to "15 February 2023" + And Customer makes "AUTOPAY" repayment on "15 February 2023" with 125 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 01 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2023 | 16 January 2023 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2023 | 31 January 2023 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2023 | 15 February 2023 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 500.0 | 0 | 0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 16 January 2023 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 31 January 2023 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 15 February 2023 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 0.0 | + Then Loan status has changed to "Closed (obligations met)" + + @TestRailId:C2843 @AdvancedPaymentAllocation + Scenario: As an admin I would like to verify that simple payments and overpayment of the installment (goes to next installment) are working with advanced payment allocation (UC2) + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + When Admin sets the business date to "01 January 2023" + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2023 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2023" with "500" amount and expected disbursement date on "01 January 2023" + Then Loan status has changed to "Approved" + And Admin successfully disburse the loan on "01 January 2023" with "500" EUR transaction amount + Then Loan status has changed to "Active" + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 01 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2023 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 125.0 | 0 | 0 | 375.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + When Admin sets the business date to "16 January 2023" + And Customer makes "AUTOPAY" repayment on "16 January 2023" with 150 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 01 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2023 | 16 January 2023 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 25.0 | 25.0 | 0.0 | 100.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 275.0 | 25.0 | 0 | 225.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 16 January 2023 | Repayment | 150.0 | 150.0 | 0.0 | 0.0 | 0.0 | 225.0 | + When Admin sets the business date to "31 January 2023" + And Customer makes "AUTOPAY" repayment on "31 January 2023" with 125 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 01 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2023 | 16 January 2023 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2023 | 31 January 2023 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 25.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 25.0 | 25.0 | 0.0 | 100.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 400.0 | 50.0 | 0 | 100.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 16 January 2023 | Repayment | 150.0 | 150.0 | 0.0 | 0.0 | 0.0 | 225.0 | + | 31 January 2023 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 100.0 | + When Admin sets the business date to "15 February 2023" + And Customer makes "AUTOPAY" repayment on "15 February 2023" with 100 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 01 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2023 | 16 January 2023 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2023 | 31 January 2023 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 25.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2023 | 15 February 2023 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 25.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 500.0 | 50.0 | 0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 16 January 2023 | Repayment | 150.0 | 150.0 | 0.0 | 0.0 | 0.0 | 225.0 | + | 31 January 2023 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 15 February 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | + Then Loan status has changed to "Closed (obligations met)" + + @TestRailId:C2844 @AdvancedPaymentAllocation + Scenario: As an admin I would like to verify that simple payments and overpayment of the installment (goes to last installment) are working with advanced payment allocation (UC3) + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + When Admin sets the business date to "01 January 2023" + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2023 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2023" with "500" amount and expected disbursement date on "01 January 2023" + Then Loan status has changed to "Approved" + And Admin successfully disburse the loan on "01 January 2023" with "500" EUR transaction amount + Then Loan status has changed to "Active" + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 01 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2023 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 125.0 | 0 | 0 | 375.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + When Admin sets the business date to "16 January 2023" + And Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "16 January 2023" with 150 EUR transaction amount and self-generated Idempotency key + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 01 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2023 | 16 January 2023 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 25.0 | 25.0 | 0.0 | 100.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 275.0 | 25.0 | 0 | 225.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 16 January 2023 | Goodwill Credit | 150.0 | 150.0 | 0.0 | 0.0 | 0.0 | 225.0 | + When Admin sets the business date to "31 January 2023" + And Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "31 January 2023" with 125 EUR transaction amount and self-generated Idempotency key + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 01 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2023 | 16 January 2023 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2023 | 31 January 2023 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 25.0 | 25.0 | 0.0 | 100.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 400.0 | 25.0 | 0 | 100.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 16 January 2023 | Goodwill Credit | 150.0 | 150.0 | 0.0 | 0.0 | 0.0 | 225.0 | + | 31 January 2023 | Goodwill Credit | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 100.0 | + When Admin sets the business date to "15 February 2023" + And Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "15 February 2023" with 100 EUR transaction amount and self-generated Idempotency key + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 01 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2023 | 16 January 2023 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2023 | 31 January 2023 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2023 | 15 February 2023 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 25.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 500.0 | 25.0 | 0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 16 January 2023 | Goodwill Credit | 150.0 | 150.0 | 0.0 | 0.0 | 0.0 | 225.0 | + | 31 January 2023 | Goodwill Credit | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 15 February 2023 | Goodwill Credit | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | + Then Loan status has changed to "Closed (obligations met)" + + @TestRailId:C2845 @AdvancedPaymentAllocation + Scenario: As an admin I would like to verify that simple payments are working after some of them failed with advanced payment allocation (UC4) + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + When Admin sets the business date to "01 January 2023" + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2023 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2023" with "500" amount and expected disbursement date on "01 January 2023" + Then Loan status has changed to "Approved" + And Admin successfully disburse the loan on "01 January 2023" with "500" EUR transaction amount + Then Loan status has changed to "Active" + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 01 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2023 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 125.0 | 0 | 0 | 375.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + When Customer undo "2"th transaction made on "01 January 2023" + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 2 | 15 | 16 January 2023 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 0.0 | 0 | 0 | 500.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | false | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | true | + When Admin sets the business date to "16 January 2023" + And Customer makes "AUTOPAY" repayment on "16 January 2023" with 125 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 16 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 125.0 | 0.0 | + | 2 | 15 | 16 January 2023 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 125.0 | 0 | 125.0 | 375.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | false | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | true | + | 16 January 2023 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | false | + When Customer undo "1"th transaction made on "16 January 2023" + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 2 | 15 | 16 January 2023 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 0.0 | 0 | 0 | 500.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | false | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | true | + | 16 January 2023 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | true | + When Admin sets the business date to "20 January 2023" + And Customer makes "AUTOPAY" repayment on "20 January 2023" with 100 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 100.0 | 0.0 | 100.0 | 25.0 | + | 2 | 15 | 16 January 2023 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 100.0 | 0 | 100.0 | 400.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | false | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | true | + | 16 January 2023 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | true | + | 20 January 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 400.0 | false | + When Admin sets the business date to "31 January 2023" + And Customer makes "AUTOPAY" repayment on "31 January 2023" with 40 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 31 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 125.0 | 0.0 | + | 2 | 15 | 16 January 2023 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 15.0 | 0.0 | 15.0 | 110.0 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 140.0 | 0 | 140.0 | 360.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | false | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | true | + | 16 January 2023 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | true | + | 20 January 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 400.0 | false | + | 31 January 2023 | Repayment | 40.0 | 40.0 | 0.0 | 0.0 | 0.0 | 360.0 | false | + When Admin sets the business date to "15 February 2023" + And Customer makes "AUTOPAY" repayment on "15 February 2023" with 360 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 31 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 125.0 | 0.0 | + | 2 | 15 | 16 January 2023 | 15 February 2023 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 125.0 | 0.0 | + | 3 | 15 | 31 January 2023 | 15 February 2023 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 125.0 | 0.0 | + | 4 | 15 | 15 February 2023 | 15 February 2023 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 500.0 | 0 | 375.0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | false | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | true | + | 16 January 2023 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | true | + | 20 January 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 400.0 | false | + | 31 January 2023 | Repayment | 40.0 | 40.0 | 0.0 | 0.0 | 0.0 | 360.0 | false | + | 15 February 2023 | Repayment | 360.0 | 360.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | + Then Loan status has changed to "Closed (obligations met)" + + @TestRailId:C2846 @AdvancedPaymentAllocation + Scenario: As an admin I would like to verify that Merchant issued refund with reamortization works with advanced payment allocation (UC05) + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + When Admin sets the business date to "01 January 2023" + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2023 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2023" with "500" amount and expected disbursement date on "01 January 2023" + Then Loan status has changed to "Approved" + And Admin successfully disburse the loan on "01 January 2023" with "500" EUR transaction amount + Then Loan status has changed to "Active" + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 01 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2023 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 125.0 | 0 | 0 | 375.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + When Customer undo "2"th transaction made on "01 January 2023" + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 2 | 15 | 16 January 2023 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 0.0 | 0 | 0 | 500.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | false | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | true | + When Admin sets the business date to "08 January 2023" + When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "08 January 2023" with 300 EUR transaction amount and self-generated Idempotency key + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 08 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 125.0 | 0.0 | + | 2 | 15 | 16 January 2023 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 58.33 | 58.33 | 0.0 | 66.67 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 58.33 | 58.33 | 0.0 | 66.67 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 58.34 | 58.34 | 0.0 | 66.66 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 300.0 | 175.0 | 125.0 | 200.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | false | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | true | + | 08 January 2023 | Merchant Issued Refund | 300.0 | 300.0 | 0.0 | 0.0 | 0.0 | 200.0 | false | + When Admin sets the business date to "16 January 2023" + And Customer makes "AUTOPAY" repayment on "16 January 2023" with 201 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 08 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 125.0 | 0.0 | + | 2 | 15 | 16 January 2023 | 16 January 2023 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 58.33 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2023 | 16 January 2023 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 125.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2023 | 16 January 2023 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 125.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 500.0 | 308.33 | 125.0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Overpayment | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | false | 0.0 | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | true | 0.0 | + | 08 January 2023 | Merchant Issued Refund | 300.0 | 300.0 | 0.0 | 0.0 | 0.0 | 200.0 | false | 0.0 | + | 16 January 2023 | Repayment | 201.0 | 200.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | 1.0 | + Then Loan status has changed to "Overpaid" + + @TestRailId:C2847 @AdvancedPaymentAllocation + Scenario: As an admin I would like to verify that Merchant issued refund with reamortization on due date works with advanced payment allocation (UC07) + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + When Admin sets the business date to "01 January 2023" + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2023 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2023" with "500" amount and expected disbursement date on "01 January 2023" + Then Loan status has changed to "Approved" + And Admin successfully disburse the loan on "01 January 2023" with "500" EUR transaction amount + Then Loan status has changed to "Active" + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 01 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2023 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 125.0 | 0 | 0 | 375.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + When Admin sets the business date to "16 January 2023" + And Customer makes "AUTOPAY" repayment on "16 January 2023" with 125 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 01 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2023 | 16 January 2023 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 250.0 | 0.0 | 0.0 | 250.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 16 January 2023 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 250.0 | + When Admin sets the business date to "16 January 2023" + When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "16 January 2023" with 200 EUR transaction amount and self-generated Idempotency key + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 01 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2023 | 16 January 2023 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 100.0 | 100.0 | 0.0 | 25.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 100.0 | 100.0 | 0.0 | 25.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 450.0 | 200.0 | 0.0 | 50.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 16 January 2023 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 16 January 2023 | Merchant Issued Refund | 200.0 | 200.0 | 0.0 | 0.0 | 0.0 | 50.0 | + When Admin sets the business date to "31 January 2023" + And Customer makes "AUTOPAY" repayment on "31 January 2023" with 25 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 01 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2023 | 16 January 2023 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2023 | 31 January 2023 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 100.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 100.0 | 100.0 | 0.0 | 25.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 475.0 | 200.0 | 0.0 | 25.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 16 January 2023 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 16 January 2023 | Merchant Issued Refund | 200.0 | 200.0 | 0.0 | 0.0 | 0.0 | 50.0 | + | 31 January 2023 | Repayment | 25.0 | 25.0 | 0.0 | 0.0 | 0.0 | 25.0 | + When Admin sets the business date to "15 February 2023" + And Customer makes "AUTOPAY" repayment on "15 February 2023" with 25 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 01 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2023 | 16 January 2023 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2023 | 31 January 2023 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 100.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2023 | 15 February 2023 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 100.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 500.0 | 200.0 | 0.0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 16 January 2023 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 16 January 2023 | Merchant Issued Refund | 200.0 | 200.0 | 0.0 | 0.0 | 0.0 | 50.0 | + | 31 January 2023 | Repayment | 25.0 | 25.0 | 0.0 | 0.0 | 0.0 | 25.0 | + | 15 February 2023 | Repayment | 25.0 | 25.0 | 0.0 | 0.0 | 0.0 | 0.0 | + Then Loan status has changed to "Closed (obligations met)" + + @TestRailId:C2848 @AdvancedPaymentAllocation + Scenario: As an admin I would like to verify that Merchant issued refund with reamortization past due date works with advanced payment allocation (UC08) + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + When Admin sets the business date to "01 January 2023" + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2023 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2023" with "500" amount and expected disbursement date on "01 January 2023" + Then Loan status has changed to "Approved" + And Admin successfully disburse the loan on "01 January 2023" with "500" EUR transaction amount + Then Loan status has changed to "Active" + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 01 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2023 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 125.0 | 0 | 0 | 375.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + When Customer undo "2"th transaction made on "01 January 2023" + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 2 | 15 | 16 January 2023 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 0.0 | 0 | 0 | 500.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | false | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | true | + When Admin sets the business date to "16 January 2023" + And Customer makes "AUTOPAY" repayment on "16 January 2023" with 125 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 16 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 125.0 | 0.0 | + | 2 | 15 | 16 January 2023 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 125.0 | 0 | 125.0 | 375.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | false | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | true | + | 16 January 2023 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | false | + When Customer undo "1"th transaction made on "16 January 2023" + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 2 | 15 | 16 January 2023 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 0.0 | 0 | 0 | 500.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | false | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | true | + | 16 January 2023 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | true | + When Admin sets the business date to "17 January 2023" + When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "17 January 2023" with 300 EUR transaction amount and self-generated Idempotency key + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 17 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 125.0 | 0.0 | + | 2 | 15 | 16 January 2023 | 17 January 2023 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 125.0 | 0.0 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 25.0 | 25.0 | 0.0 | 100.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 25.0 | 25.0 | 0.0 | 100.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 300.0 | 50.0 | 250.0 | 200.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | false | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | true | + | 16 January 2023 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | true | + | 17 January 2023 | Merchant Issued Refund | 300.0 | 300.0 | 0.0 | 0.0 | 0.0 | 200.0 | false | + When Admin sets the business date to "31 January 2023" + And Customer makes "AUTOPAY" repayment on "31 January 2023" with 100 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 17 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 125.0 | 0.0 | + | 2 | 15 | 16 January 2023 | 17 January 2023 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 125.0 | 0.0 | + | 3 | 15 | 31 January 2023 | 31 January 2023 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 25.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 25.0 | 25.0 | 0.0 | 100.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 400.0 | 50.0 | 250.0 | 100.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | false | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | true | + | 16 January 2023 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | true | + | 17 January 2023 | Merchant Issued Refund | 300.0 | 300.0 | 0.0 | 0.0 | 0.0 | 200.0 | false | + | 31 January 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | + When Admin sets the business date to "15 February 2023" + And Customer makes "AUTOPAY" repayment on "15 February 2023" with 100 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 17 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 125.0 | 0.0 | + | 2 | 15 | 16 January 2023 | 17 January 2023 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 125.0 | 0.0 | + | 3 | 15 | 31 January 2023 | 31 January 2023 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 25.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2023 | 15 February 2023 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 25.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 500.0 | 50.0 | 250.0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | false | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | true | + | 16 January 2023 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | true | + | 17 January 2023 | Merchant Issued Refund | 300.0 | 300.0 | 0.0 | 0.0 | 0.0 | 200.0 | false | + | 31 January 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | + | 15 February 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | + Then Loan status has changed to "Closed (obligations met)" + + @TestRailId:C2849 @AdvancedPaymentAllocation + Scenario: As an admin I would like to verify that full refund with CBR (UC17) + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + When Admin sets the business date to "01 January 2023" + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2023 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2023" with "500" amount and expected disbursement date on "01 January 2023" + Then Loan status has changed to "Approved" + And Admin successfully disburse the loan on "01 January 2023" with "500" EUR transaction amount + Then Loan status has changed to "Active" + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 01 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2023 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 125.0 | 0 | 0 | 375.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + When Admin sets the business date to "08 January 2023" + When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "08 January 2023" with 500 EUR transaction amount and self-generated Idempotency key + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 01 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2023 | 08 January 2023 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 125.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2023 | 08 January 2023 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 125.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2023 | 08 January 2023 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 125.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 500.0 | 375.0 | 0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Overpayment | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | 0.0 | + | 08 January 2023 | Merchant Issued Refund | 500.0 | 375.0 | 0.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan status has changed to "Overpaid" + When Admin sets the business date to "09 January 2023" + When Admin makes Credit Balance Refund transaction on "09 January 2023" with 125 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 01 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2023 | 08 January 2023 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 125.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2023 | 08 January 2023 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 125.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2023 | 08 January 2023 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 125.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 500.0 | 375.0 | 0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 08 January 2023 | Merchant Issued Refund | 500.0 | 375.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 09 January 2023 | Credit Balance Refund | 125.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + Then Loan status has changed to "Closed (obligations met)" + + @TestRailId:C2850 @AdvancedPaymentAllocation + Scenario: As an admin I would like to verify that reverse-replay works with advanced payment allocation(UC24) + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + When Admin sets the business date to "01 January 2023" + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2023 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2023" with "500" amount and expected disbursement date on "01 January 2023" + Then Loan status has changed to "Approved" + And Admin successfully disburse the loan on "01 January 2023" with "500" EUR transaction amount + Then Loan status has changed to "Active" + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 01 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2023 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 125.0 | 0 | 0 | 375.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + When Customer undo "2"th transaction made on "01 January 2023" + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 2 | 15 | 16 January 2023 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 0.0 | 0 | 0 | 500.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | false | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | true | + When Admin sets the business date to "02 January 2023" + When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "02 January 2023" with 400 EUR transaction amount and self-generated Idempotency key + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 02 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 125.0 | 0.0 | + | 2 | 15 | 16 January 2023 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 91.67 | 91.67 | 0.0 | 33.33 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 91.67 | 91.67 | 0.0 | 33.33 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 91.66 | 91.66 | 0.0 | 33.34 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 400.0 | 275.0 | 125.0 | 100.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 02 January 2023 | Merchant Issued Refund | 400.0 | 400.0 | 0.0 | 0.0 | 0.0 | 100.0 | + When Admin sets the business date to "04 January 2023" + And Customer makes "AUTOPAY" repayment on "04 January 2023" with 50 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 02 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 125.0 | 0.0 | + | 2 | 15 | 16 January 2023 | 04 January 2023 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 125.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 108.34 | 108.34 | 0.0 | 16.66 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 91.66 | 91.66 | 0.0 | 33.34 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 450.0 | 325.0 | 125.0 | 50.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 02 January 2023 | Merchant Issued Refund | 400.0 | 400.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 04 January 2023 | Repayment | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | + When Admin sets the business date to "16 January 2023" + And Customer makes "AUTOPAY" repayment on "16 January 2023" with 125 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 02 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 125.0 | 0.0 | + | 2 | 15 | 16 January 2023 | 04 January 2023 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 125.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2023 | 16 January 2023 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 125.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2023 | 16 January 2023 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 125.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 500.0 | 375.0 | 125.0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Overpayment | Reverted | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | false | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | 0.0 | true | + | 02 January 2023 | Merchant Issued Refund | 400.0 | 400.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | false | + | 04 January 2023 | Repayment | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | false | + | 16 January 2023 | Repayment | 125.0 | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 75.0 | false | + Then Loan status has changed to "Overpaid" + When Admin sets the business date to "18 January 2023" + When Admin makes Credit Balance Refund transaction on "18 January 2023" with 75 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 02 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 125.0 | 0.0 | + | 2 | 15 | 16 January 2023 | 04 January 2023 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 125.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2023 | 16 January 2023 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 125.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2023 | 16 January 2023 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 125.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 500.0 | 375.0 | 125.0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Overpayment | Reverted | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | false | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | 0.0 | true | + | 02 January 2023 | Merchant Issued Refund | 400.0 | 400.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | false | + | 04 January 2023 | Repayment | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | false | + | 16 January 2023 | Repayment | 125.0 | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 75.0 | false | + | 18 January 2023 | Credit Balance Refund | 75.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 75.0 | false | + Then Loan status has changed to "Closed (obligations met)" + When Admin sets the business date to "20 January 2023" + When Customer undo "1"th transaction made on "02 January 2023" + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 16 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 125.0 | 0.0 | + | 2 | 15 | 16 January 2023 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 50.0 | 0.0 | 0.0 | 75.0 | + | 3 | 15 | 31 January 2023 | | 125.0 | 200.0 | 0.0 | 0.0 | 0.0 | 200.0 | 0.0 | 0.0 | 0.0 | 200.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 575.0 | 0 | 0.0 | 0 | 575.0 | 175.0 | 0.0 | 125.0 | 400.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Overpayment | Reverted | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | false | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | 0.0 | true | + | 02 January 2023 | Merchant Issued Refund | 400.0 | 400.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | true | + | 04 January 2023 | Repayment | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 450.0 | 0.0 | false | + | 16 January 2023 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 325.0 | 0.0 | false | + | 18 January 2023 | Credit Balance Refund | 75.0 | 75.0 | 0.0 | 0.0 | 0.0 | 400.0 | 0.0 | false | + Then Loan status has changed to "Active" + When Admin sets the business date to "31 January 2023" + And Customer makes "AUTOPAY" repayment on "31 January 2023" with 275 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 16 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 125.0 | 0.0 | + | 2 | 15 | 16 January 2023 | 31 January 2023 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 75.0 | 0.0 | + | 3 | 15 | 31 January 2023 | 31 January 2023 | 125.0 | 200.0 | 0.0 | 0.0 | 0.0 | 200.0 | 200.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 575.0 | 0 | 0.0 | 0 | 575.0 | 450.0 | 0.0 | 200.0 | 125.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Overpayment | Reverted | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | false | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | 0.0 | true | + | 02 January 2023 | Merchant Issued Refund | 400.0 | 400.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | true | + | 04 January 2023 | Repayment | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 450.0 | 0.0 | false | + | 16 January 2023 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 325.0 | 0.0 | false | + | 18 January 2023 | Credit Balance Refund | 75.0 | 75.0 | 0.0 | 0.0 | 0.0 | 400.0 | 0.0 | false | + | 31 January 2023 | Repayment | 275.0 | 275.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | false | + When Admin sets the business date to "15 February 2023" + And Customer makes "AUTOPAY" repayment on "15 February 2023" with 125 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 16 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 125.0 | 0.0 | + | 2 | 15 | 16 January 2023 | 31 January 2023 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 75.0 | 0.0 | + | 3 | 15 | 31 January 2023 | 31 January 2023 | 125.0 | 200.0 | 0.0 | 0.0 | 0.0 | 200.0 | 200.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2023 | 15 February 2023 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 575.0 | 0 | 0.0 | 0 | 575.0 | 575.0 | 0.0 | 200.0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Overpayment | Reverted | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | false | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | 0.0 | true | + | 02 January 2023 | Merchant Issued Refund | 400.0 | 400.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | true | + | 04 January 2023 | Repayment | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 450.0 | 0.0 | false | + | 16 January 2023 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 325.0 | 0.0 | false | + | 18 January 2023 | Credit Balance Refund | 75.0 | 75.0 | 0.0 | 0.0 | 0.0 | 400.0 | 0.0 | false | + | 31 January 2023 | Repayment | 275.0 | 275.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | false | + | 15 February 2023 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | + Then Loan status has changed to "Closed (obligations met)" + + @TestRailId:C2851 @AdvancedPaymentAllocation + Scenario: As an admin I would like to verify that reamortization works with uneven balances with advanced payment allocation(UC25) + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + When Admin sets the business date to "01 January 2023" + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2023 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2023" with "500" amount and expected disbursement date on "01 January 2023" + Then Loan status has changed to "Approved" + And Admin successfully disburse the loan on "01 January 2023" with "500" EUR transaction amount + Then Loan status has changed to "Active" + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 01 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2023 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 125.0 | 0 | 0 | 375.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + When Customer undo "2"th transaction made on "01 January 2023" + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 2 | 15 | 16 January 2023 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 0.0 | 0 | 0 | 500.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | false | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | true | + When Admin sets the business date to "02 January 2023" + When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "02 January 2023" with 400 EUR transaction amount and self-generated Idempotency key + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 02 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 125.0 | 0.0 | + | 2 | 15 | 16 January 2023 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 91.67 | 91.67 | 0.0 | 33.33 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 91.67 | 91.67 | 0.0 | 33.33 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 91.66 | 91.66 | 0.0 | 33.34 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 400.0 | 275.0 | 125.0 | 100.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | false | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | true | + | 02 January 2023 | Merchant Issued Refund | 400.0 | 400.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | + When Admin sets the business date to "04 January 2023" + And Customer makes "AUTOPAY" repayment on "04 January 2023" with 50 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 02 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 125.0 | 0.0 | + | 2 | 15 | 16 January 2023 | 04 January 2023 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 125.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 108.34 | 108.34 | 0.0 | 16.66 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 91.66 | 91.66 | 0.0 | 33.34 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 450.0 | 325.0 | 125.0 | 50.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | false | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | true | + | 02 January 2023 | Merchant Issued Refund | 400.0 | 400.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | + | 04 January 2023 | Repayment | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | false | + When Admin sets the business date to "06 January 2023" + When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "06 January 2023" with 40 EUR transaction amount and self-generated Idempotency key + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 02 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 125.0 | 0.0 | + | 2 | 15 | 16 January 2023 | 04 January 2023 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 125.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2023 | 06 January 2023 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 125.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 115.0 | 115.0 | 0.0 | 10.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 490.0 | 365.0 | 125.0 | 10.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | false | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | true | + | 02 January 2023 | Merchant Issued Refund | 400.0 | 400.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | + | 04 January 2023 | Repayment | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | false | + | 06 January 2023 | Merchant Issued Refund | 40.0 | 40.0 | 0.0 | 0.0 | 0.0 | 10.0 | false | + + @TestRailId:C2860 @AdvancedPaymentAllocation + Scenario: Verify advanced payment allocation - future installments: NEXT_INSTALLMENT + When Admin sets the business date to "01 September 2023" + And Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 September 2023 | 400 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "400" amount and expected disbursement date on "01 September 2023" + And Admin successfully disburse the loan on "01 September 2023" with "400" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 300.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | | 200.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 3 | 15 | 01 October 2023 | | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 400.0 | 0 | 0.0 | 0 | 400.0 | 100.0 | 0.0 | 0.0 | 300.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 01 September 2023 | Down Payment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 300.0 | + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 150 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 300.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 200.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 50.0 | 50.0 | 0.0 | 50.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 400.0 | 0 | 0.0 | 0 | 400.0 | 250.0 | 50.0 | 0.0 | 150.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 01 September 2023 | Down Payment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 16 September 2023 | Repayment | 150.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + + @TestRailId:C2861 @AdvancedPaymentAllocation + Scenario: Verify advanced payment allocation - future installments: LAST_INSTALLMENT, payment on due date + When Admin sets the business date to "01 September 2023" + And Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "LAST_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 September 2023 | 400 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "400" amount and expected disbursement date on "01 September 2023" + And Admin successfully disburse the loan on "01 September 2023" with "400" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 300.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | | 200.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 3 | 15 | 01 October 2023 | | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 400.0 | 0 | 0.0 | 0 | 400.0 | 100.0 | 0.0 | 0.0 | 300.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 01 September 2023 | Down Payment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 300.0 | + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 150 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 300.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 200.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 50.0 | 50.0 | 0.0 | 50.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 400.0 | 0 | 0.0 | 0 | 400.0 | 250.0 | 50.0 | 0.0 | 150.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 01 September 2023 | Down Payment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 16 September 2023 | Repayment | 150.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + + @TestRailId:C2862 @AdvancedPaymentAllocation + Scenario: Verify advanced payment allocation - future installments: LAST_INSTALLMENT, payment before due date + When Admin sets the business date to "01 September 2023" + And Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "LAST_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 September 2023 | 400 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "400" amount and expected disbursement date on "01 September 2023" + And Admin successfully disburse the loan on "01 September 2023" with "400" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 300.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | | 200.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 3 | 15 | 01 October 2023 | | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 400.0 | 0 | 0.0 | 0 | 400.0 | 100.0 | 0.0 | 0.0 | 300.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 01 September 2023 | Down Payment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 300.0 | + When Admin sets the business date to "10 September 2023" + And Customer makes "AUTOPAY" repayment on "10 September 2023" with 150 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 300.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | | 200.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 3 | 15 | 01 October 2023 | | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 50.0 | 50.0 | 0.0 | 50.0 | + | 4 | 15 | 16 October 2023 | 10 September 2023 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 100.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 400.0 | 0 | 0.0 | 0 | 400.0 | 250.0 | 150.0 | 0.0 | 150.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 01 September 2023 | Down Payment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 10 September 2023 | Repayment | 150.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + + @TestRailId:C2863 @AdvancedPaymentAllocation + Scenario: Verify advanced payment allocation - future installments: REAMORTIZATION, payment on due date + When Admin sets the business date to "01 September 2023" + And Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "REAMORTIZATION" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 September 2023 | 400 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "400" amount and expected disbursement date on "01 September 2023" + And Admin successfully disburse the loan on "01 September 2023" with "400" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 300.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | | 200.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 3 | 15 | 01 October 2023 | | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 400.0 | 0 | 0.0 | 0 | 400.0 | 100.0 | 0.0 | 0.0 | 300.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 01 September 2023 | Down Payment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 300.0 | + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 150 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 300.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 200.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 25.0 | 25.0 | 0.0 | 75.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 25.0 | 25.0 | 0.0 | 75.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 400.0 | 0 | 0.0 | 0 | 400.0 | 250.0 | 50.0 | 0.0 | 150.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 01 September 2023 | Down Payment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 16 September 2023 | Repayment | 150.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + + @TestRailId:C2864 @AdvancedPaymentAllocation + Scenario: Verify advanced payment allocation - future installments: REAMORTIZATION, payment before due date + When Admin sets the business date to "01 September 2023" + And Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "REAMORTIZATION" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 September 2023 | 400 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "400" amount and expected disbursement date on "01 September 2023" + And Admin successfully disburse the loan on "01 September 2023" with "400" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 300.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | | 200.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 3 | 15 | 01 October 2023 | | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 400.0 | 0 | 0.0 | 0 | 400.0 | 100.0 | 0.0 | 0.0 | 300.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 01 September 2023 | Down Payment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 300.0 | + When Admin sets the business date to "10 September 2023" + And Customer makes "AUTOPAY" repayment on "10 September 2023" with 150 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 300.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | | 200.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 50.0 | 50.0 | 0.0 | 50.0 | + | 3 | 15 | 01 October 2023 | | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 50.0 | 50.0 | 0.0 | 50.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 50.0 | 50.0 | 0.0 | 50.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 400.0 | 0 | 0.0 | 0 | 400.0 | 250.0 | 150.0 | 0.0 | 150.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 01 September 2023 | Down Payment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 10 September 2023 | Repayment | 150.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + + @TestRailId:C2865 @AdvancedPaymentAllocation + Scenario: Verify advanced payment allocation - future installments: REAMORTIZATION, partial payment due date, payment before next due date + When Admin sets the business date to "01 September 2023" + And Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "REAMORTIZATION" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 September 2023 | 400 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "400" amount and expected disbursement date on "01 September 2023" + And Admin successfully disburse the loan on "01 September 2023" with "400" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 300.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | | 200.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 3 | 15 | 01 October 2023 | | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 400.0 | 0 | 0.0 | 0 | 400.0 | 100.0 | 0.0 | 0.0 | 300.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 01 September 2023 | Down Payment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 300.0 | + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 80 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 300.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | | 200.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 80.0 | 0.0 | 0.0 | 20.0 | + | 3 | 15 | 01 October 2023 | | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 400.0 | 0 | 0.0 | 0 | 400.0 | 180.0 | 0.0 | 0.0 | 220.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 01 September 2023 | Down Payment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 16 September 2023 | Repayment | 80.0 | 80.0 | 0.0 | 0.0 | 0.0 | 220.0 | + When Admin sets the business date to "20 September 2023" + And Customer makes "AUTOPAY" repayment on "20 September 2023" with 180 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 300.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 20 September 2023 | 200.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 20.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 80.0 | 80.0 | 0.0 | 20.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 80.0 | 80.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 400.0 | 0 | 0.0 | 0 | 400.0 | 360.0 | 160.0 | 20.0 | 40.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 01 September 2023 | Down Payment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 16 September 2023 | Repayment | 80.0 | 80.0 | 0.0 | 0.0 | 0.0 | 220.0 | + | 20 September 2023 | Repayment | 180.0 | 180.0 | 0.0 | 0.0 | 0.0 | 40.0 | + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + + @TestRailId:C2897 @AdvancedPaymentAllocation + Scenario: Verify advanced payment allocation - future installments: LAST_INSTALLMENT, payment after due date + When Admin sets the business date to "01 September 2023" + And Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "LAST_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 September 2023 | 400 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "400" amount and expected disbursement date on "01 September 2023" + And Admin successfully disburse the loan on "01 September 2023" with "400" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 300.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | | 200.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 3 | 15 | 01 October 2023 | | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 400.0 | 0 | 0.0 | 0 | 400.0 | 100.0 | 0.0 | 0.0 | 300.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 01 September 2023 | Down Payment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 300.0 | + When Admin sets the business date to "20 September 2023" + And Customer makes "AUTOPAY" repayment on "20 September 2023" with 150 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 300.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 20 September 2023 | 200.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 100.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 50.0 | 50.0 | 0.0 | 50.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 400.0 | 0 | 0.0 | 0 | 400.0 | 250.0 | 50.0 | 100.0 | 150.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 01 September 2023 | Down Payment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 20 September 2023 | Repayment | 150.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + + @TestRailId:C2922 + @ProgressiveLoanSchedule + @AdvancedPaymentAllocation + Scenario: Verify advanced payment allocation with progressive loan schedule with multi disbursement and with overpaid installment + When Admin sets the business date to "01 May 2023" + And Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 May 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 60 | DAYS | 15 | DAYS | 4 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 May 2023" with "1000" amount and expected disbursement date on "01 May 2023" + And Admin successfully disburse the loan on "01 May 2023" with "1000" EUR transaction amount + Then Loan Repayment schedule has 5 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 May 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 May 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 May 2023 | | 562.5 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | + | 3 | 15 | 31 May 2023 | | 375.0 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | + | 4 | 15 | 15 June 2023 | | 187.5 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | + | 5 | 15 | 30 June 2023 | | 0.0 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0.0 | 0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 May 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + When Admin sets the business date to "06 May 2023" + And Customer makes "AUTOPAY" repayment on "06 May 2023" with 650 EUR transaction amount + Then Loan Repayment schedule has 5 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 May 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 May 2023 | 06 May 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | 2 | 15 | 16 May 2023 | 06 May 2023 | 562.5 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | 187.5 | 187.5 | 0.0 | 0.0 | + | 3 | 15 | 31 May 2023 | 06 May 2023 | 375.0 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | 187.5 | 187.5 | 0.0 | 0.0 | + | 4 | 15 | 15 June 2023 | | 187.5 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | 25.0 | 25.0 | 0.0 | 162.5 | + | 5 | 15 | 30 June 2023 | | 0.0 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0.0 | 0 | 1000.0 | 650.0 | 400.0 | 250.0 | 350.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 May 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 06 May 2023 | Repayment | 650.0 | 650.0 | 0.0 | 0.0 | 0.0 | 350.0 | + When Admin sets the business date to "25 May 2023" + And Admin successfully disburse the loan on "25 May 2023" with "250" 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 | + | | | 01 May 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 May 2023 | 06 May 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | 2 | 15 | 16 May 2023 | 06 May 2023 | 562.5 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | 187.5 | 187.5 | 0.0 | 0.0 | + | | | 25 May 2023 | | 250.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 3 | 0 | 25 May 2023 | | 750.0 | 62.5 | 0.0 | 0.0 | 0.0 | 62.5 | 0.0 | 0.0 | 0.0 | 62.5 | + | 4 | 15 | 31 May 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 187.5 | 187.5 | 0.0 | 62.5 | + | 5 | 15 | 15 June 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 25.0 | 25.0 | 0.0 | 225.0 | + | 6 | 15 | 30 June 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1250.0 | 0 | 0.0 | 0 | 1250.0 | 650.0 | 400.0 | 250.0 | 600.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 May 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 06 May 2023 | Repayment | 650.0 | 650.0 | 0.0 | 0.0 | 0.0 | 350.0 | + | 25 May 2023 | Disbursement | 250.0 | 0.0 | 0.0 | 0.0 | 0.0 | 600.0 | + When Admin sets the business date to "12 June 2023" + And Admin successfully disburse the loan on "12 June 2023" with "250" EUR transaction amount + Then Loan Repayment schedule has 7 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 May 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 May 2023 | 06 May 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | 2 | 15 | 16 May 2023 | 06 May 2023 | 562.5 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | 187.5 | 187.5 | 0.0 | 0.0 | + | | | 25 May 2023 | | 250.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 3 | 0 | 25 May 2023 | | 750.0 | 62.5 | 0.0 | 0.0 | 0.0 | 62.5 | 0.0 | 0.0 | 0.0 | 62.5 | + | 4 | 15 | 31 May 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 187.5 | 187.5 | 0.0 | 62.5 | + | | | 12 June 2023 | | 250.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 5 | 0 | 12 June 2023 | | 687.5 | 62.5 | 0.0 | 0.0 | 0.0 | 62.5 | 0.0 | 0.0 | 0.0 | 62.5 | + | 6 | 15 | 15 June 2023 | | 343.75 | 343.75 | 0.0 | 0.0 | 0.0 | 343.75 | 25.0 | 25.0 | 0.0 | 318.75 | + | 7 | 15 | 30 June 2023 | | 0.0 | 343.75 | 0.0 | 0.0 | 0.0 | 343.75 | 0.0 | 0.0 | 0.0 | 343.75 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1500.0 | 0 | 0.0 | 0 | 1500.0 | 650.0 | 400.0 | 250.0 | 850.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 May 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 06 May 2023 | Repayment | 650.0 | 650.0 | 0.0 | 0.0 | 0.0 | 350.0 | + | 25 May 2023 | Disbursement | 250.0 | 0.0 | 0.0 | 0.0 | 0.0 | 600.0 | + | 12 June 2023 | Disbursement | 250.0 | 0.0 | 0.0 | 0.0 | 0.0 | 850.0 | + When Admin set "PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + + @TestRailId:C2937 + @ProgressiveLoanSchedule + @AdvancedPaymentAllocation + Scenario: Verify advanced payment allocation with progressive loan schedule with multi disbursement and reschedule + When Admin sets the business date to "01 May 2023" + And Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 May 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 60 | DAYS | 15 | DAYS | 4 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 May 2023" with "1000" amount and expected disbursement date on "01 May 2023" + And Admin successfully disburse the loan on "01 May 2023" with "1000" EUR transaction amount + Then Loan Repayment schedule has 5 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 May 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 May 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 May 2023 | | 562.5 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | + | 3 | 15 | 31 May 2023 | | 375.0 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | + | 4 | 15 | 15 June 2023 | | 187.5 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | + | 5 | 15 | 30 June 2023 | | 0.0 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0.0 | 0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 May 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + When Admin sets the business date to "06 May 2023" + And Customer makes "AUTOPAY" repayment on "06 May 2023" with 650 EUR transaction amount + Then Loan Repayment schedule has 5 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 May 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 May 2023 | 06 May 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | 2 | 15 | 16 May 2023 | 06 May 2023 | 562.5 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | 187.5 | 187.5 | 0.0 | 0.0 | + | 3 | 15 | 31 May 2023 | 06 May 2023 | 375.0 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | 187.5 | 187.5 | 0.0 | 0.0 | + | 4 | 15 | 15 June 2023 | | 187.5 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | 25.0 | 25.0 | 0.0 | 162.5 | + | 5 | 15 | 30 June 2023 | | 0.0 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0.0 | 0 | 1000.0 | 650.0 | 400.0 | 250.0 | 350.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 May 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 06 May 2023 | Repayment | 650.0 | 650.0 | 0.0 | 0.0 | 0.0 | 350.0 | + When Admin sets the business date to "25 May 2023" + When Batch API call with steps: rescheduleLoan from "15 June 2023" to "13 July 2023" submitted on date: "25 May 2023", approveReschedule on date: "25 May 2023" runs with enclosingTransaction: "true" + And Admin successfully disburse the loan on "25 May 2023" with "250" 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 | + | | | 01 May 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 May 2023 | 06 May 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | 2 | 15 | 16 May 2023 | 06 May 2023 | 562.5 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | 187.5 | 187.5 | 0.0 | 0.0 | + | | | 25 May 2023 | | 250.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 3 | 0 | 25 May 2023 | | 750.0 | 62.5 | 0.0 | 0.0 | 0.0 | 62.5 | 0.0 | 0.0 | 0.0 | 62.5 | + | 4 | 15 | 31 May 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 187.5 | 187.5 | 0.0 | 62.5 | + | 5 | 43 | 13 July 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 25.0 | 25.0 | 0.0 | 225.0 | + | 6 | 15 | 28 July 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1250.0 | 0 | 0.0 | 0 | 1250.0 | 650.0 | 400.0 | 250.0 | 600.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 May 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 06 May 2023 | Repayment | 650.0 | 650.0 | 0.0 | 0.0 | 0.0 | 350.0 | + | 25 May 2023 | Disbursement | 250.0 | 0.0 | 0.0 | 0.0 | 0.0 | 600.0 | + When Admin sets the business date to "15 July 2023" + And Admin successfully disburse the loan on "15 July 2023" with "250" EUR transaction amount + Then Loan Repayment schedule has 7 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 May 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 May 2023 | 06 May 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | 2 | 15 | 16 May 2023 | 06 May 2023 | 562.5 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | 187.5 | 187.5 | 0.0 | 0.0 | + | | | 25 May 2023 | | 250.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 3 | 0 | 25 May 2023 | | 750.0 | 62.5 | 0.0 | 0.0 | 0.0 | 62.5 | 0.0 | 0.0 | 0.0 | 62.5 | + | 4 | 15 | 31 May 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 187.5 | 187.5 | 0.0 | 62.5 | + | 5 | 43 | 13 July 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 25.0 | 25.0 | 0.0 | 225.0 | + | | | 15 July 2023 | | 250.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 6 | 0 | 15 July 2023 | | 437.5 | 62.5 | 0.0 | 0.0 | 0.0 | 62.5 | 0.0 | 0.0 | 0.0 | 62.5 | + | 7 | 15 | 28 July 2023 | | 0.0 | 437.5 | 0.0 | 0.0 | 0.0 | 437.5 | 0.0 | 0.0 | 0.0 | 437.5 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1500.0 | 0 | 0.0 | 0 | 1500.0 | 650.0 | 400.0 | 250.0 | 850.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 May 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 06 May 2023 | Repayment | 650.0 | 650.0 | 0.0 | 0.0 | 0.0 | 350.0 | + | 25 May 2023 | Disbursement | 250.0 | 0.0 | 0.0 | 0.0 | 0.0 | 600.0 | + | 15 July 2023 | Disbursement | 250.0 | 0.0 | 0.0 | 0.0 | 0.0 | 850.0 | + When Batch API call with steps: rescheduleLoan from "13 July 2023" to "13 August 2023" submitted on date: "15 July 2023", approveReschedule on date: "15 July 2023" runs with enclosingTransaction: "true" + Then Loan Repayment schedule has 7 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 May 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 May 2023 | 06 May 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | 2 | 15 | 16 May 2023 | 06 May 2023 | 562.5 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | 187.5 | 187.5 | 0.0 | 0.0 | + | | | 25 May 2023 | | 250.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 3 | 0 | 25 May 2023 | | 750.0 | 62.5 | 0.0 | 0.0 | 0.0 | 62.5 | 0.0 | 0.0 | 0.0 | 62.5 | + | 4 | 15 | 31 May 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 187.5 | 187.5 | 0.0 | 62.5 | + | | | 15 July 2023 | | 250.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 5 | 0 | 15 July 2023 | | 687.5 | 62.5 | 0.0 | 0.0 | 0.0 | 62.5 | 0.0 | 0.0 | 0.0 | 62.5 | + | 6 | 74 | 13 August 2023 | | 343.75 | 343.75 | 0.0 | 0.0 | 0.0 | 343.75 | 25.0 | 25.0 | 0.0 | 318.75 | + | 7 | 15 | 28 August 2023 | | 0.0 | 343.75 | 0.0 | 0.0 | 0.0 | 343.75 | 0.0 | 0.0 | 0.0 | 343.75 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1500.0 | 0 | 0.0 | 0 | 1500.0 | 650.0 | 400.0 | 250.0 | 850.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 May 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 06 May 2023 | Repayment | 650.0 | 650.0 | 0.0 | 0.0 | 0.0 | 350.0 | + | 25 May 2023 | Disbursement | 250.0 | 0.0 | 0.0 | 0.0 | 0.0 | 600.0 | + | 15 July 2023 | Disbursement | 250.0 | 0.0 | 0.0 | 0.0 | 0.0 | 850.0 | + When Admin set "PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + + @TestRailId:C2940 @AdvancedPaymentAllocation @ProgressiveLoanSchedule + Scenario: Verify AdvancedPaymentAllocation behaviour: loanScheduleProcessingType-horizontal, charge after maturity, loan fully paid in advance + When Admin sets the business date to "01 September 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | +# Add charge after maturity + When Admin adds "LOAN_NSF_FEE" due date charge with "17 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 0.0 | 0.0 | 0.0 | 1020.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Loan got fully paid in advance + And Customer makes "AUTOPAY" repayment on "01 September 2023" with 1020 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 01 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | 01 September 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 4 | 15 | 16 October 2023 | 01 September 2023 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 5 | 1 | 17 October 2023 | 01 September 2023 | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 20.0 | 20.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 1020.0 | 770.0 | 0.0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 1020.0 | 1000.0 | 0.0 | 0.0 | 20.0 | 0.0 | + | 01 September 2023 | Accrual | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + + @TestRailId:C2941 @AdvancedPaymentAllocation @ProgressiveLoanSchedule + Scenario: Verify AdvancedPaymentAllocation behaviour: loanScheduleProcessingType-vertical, charge after maturity, loan fully paid in advance + When Admin sets the business date to "01 September 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_VERTICAL | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | +# Add charge after maturity + When Admin adds "LOAN_NSF_FEE" due date charge with "17 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 0.0 | 0.0 | 0.0 | 1020.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Loan got fully paid in advance + And Customer makes "AUTOPAY" repayment on "01 September 2023" with 1020 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 01 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | 01 September 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 4 | 15 | 16 October 2023 | 01 September 2023 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 5 | 1 | 17 October 2023 | 01 September 2023 | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 20.0 | 20.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 1020.0 | 770.0 | 0.0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 1020.0 | 1000.0 | 0.0 | 0.0 | 20.0 | 0.0 | + | 01 September 2023 | Accrual | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + + @TestRailId:C2942 @AdvancedPaymentAllocation @ProgressiveLoanSchedule + Scenario: Verify AdvancedPaymentAllocation behaviour: loanScheduleProcessingType-horizontal, charge after maturity, loan overpaid in advance + When Admin sets the business date to "01 September 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | +# Add charge after maturity + When Admin adds "LOAN_NSF_FEE" due date charge with "17 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 0.0 | 0.0 | 0.0 | 1020.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Loan got overpaid in advance + And Customer makes "AUTOPAY" repayment on "01 September 2023" with 1120 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 0 outstanding amount + Then Loan has 100 overpaid amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 01 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | 01 September 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 4 | 15 | 16 October 2023 | 01 September 2023 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 5 | 1 | 17 October 2023 | 01 September 2023 | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 20.0 | 20.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 1020.0 | 770.0 | 0.0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 1120.0 | 1000.0 | 0.0 | 0.0 | 20.0 | 0.0 | + | 01 September 2023 | Accrual | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + + @TestRailId:C2943 @AdvancedPaymentAllocation @ProgressiveLoanSchedule + Scenario: Verify AdvancedPaymentAllocation behaviour: loanScheduleProcessingType-vertical, charge after maturity, loan overpaid in advance + When Admin sets the business date to "01 September 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_VERTICAL | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | +# Add charge after maturity + When Admin adds "LOAN_NSF_FEE" due date charge with "17 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 0.0 | 0.0 | 0.0 | 1020.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Loan got overpaid in advance + And Customer makes "AUTOPAY" repayment on "01 September 2023" with 1120 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 0 outstanding amount + Then Loan has 100 overpaid amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 01 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | 01 September 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 4 | 15 | 16 October 2023 | 01 September 2023 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 5 | 1 | 17 October 2023 | 01 September 2023 | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 20.0 | 20.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 1020.0 | 770.0 | 0.0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 1120.0 | 1000.0 | 0.0 | 0.0 | 20.0 | 0.0 | + | 01 September 2023 | Accrual | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + + @TestRailId:C2944 @AdvancedPaymentAllocation @ProgressiveLoanSchedule + Scenario: Verify AdvancedPaymentAllocation behaviour: loanScheduleProcessingType-horizontal, charge after maturity, in advanced repayment (future installment type: NEXT_INSTALLMENT) + When Admin sets the business date to "01 September 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | +# Add charge after maturity + When Admin adds "LOAN_NSF_FEE" due date charge with "17 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 0.0 | 0.0 | 0.0 | 1020.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make due date repayments + And Customer makes "AUTOPAY" repayment on "01 September 2023" with 250 EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 250 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 500.0 | 0.0 | 0.0 | 520.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make charges for the next installments + When Admin adds "LOAN_NSF_FEE" due date charge with "17 September 2023" due date and 20 EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "16 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 60.0 | 1060.0 | 500.0 | 0.0 | 0.0 | 560.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 16 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 17 September 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make in advance payment (future installment type: NEXT_INSTALLMENT) + When Admin sets the business date to "17 September 2023" + And Customer makes "AUTOPAY" repayment on "17 September 2023" with 100 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 100.0 | 100.0 | 0.0 | 170.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 60.0 | 1060.0 | 600.0 | 100.0 | 0.0 | 460.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 17 September 2023 | Repayment | 100.0 | 80.0 | 0.0 | 0.0 | 20.0 | 420.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 16 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 17 September 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + + @TestRailId:C2945 @AdvancedPaymentAllocation @ProgressiveLoanSchedule + Scenario: Verify AdvancedPaymentAllocation behaviour: loanScheduleProcessingType-vertical, charge after maturity, in advanced repayment (future installment type: NEXT_INSTALLMENT) + When Admin sets the business date to "01 September 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_VERTICAL | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | +# Add charge after maturity + When Admin adds "LOAN_NSF_FEE" due date charge with "17 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 0.0 | 0.0 | 0.0 | 1020.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make due date repayments + And Customer makes "AUTOPAY" repayment on "01 September 2023" with 250 EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 250 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 500.0 | 0.0 | 0.0 | 520.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make charges for the next installments + When Admin adds "LOAN_NSF_FEE" due date charge with "17 September 2023" due date and 20 EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "16 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 60.0 | 1060.0 | 500.0 | 0.0 | 0.0 | 560.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 16 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 17 September 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make in advance payment (future installment type: NEXT_INSTALLMENT) + When Admin sets the business date to "17 September 2023" + And Customer makes "AUTOPAY" repayment on "17 September 2023" with 100 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 60.0 | 60.0 | 0.0 | 210.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 20.0 | 20.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | 17 September 2023 | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 20.0 | 20.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 60.0 | 1060.0 | 600.0 | 100.0 | 0.0 | 460.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 17 September 2023 | Repayment | 100.0 | 40.0 | 0.0 | 0.0 | 60.0 | 460.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + | NSF fee | true | Specified due date | 16 October 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + | NSF fee | true | Specified due date | 17 September 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + + @TestRailId:C2946 @AdvancedPaymentAllocation @ProgressiveLoanSchedule + Scenario: Verify AdvancedPaymentAllocation behaviour: loanScheduleProcessingType-horizontal, charge after maturity, late Goodwill credit transaction (future installment type: LAST_INSTALLMENT) - amount < past due charge + When Admin sets the business date to "01 September 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | +# Add charge after maturity + When Admin adds "LOAN_NSF_FEE" due date charge with "17 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 0.0 | 0.0 | 0.0 | 1020.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make due date repayments + And Customer makes "AUTOPAY" repayment on "01 September 2023" with 250 EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 250 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 500.0 | 0.0 | 0.0 | 520.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make charges for the next installments + When Admin adds "LOAN_NSF_FEE" due date charge with "17 September 2023" due date and 20 EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "16 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 60.0 | 1060.0 | 500.0 | 0.0 | 0.0 | 560.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 16 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 17 September 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make late Goodwill credit transaction (future installment type: LAST_INSTALLMENT) + When Admin sets the business date to "17 October 2023" + When Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "17 October 2023" with 15 EUR transaction amount and system-generated Idempotency key + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 15.0 | 0.0 | 15.0 | 255.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 60.0 | 1060.0 | 515.0 | 0.0 | 15.0 | 545.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 17 October 2023 | Goodwill Credit | 15.0 | 0.0 | 0.0 | 0.0 | 15.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 16 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 17 September 2023 | Flat | 20.0 | 15.0 | 0.0 | 5.0 | + + @TestRailId:C2947 @AdvancedPaymentAllocation @ProgressiveLoanSchedule + Scenario: Verify AdvancedPaymentAllocation behaviour: loanScheduleProcessingType-vertical, charge after maturity, late Goodwill credit transaction (future installment type: LAST_INSTALLMENT) - amount < past due charge + When Admin sets the business date to "01 September 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_VERTICAL | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | +# Add charge after maturity + When Admin adds "LOAN_NSF_FEE" due date charge with "17 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 0.0 | 0.0 | 0.0 | 1020.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make due date repayments + And Customer makes "AUTOPAY" repayment on "01 September 2023" with 250 EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 250 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 500.0 | 0.0 | 0.0 | 520.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make charges for the next installments + When Admin adds "LOAN_NSF_FEE" due date charge with "17 September 2023" due date and 20 EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "16 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 60.0 | 1060.0 | 500.0 | 0.0 | 0.0 | 560.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 16 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 17 September 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make late Goodwill credit transaction (future installment type: LAST_INSTALLMENT) + When Admin sets the business date to "17 October 2023" + When Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "17 October 2023" with 15 EUR transaction amount and system-generated Idempotency key + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 15.0 | 0.0 | 15.0 | 255.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 60.0 | 1060.0 | 515.0 | 0.0 | 15.0 | 545.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 17 October 2023 | Goodwill Credit | 15.0 | 0.0 | 0.0 | 0.0 | 15.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 16 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 17 September 2023 | Flat | 20.0 | 15.0 | 0.0 | 5.0 | + + @TestRailId:C2948 @AdvancedPaymentAllocation @ProgressiveLoanSchedule + Scenario: Verify AdvancedPaymentAllocation behaviour: loanScheduleProcessingType-horizontal, charge after maturity, late Goodwill credit transaction (future installment type: LAST_INSTALLMENT) - amount > first past due charge + When Admin sets the business date to "01 September 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | +# Add charge after maturity + When Admin adds "LOAN_NSF_FEE" due date charge with "17 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 0.0 | 0.0 | 0.0 | 1020.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make due date repayments + And Customer makes "AUTOPAY" repayment on "01 September 2023" with 250 EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 250 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 500.0 | 0.0 | 0.0 | 520.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make charges for the next installments + When Admin adds "LOAN_NSF_FEE" due date charge with "17 September 2023" due date and 20 EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "16 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 60.0 | 1060.0 | 500.0 | 0.0 | 0.0 | 560.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 16 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 17 September 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make late Goodwill credit transaction (future installment type: LAST_INSTALLMENT) + When Admin sets the business date to "17 October 2023" + When Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "17 October 2023" with 35 EUR transaction amount and system-generated Idempotency key + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 35.0 | 0.0 | 35.0 | 235.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 60.0 | 1060.0 | 535.0 | 0.0 | 35.0 | 525.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 17 October 2023 | Goodwill Credit | 35.0 | 15.0 | 0.0 | 0.0 | 20.0 | 485.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 16 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 17 September 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + + @TestRailId:C2949 @AdvancedPaymentAllocation @ProgressiveLoanSchedule + Scenario: Verify AdvancedPaymentAllocation behaviour: loanScheduleProcessingType-vertical, charge after maturity, late Goodwill credit transaction (future installment type: LAST_INSTALLMENT) - amount > first past due charge + When Admin sets the business date to "01 September 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_VERTICAL | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | +# Add charge after maturity + When Admin adds "LOAN_NSF_FEE" due date charge with "17 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 0.0 | 0.0 | 0.0 | 1020.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make due date repayments + And Customer makes "AUTOPAY" repayment on "01 September 2023" with 250 EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 250 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 500.0 | 0.0 | 0.0 | 520.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make charges for the next installments + When Admin adds "LOAN_NSF_FEE" due date charge with "17 September 2023" due date and 20 EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "16 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 60.0 | 1060.0 | 500.0 | 0.0 | 0.0 | 560.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 16 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 17 September 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make late Goodwill credit transaction (future installment type: LAST_INSTALLMENT) + When Admin sets the business date to "17 October 2023" + When Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "17 October 2023" with 35 EUR transaction amount and system-generated Idempotency key + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 20.0 | 0.0 | 20.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 15.0 | 0.0 | 15.0 | 255.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 60.0 | 1060.0 | 535.0 | 0.0 | 35.0 | 525.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 17 October 2023 | Goodwill Credit | 35.0 | 0.0 | 0.0 | 0.0 | 35.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 16 October 2023 | Flat | 20.0 | 15.0 | 0.0 | 5.0 | + | NSF fee | true | Specified due date | 17 September 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + + @TestRailId:C2950 @AdvancedPaymentAllocation @ProgressiveLoanSchedule + Scenario: Verify AdvancedPaymentAllocation behaviour: loanScheduleProcessingType-horizontal, charge after maturity, late Goodwill credit transaction (future installment type: LAST_INSTALLMENT) - amount > sum past due charges + When Admin sets the business date to "01 September 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | +# Add charge after maturity + When Admin adds "LOAN_NSF_FEE" due date charge with "17 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 0.0 | 0.0 | 0.0 | 1020.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make due date repayments + And Customer makes "AUTOPAY" repayment on "01 September 2023" with 250 EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 250 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 500.0 | 0.0 | 0.0 | 520.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make charges for the next installments + When Admin adds "LOAN_NSF_FEE" due date charge with "17 September 2023" due date and 20 EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "16 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 60.0 | 1060.0 | 500.0 | 0.0 | 0.0 | 560.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 16 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 17 September 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make late Goodwill credit transaction (future installment type: LAST_INSTALLMENT) + When Admin sets the business date to "17 October 2023" + When Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "17 October 2023" with 350 EUR transaction amount and system-generated Idempotency key + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | 17 October 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 270.0 | 0.0 | 270.0 | 0.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 80.0 | 0.0 | 80.0 | 190.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 60.0 | 1060.0 | 850.0 | 0.0 | 350.0 | 210.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 17 October 2023 | Goodwill Credit | 350.0 | 310.0 | 0.0 | 0.0 | 40.0 | 190.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 16 October 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + | NSF fee | true | Specified due date | 17 September 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + + @TestRailId:C2951 @AdvancedPaymentAllocation @ProgressiveLoanSchedule + Scenario: Verify AdvancedPaymentAllocation behaviour: loanScheduleProcessingType-vertical, charge after maturity, late Goodwill credit transaction (future installment type: LAST_INSTALLMENT) - amount > sum past due charges + When Admin sets the business date to "01 September 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_VERTICAL | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | +# Add charge after maturity + When Admin adds "LOAN_NSF_FEE" due date charge with "17 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 0.0 | 0.0 | 0.0 | 1020.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make due date repayments + And Customer makes "AUTOPAY" repayment on "01 September 2023" with 250 EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 250 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 500.0 | 0.0 | 0.0 | 520.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make charges for the next installments + When Admin adds "LOAN_NSF_FEE" due date charge with "17 September 2023" due date and 20 EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "16 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 60.0 | 1060.0 | 500.0 | 0.0 | 0.0 | 560.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 16 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 17 September 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make late Goodwill credit transaction (future installment type: LAST_INSTALLMENT) + When Admin sets the business date to "17 October 2023" + When Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "17 October 2023" with 350 EUR transaction amount and system-generated Idempotency key + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | 17 October 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 270.0 | 0.0 | 270.0 | 0.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 80.0 | 0.0 | 80.0 | 190.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 60.0 | 1060.0 | 850.0 | 0.0 | 350.0 | 210.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 17 October 2023 | Goodwill Credit | 350.0 | 310.0 | 0.0 | 0.0 | 40.0 | 190.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 16 October 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + | NSF fee | true | Specified due date | 17 September 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + + @TestRailId:C2952 @AdvancedPaymentAllocation @ProgressiveLoanSchedule + Scenario: Verify AdvancedPaymentAllocation behaviour: loanScheduleProcessingType-horizontal, charge after maturity, in advanced Goodwill credit transaction on first charge due date (future installment type: LAST_INSTALLMENT) - amount > due date charge + When Admin sets the business date to "01 September 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | +# Add charge after maturity + When Admin adds "LOAN_NSF_FEE" due date charge with "17 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 0.0 | 0.0 | 0.0 | 1020.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make due date repayments + And Customer makes "AUTOPAY" repayment on "01 September 2023" with 250 EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 250 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 500.0 | 0.0 | 0.0 | 520.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make charges for the next installments + When Admin adds "LOAN_NSF_FEE" due date charge with "17 September 2023" due date and 20 EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "16 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 60.0 | 1060.0 | 500.0 | 0.0 | 0.0 | 560.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 16 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 17 September 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make in advanced Goodwill credit transaction (future installment type: LAST_INSTALLMENT) + When Admin sets the business date to "17 September 2023" + When Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "17 September 2023" with 35 EUR transaction amount and system-generated Idempotency key + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 15.0 | 15.0 | 0.0 | 255.0 | + | 5 | 1 | 17 October 2023 | 17 September 2023 | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 20.0 | 20.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 60.0 | 1060.0 | 535.0 | 35.0 | 0.0 | 525.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 17 September 2023 | Goodwill Credit | 35.0 | 0.0 | 0.0 | 0.0 | 35.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + | NSF fee | true | Specified due date | 16 October 2023 | Flat | 20.0 | 15.0 | 0.0 | 5.0 | + | NSF fee | true | Specified due date | 17 September 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + + @TestRailId:C2953 @AdvancedPaymentAllocation @ProgressiveLoanSchedule + Scenario: Verify AdvancedPaymentAllocation behaviour: loanScheduleProcessingType-vertical, charge after maturity, in advanced Goodwill credit transaction on first charge due date (future installment type: LAST_INSTALLMENT) - amount > due date charge + When Admin sets the business date to "01 September 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_VERTICAL | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | +# Add charge after maturity + When Admin adds "LOAN_NSF_FEE" due date charge with "17 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 0.0 | 0.0 | 0.0 | 1020.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make due date repayments + And Customer makes "AUTOPAY" repayment on "01 September 2023" with 250 EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 250 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 500.0 | 0.0 | 0.0 | 520.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make charges for the next installments + When Admin adds "LOAN_NSF_FEE" due date charge with "17 September 2023" due date and 20 EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "16 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 60.0 | 1060.0 | 500.0 | 0.0 | 0.0 | 560.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 16 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 17 September 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make in advanced Goodwill credit transaction (future installment type: LAST_INSTALLMENT) + When Admin sets the business date to "17 September 2023" + When Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "17 September 2023" with 35 EUR transaction amount and system-generated Idempotency key + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 15.0 | 15.0 | 0.0 | 255.0 | + | 5 | 1 | 17 October 2023 | 17 September 2023 | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 20.0 | 20.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 60.0 | 1060.0 | 535.0 | 35.0 | 0.0 | 525.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 17 September 2023 | Goodwill Credit | 35.0 | 0.0 | 0.0 | 0.0 | 35.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + | NSF fee | true | Specified due date | 16 October 2023 | Flat | 20.0 | 15.0 | 0.0 | 5.0 | + | NSF fee | true | Specified due date | 17 September 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + + @TestRailId:C2954 @AdvancedPaymentAllocation @ProgressiveLoanSchedule + Scenario: Verify AdvancedPaymentAllocation behaviour: loanScheduleProcessingType-horizontal, charge after maturity, in advanced Goodwill credit transaction before first charge due date (future installment type: LAST_INSTALLMENT) - amount > first and second charge + When Admin sets the business date to "01 September 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | +# Add charge after maturity + When Admin adds "LOAN_NSF_FEE" due date charge with "17 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 0.0 | 0.0 | 0.0 | 1020.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make due date repayments + And Customer makes "AUTOPAY" repayment on "01 September 2023" with 250 EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 250 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 500.0 | 0.0 | 0.0 | 520.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make charges for the next installments + When Admin adds "LOAN_NSF_FEE" due date charge with "17 September 2023" due date and 20 EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "16 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 60.0 | 1060.0 | 500.0 | 0.0 | 0.0 | 560.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 16 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 17 September 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + When Admin sets the business date to "17 September 2023" + # Make in advanced Goodwill credit transaction (future installment type: LAST_INSTALLMENT) + When Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "17 September 2023" with 35 EUR transaction amount and system-generated Idempotency key + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 15.0 | 15.0 | 0.0 | 255.0 | + | 5 | 1 | 17 October 2023 | 17 September 2023 | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 20.0 | 20.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 60.0 | 1060.0 | 535.0 | 35.0 | 0.0 | 525.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 17 September 2023 | Goodwill Credit | 35.0 | 0.0 | 0.0 | 0.0 | 35.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + | NSF fee | true | Specified due date | 16 October 2023 | Flat | 20.0 | 15.0 | 0.0 | 5.0 | + | NSF fee | true | Specified due date | 17 September 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + + @TestRailId:C2955 @AdvancedPaymentAllocation @ProgressiveLoanSchedule + Scenario: Verify AdvancedPaymentAllocation behaviour: loanScheduleProcessingType-vertical, charge after maturity, in advanced Goodwill credit transaction before first charge due date (future installment type: LAST_INSTALLMENT) - amount > first and second charge + When Admin sets the business date to "01 September 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_VERTICAL | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | +# Add charge after maturity + When Admin adds "LOAN_NSF_FEE" due date charge with "17 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 0.0 | 0.0 | 0.0 | 1020.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make due date repayments + And Customer makes "AUTOPAY" repayment on "01 September 2023" with 250 EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 250 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 500.0 | 0.0 | 0.0 | 520.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make charges for the next installments + When Admin adds "LOAN_NSF_FEE" due date charge with "17 September 2023" due date and 20 EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "16 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 60.0 | 1060.0 | 500.0 | 0.0 | 0.0 | 560.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 16 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 17 September 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + When Admin sets the business date to "17 September 2023" +# Make in advanced Goodwill credit transaction (future installment type: LAST_INSTALLMENT) + When Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "17 September 2023" with 35 EUR transaction amount and system-generated Idempotency key + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 15.0 | 15.0 | 0.0 | 255.0 | + | 5 | 1 | 17 October 2023 | 17 September 2023 | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 20.0 | 20.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 60.0 | 1060.0 | 535.0 | 35.0 | 0.0 | 525.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 17 September 2023 | Goodwill Credit | 35.0 | 0.0 | 0.0 | 0.0 | 35.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + | NSF fee | true | Specified due date | 16 October 2023 | Flat | 20.0 | 15.0 | 0.0 | 5.0 | + | NSF fee | true | Specified due date | 17 September 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + + @TestRailId:C2956 @AdvancedPaymentAllocation @ProgressiveLoanSchedule + Scenario: Verify AdvancedPaymentAllocation behaviour: loanScheduleProcessingType-horizontal, charge after maturity, in advanced Merchant issued refund transaction on first charge due date (future installment type: REAMORTIZATION) - amount < sum all charges + When Admin sets the business date to "01 September 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | +# Add charge after maturity + When Admin adds "LOAN_NSF_FEE" due date charge with "17 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 0.0 | 0.0 | 0.0 | 1020.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make due date repayments + And Customer makes "AUTOPAY" repayment on "01 September 2023" with 250 EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 250 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 500.0 | 0.0 | 0.0 | 520.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make charges for the next installments + When Admin adds "LOAN_NSF_FEE" due date charge with "17 September 2023" due date and 20 EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "16 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 60.0 | 1060.0 | 500.0 | 0.0 | 0.0 | 560.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 16 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 17 September 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make in advanced Merchant issued refund transaction (future installment type: REAMORTIZATION) + When Admin sets the business date to "17 September 2023" + When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "17 September 2023" with 30 EUR transaction amount and system-generated Idempotency key + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 10.0 | 10.0 | 0.0 | 260.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 10.0 | 10.0 | 0.0 | 260.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 10.0 | 10.0 | 0.0 | 10.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 60.0 | 1060.0 | 530.0 | 30.0 | 0.0 | 530.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 17 September 2023 | Merchant Issued Refund | 30.0 | 0.0 | 0.0 | 0.0 | 30.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 10.0 | 0.0 | 10.0 | + | NSF fee | true | Specified due date | 16 October 2023 | Flat | 20.0 | 10.0 | 0.0 | 10.0 | + | NSF fee | true | Specified due date | 17 September 2023 | Flat | 20.0 | 10.0 | 0.0 | 10.0 | + + @TestRailId:C2957 @AdvancedPaymentAllocation @ProgressiveLoanSchedule + Scenario: Verify AdvancedPaymentAllocation behaviour: loanScheduleProcessingType-vertical, charge after maturity, in advanced Merchant issued refund transaction on first charge due date (future installment type: REAMORTIZATION) - amount < sum all charges + When Admin sets the business date to "01 September 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_VERTICAL | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | +# Add charge after maturity + When Admin adds "LOAN_NSF_FEE" due date charge with "17 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 0.0 | 0.0 | 0.0 | 1020.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make due date repayments + And Customer makes "AUTOPAY" repayment on "01 September 2023" with 250 EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 250 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 500.0 | 0.0 | 0.0 | 520.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make charges for the next installments + When Admin adds "LOAN_NSF_FEE" due date charge with "17 September 2023" due date and 20 EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "16 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 60.0 | 1060.0 | 500.0 | 0.0 | 0.0 | 560.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 16 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 17 September 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make in advanced Merchant issued refund transaction (future installment type: REAMORTIZATION) + When Admin sets the business date to "17 September 2023" + When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "17 September 2023" with 30 EUR transaction amount and system-generated Idempotency key + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 10.0 | 10.0 | 0.0 | 260.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 10.0 | 10.0 | 0.0 | 260.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 10.0 | 10.0 | 0.0 | 10.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 60.0 | 1060.0 | 530.0 | 30.0 | 0.0 | 530.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 17 September 2023 | Merchant Issued Refund | 30.0 | 0.0 | 0.0 | 0.0 | 30.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 10.0 | 0.0 | 10.0 | + | NSF fee | true | Specified due date | 16 October 2023 | Flat | 20.0 | 10.0 | 0.0 | 10.0 | + | NSF fee | true | Specified due date | 17 September 2023 | Flat | 20.0 | 10.0 | 0.0 | 10.0 | + + @TestRailId:C2958 @AdvancedPaymentAllocation @ProgressiveLoanSchedule + Scenario: Verify AdvancedPaymentAllocation behaviour: loanScheduleProcessingType-horizontal, charge after maturity, in advanced Merchant issued refund transaction before first charge due date (future installment type: REAMORTIZATION) - amount < sum all charges + When Admin sets the business date to "01 September 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | +# Add charge after maturity + When Admin adds "LOAN_NSF_FEE" due date charge with "17 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 0.0 | 0.0 | 0.0 | 1020.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make due date repayments + And Customer makes "AUTOPAY" repayment on "01 September 2023" with 250 EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 250 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 500.0 | 0.0 | 0.0 | 520.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make charges for the next installments + When Admin adds "LOAN_NSF_FEE" due date charge with "17 September 2023" due date and 20 EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "16 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 60.0 | 1060.0 | 500.0 | 0.0 | 0.0 | 560.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 16 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 17 September 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + When Admin sets the business date to "17 September 2023" +# Make in advanced Merchant issued refund transaction (future installment type: REAMORTIZATION) + When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "17 September 2023" with 30 EUR transaction amount and system-generated Idempotency key + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 10.0 | 10.0 | 0.0 | 260.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 10.0 | 10.0 | 0.0 | 260.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 10.0 | 10.0 | 0.0 | 10.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 60.0 | 1060.0 | 530.0 | 30.0 | 0.0 | 530.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 17 September 2023 | Merchant Issued Refund | 30.0 | 0.0 | 0.0 | 0.0 | 30.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 10.0 | 0.0 | 10.0 | + | NSF fee | true | Specified due date | 16 October 2023 | Flat | 20.0 | 10.0 | 0.0 | 10.0 | + | NSF fee | true | Specified due date | 17 September 2023 | Flat | 20.0 | 10.0 | 0.0 | 10.0 | + + @TestRailId:C2959 @AdvancedPaymentAllocation @ProgressiveLoanSchedule + Scenario: Verify AdvancedPaymentAllocation behaviour: loanScheduleProcessingType-vertical, charge after maturity, in advanced Merchant issued refund transaction before first charge due date (future installment type: REAMORTIZATION) - amount < sum all charges + When Admin sets the business date to "01 September 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_VERTICAL | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | +# Add charge after maturity + When Admin adds "LOAN_NSF_FEE" due date charge with "17 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 September 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 0.0 | 0.0 | 0.0 | 1020.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make due date repayments + And Customer makes "AUTOPAY" repayment on "01 September 2023" with 250 EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 250 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 500.0 | 0.0 | 0.0 | 520.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | +# Make charges for the next installments + When Admin adds "LOAN_NSF_FEE" due date charge with "17 September 2023" due date and 20 EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "16 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 60.0 | 1060.0 | 500.0 | 0.0 | 0.0 | 560.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 16 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 17 September 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + When Admin sets the business date to "17 September 2023" +# Make in advanced Merchant issued refund transaction (future installment type: REAMORTIZATION) + When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "17 September 2023" with 30 EUR transaction amount and system-generated Idempotency key + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 10.0 | 10.0 | 0.0 | 260.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 20.0 | 270.0 | 10.0 | 10.0 | 0.0 | 260.0 | + | 5 | 1 | 17 October 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 10.0 | 10.0 | 0.0 | 10.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 60.0 | 1060.0 | 530.0 | 30.0 | 0.0 | 530.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 17 September 2023 | Merchant Issued Refund | 30.0 | 0.0 | 0.0 | 0.0 | 30.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 17 October 2023 | Flat | 20.0 | 10.0 | 0.0 | 10.0 | + | NSF fee | true | Specified due date | 16 October 2023 | Flat | 20.0 | 10.0 | 0.0 | 10.0 | + | NSF fee | true | Specified due date | 17 September 2023 | Flat | 20.0 | 10.0 | 0.0 | 10.0 | + + @TestRailId:C2960 @AdvancedPaymentAllocation + Scenario: Verify that rounding in case of multiple installments works properly + When Admin sets the business date to "01 September 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 | + | PIN30 | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" 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 | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 01 October 2023 | | 833.0 | 167.0 | 0.0 | 0.0 | 0.0 | 167.0 | 0.0 | 0.0 | 0.0 | 167.0 | + | 2 | 31 | 01 November 2023 | | 666.0 | 167.0 | 0.0 | 0.0 | 0.0 | 167.0 | 0.0 | 0.0 | 0.0 | 167.0 | + | 3 | 30 | 01 December 2023 | | 499.0 | 167.0 | 0.0 | 0.0 | 0.0 | 167.0 | 0.0 | 0.0 | 0.0 | 167.0 | + | 4 | 31 | 01 January 2024 | | 332.0 | 167.0 | 0.0 | 0.0 | 0.0 | 167.0 | 0.0 | 0.0 | 0.0 | 167.0 | + | 5 | 31 | 01 February 2024 | | 165.0 | 167.0 | 0.0 | 0.0 | 0.0 | 167.0 | 0.0 | 0.0 | 0.0 | 167.0 | + | 6 | 29 | 01 March 2024 | | 0.0 | 165.0 | 0.0 | 0.0 | 0.0 | 165.0 | 0.0 | 0.0 | 0.0 | 165.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + + @TestRailId:C2976 @AdvancedPaymentAllocation @ProgressiveLoanSchedule + Scenario: Verify that disbursement amount only distributed only to future installments (2nd and 3rd installments) + When Admin sets the business date to "01 September 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 30 | 01 October 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 31 | 01 November 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 30 | 01 December 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "1 September 2023" due date and 50 EUR transaction amount + And Customer makes "AUTOPAY" repayment on "1 September 2023" with 250 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 30 | 01 October 2023 | | 500.0 | 250.0 | 0.0 | 50.0 | 0.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 3 | 31 | 01 November 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 30 | 01 December 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 50.0 | 0.0 | 1050.0 | 250.0 | 0.0 | 0.0 | 800.0 | + When Admin sets the business date to "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "400" EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 30 | 01 October 2023 | | 500.0 | 250.0 | 0.0 | 50.0 | 0.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | | | 01 October 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 3 | 0 | 01 October 2023 | | 800.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 4 | 31 | 01 November 2023 | | 400.0 | 400.0 | 0.0 | 0.0 | 0.0 | 400.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 5 | 30 | 01 December 2023 | | 0.0 | 400.0 | 0.0 | 0.0 | 0.0 | 400.0 | 0.0 | 0.0 | 0.0 | 400.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1400.0 | 0.0 | 50.0 | 0.0 | 1450.0 | 250.0 | 0.0 | 0.0 | 1200.0 | + + @TestRailId:C2977 @AdvancedPaymentAllocation @ProgressiveLoanSchedule + Scenario: Verify that disbursement amount only distributed only to future installments (1st, 2nd and 3rd installments) + When Admin sets the business date to "01 September 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 30 | 01 October 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 31 | 01 November 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 30 | 01 December 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "1 September 2023" due date and 50 EUR transaction amount + And Customer makes "AUTOPAY" repayment on "1 September 2023" with 250 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 30 | 01 October 2023 | | 500.0 | 250.0 | 0.0 | 50.0 | 0.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 3 | 31 | 01 November 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 30 | 01 December 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 50.0 | 0.0 | 1050.0 | 250.0 | 0.0 | 0.0 | 800.0 | + When Admin successfully disburse the loan on "01 September 2023" with "400" EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | | | 01 September 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 1150.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 0 | 01 September 2023 | | 1050.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 3 | 30 | 01 October 2023 | | 700.0 | 350.0 | 0.0 | 50.0 | 0.0 | 400.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 4 | 31 | 01 November 2023 | | 350.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | + | 5 | 30 | 01 December 2023 | | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1400.0 | 0.0 | 50.0 | 0.0 | 1450.0 | 250.0 | 0.0 | 0.0 | 1200.0 | + + @TestRailId:C2978 @AdvancedPaymentAllocation @ProgressiveLoanSchedule + Scenario: Verify that multiple disbursement amount only distributed only to future installments (2nd and 3rd installments) + When Admin sets the business date to "01 September 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 30 | 01 October 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 31 | 01 November 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 30 | 01 December 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "1 September 2023" due date and 50 EUR transaction amount + And Customer makes "AUTOPAY" repayment on "1 September 2023" with 250 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 30 | 01 October 2023 | | 500.0 | 250.0 | 0.0 | 50.0 | 0.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 3 | 31 | 01 November 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 30 | 01 December 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 50.0 | 0.0 | 1050.0 | 250.0 | 0.0 | 0.0 | 800.0 | + When Admin sets the business date to "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "400" EUR transaction amount + When Admin successfully disburse the loan on "01 October 2023" with "80" 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 | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 30 | 01 October 2023 | | 500.0 | 250.0 | 0.0 | 50.0 | 0.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | | | 01 October 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | | | 01 October 2023 | | 80.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 3 | 0 | 01 October 2023 | | 880.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 4 | 0 | 01 October 2023 | | 860.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + | 5 | 31 | 01 November 2023 | | 430.0 | 430.0 | 0.0 | 0.0 | 0.0 | 430.0 | 0.0 | 0.0 | 0.0 | 430.0 | + | 6 | 30 | 01 December 2023 | | 0.0 | 430.0 | 0.0 | 0.0 | 0.0 | 430.0 | 0.0 | 0.0 | 0.0 | 430.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1480.0 | 0.0 | 50.0 | 0.0 | 1530.0 | 250.0 | 0.0 | 0.0 | 1280.0 | + + @TestRailId:C2986 @AdvancedPaymentAllocation + Scenario: As an admin I would like to verify that refund is working with advanced payment allocation + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + When Admin sets the business date to "01 January 2023" + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2023 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2023" with "500" amount and expected disbursement date on "01 January 2023" + Then Loan status has changed to "Approved" + And Admin successfully disburse the loan on "01 January 2023" with "500" EUR transaction amount + Then Loan status has changed to "Active" + When Admin sets the business date to "11 January 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "11 January 2023" due date and 20 EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "21 January 2023" due date and 20 EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "11 February 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 01 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2023 | | 250.0 | 125.0 | 0.0 | 20.0 | 0.0 | 145.0 | 0.0 | 0.0 | 0.0 | 145.0 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 20.0 | 0.0 | 145.0 | 0.0 | 0.0 | 0.0 | 145.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 20.0 | 0.0 | 145.0 | 0.0 | 0.0 | 0.0 | 145.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 60.0 | 0 | 560.0 | 125.0 | 0 | 0 | 435.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + When Admin sets the business date to "16 January 2023" + And Customer makes "AUTOPAY" repayment on "16 January 2023" with 315 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 01 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2023 | 16 January 2023 | 250.0 | 125.0 | 0.0 | 20.0 | 0.0 | 145.0 | 145.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2023 | 16 January 2023 | 125.0 | 125.0 | 0.0 | 20.0 | 0.0 | 145.0 | 145.0 | 145.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 20.0 | 0.0 | 145.0 | 25.0 | 25.0 | 0.0 | 120.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 60.0 | 0 | 560.0 | 440.0 | 170 | 0 | 120.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 16 January 2023 | Repayment | 315.0 | 255.0 | 0.0 | 60.0 | 0.0 | + When Admin sets the business date to "17 January 2023" + And Admin makes "REFUND_BY_CASH" transaction with "AUTOPAY" payment type on "17 January 2023" with 150 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 01 January 2023 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2023 | 16 January 2023 | 250.0 | 125.0 | 0.0 | 20.0 | 0.0 | 145.0 | 145.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2023 | | 125.0 | 125.0 | 0.0 | 20.0 | 0.0 | 145.0 | 20.0 | 20.0 | 0.0 | 125.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 125.0 | 0.0 | 20.0 | 0.0 | 145.0 | 0.0 | 0.0 | 0.0 | 145.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 60.0 | 0 | 560.0 | 290.0 | 20 | 0 | 270.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | + | 01 January 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 01 January 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 16 January 2023 | Repayment | 315.0 | 255.0 | 0.0 | 60.0 | 0.0 | + | 17 January 2023 | Refund | 150.0 | 130.0 | 0.0 | 20.0 | 0.0 | + + @TestRailId:C3042 @AdvancedPaymentAllocation + Scenario: Verify that second disbursement is working on overpaid accounts in case of NEXT_INSTALLMENT future installment allocation rule + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "1000" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "500" EUR transaction amount + When Admin sets the business date to "16 January 2024" + And Customer makes "AUTOPAY" repayment on "16 January 2024" with 500 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 125 overpaid amount + When Admin successfully disburse the loan on "16 January 2024" with "500" EUR transaction amount + Then Loan status will be "ACTIVE" + Then Loan has 375 outstanding amount + Then Loan Repayment schedule has 5 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 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | 16 January 2024 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | | | 16 January 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 3 | 0 | 16 January 2024 | 16 January 2024 | 625.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 31 January 2024 | | 312.0 | 313.0 | 0.0 | 0.0 | 0.0 | 313.0 | 125.0 | 125.0 | 0.0 | 188.0 | + | 5 | 15 | 15 February 2024 | | 0.0 | 312.0 | 0.0 | 0.0 | 0.0 | 312.0 | 125.0 | 125.0 | 0.0 | 187.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0.0 | 0 | 1000.0 | 625.0 | 250.0 | 0 | 375.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2024 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 16 January 2024 | Repayment | 500.0 | 375.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 16 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 375.0 | + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + + @TestRailId:C3043 @AdvancedPaymentAllocation + Scenario: Verify that second disbursement is working on overpaid accounts in case of REAMORTIZATION future installment allocation rule + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "REAMORTIZATION" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "1000" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "500" EUR transaction amount + When Admin sets the business date to "16 January 2024" + When Customer makes "PAYOUT_REFUND" transaction with "AUTOPAY" payment type on "16 January 2024" with 500 EUR transaction amount and system-generated Idempotency key + Then Loan status will be "OVERPAID" + Then Loan has 125 overpaid amount + When Admin successfully disburse the loan on "16 January 2024" with "500" EUR transaction amount + Then Loan status will be "ACTIVE" + Then Loan has 375 outstanding amount + Then Loan Repayment schedule has 5 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 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | 16 January 2024 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | | | 16 January 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 3 | 0 | 16 January 2024 | 16 January 2024 | 625.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 31 January 2024 | | 312.0 | 313.0 | 0.0 | 0.0 | 0.0 | 313.0 | 125.0 | 125.0 | 0.0 | 188.0 | + | 5 | 15 | 15 February 2024 | | 0.0 | 312.0 | 0.0 | 0.0 | 0.0 | 312.0 | 125.0 | 125.0 | 0.0 | 187.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0.0 | 0 | 1000.0 | 625.0 | 250.0 | 0 | 375.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2024 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 16 January 2024 | Payout Refund | 500.0 | 375.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 16 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 375.0 | + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + + @TestRailId:C3046 @AdvancedPaymentAllocation + Scenario: Verify that principal due is correct in case of second disbursement on overpaid loan + When Admin sets the business date to "01 February 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "REAMORTIZATION" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 February 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 February 2024" with "1000" amount and expected disbursement date on "01 February 2024" + When Admin successfully disburse the loan on "01 February 2024" with "200" EUR transaction amount + When Admin sets the business date to "02 February 2024" + When Customer makes "PAYOUT_REFUND" transaction with "AUTOPAY" payment type on "02 February 2024" with 200 EUR transaction amount and system-generated Idempotency key + Then Loan status will be "OVERPAID" + Then Loan has 50 overpaid amount + When Admin successfully disburse the loan on "02 February 2024" with "160" EUR transaction amount + Then Loan Repayment schedule has 5 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 February 2024 | | 200.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 February 2024 | 01 February 2024 | 150.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | + | | | 02 February 2024 | | 160.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 02 February 2024 | 02 February 2024 | 270.0 | 40.0 | 0.0 | 0.0 | 0.0 | 40.0 | 40.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 16 February 2024 | | 180.0 | 90.0 | 0.0 | 0.0 | 0.0 | 90.0 | 53.33 | 53.33 | 0.0 | 36.67 | + | 4 | 15 | 02 March 2024 | | 90.0 | 90.0 | 0.0 | 0.0 | 0.0 | 90.0 | 53.33 | 53.33 | 0.0 | 36.67 | + | 5 | 15 | 17 March 2024 | | 0.0 | 90.0 | 0.0 | 0.0 | 0.0 | 90.0 | 53.34 | 53.34 | 0.0 | 36.66 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 360.0 | 0 | 0.0 | 0 | 360.0 | 250.0 | 160.0 | 0 | 110.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 February 2024 | Disbursement | 200.0 | 0.0 | 0.0 | 0.0 | 0.0 | 200.0 | + | 01 February 2024 | Down Payment | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 150.0 | + | 02 February 2024 | Payout Refund | 200.0 | 150.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 02 February 2024 | Disbursement | 160.0 | 0.0 | 0.0 | 0.0 | 0.0 | 110.0 | + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + + @TestRailId:C3049 @AdvancedPaymentAllocation + Scenario: Verify that second disbursement on overpaid loan is correct when disbursement amount is lower than overpayment amount + When Admin sets the business date to "01 February 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "REAMORTIZATION" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 February 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 February 2024" with "1000" amount and expected disbursement date on "01 February 2024" + When Admin successfully disburse the loan on "01 February 2024" with "200" EUR transaction amount + When Admin sets the business date to "02 February 2024" + When Customer makes "PAYOUT_REFUND" transaction with "AUTOPAY" payment type on "02 February 2024" with 200 EUR transaction amount and system-generated Idempotency key + Then Loan status will be "OVERPAID" + Then Loan has 50 overpaid amount + When Admin successfully disburse the loan on "02 February 2024" with "28" EUR transaction amount + Then Loan Repayment schedule has 5 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 February 2024 | | 200.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 February 2024 | 01 February 2024 | 150.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | + | | | 02 February 2024 | | 28.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 02 February 2024 | 02 February 2024 | 171.0 | 7.0 | 0.0 | 0.0 | 0.0 | 7.0 | 7.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 16 February 2024 | 02 February 2024 | 114.0 | 57.0 | 0.0 | 0.0 | 0.0 | 57.0 | 57.0 | 57.0 | 0.0 | 0.0 | + | 4 | 15 | 02 March 2024 | 02 February 2024 | 57.0 | 57.0 | 0.0 | 0.0 | 0.0 | 57.0 | 57.0 | 57.0 | 0.0 | 0.0 | + | 5 | 15 | 17 March 2024 | 02 February 2024 | 0.0 | 57.0 | 0.0 | 0.0 | 0.0 | 57.0 | 57.0 | 57.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 228.0 | 0 | 0.0 | 0 | 228.0 | 228.0 | 171.0 | 0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 February 2024 | Disbursement | 200.0 | 0.0 | 0.0 | 0.0 | 0.0 | 200.0 | + | 01 February 2024 | Down Payment | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 150.0 | + | 02 February 2024 | Payout Refund | 200.0 | 150.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 02 February 2024 | Disbursement | 28.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + Then Loan status will be "OVERPAID" + Then Loan has 22 overpaid amount + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + + @TestRailId:C3068 @AdvancedPaymentAllocation + Scenario: Verify that Fraud flag can be applied on loan is its every status + When Admin sets the business date to "01 February 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 February 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + Then Loan status will be "SUBMITTED_AND_PENDING_APPROVAL" + Then Admin can successfully set Fraud flag to the loan + Then Admin can successfully unset Fraud flag to the loan + And Admin successfully approves the loan on "01 February 2024" with "1000" amount and expected disbursement date on "01 February 2024" + Then Loan status will be "APPROVED" + Then Admin can successfully set Fraud flag to the loan + Then Admin can successfully unset Fraud flag to the loan + When Admin successfully disburse the loan on "01 February 2024" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + Then Admin can successfully set Fraud flag to the loan + Then Admin can successfully unset Fraud flag to the loan + When Admin sets the business date to "02 February 2024" + And Customer makes "AUTOPAY" repayment on "02 February 2024" with 100 EUR transaction amount + Then Loan status will be "ACTIVE" + Then Admin can successfully set Fraud flag to the loan + Then Admin can successfully unset Fraud flag to the loan + When Admin sets the business date to "03 February 2024" + And Customer makes "AUTOPAY" repayment on "03 February 2024" with 750 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 100 overpaid amount + Then Admin can successfully set Fraud flag to the loan + Then Admin can successfully unset Fraud flag to the loan + When Admin sets the business date to "04 February 2024" + When Customer undo "1"th "Repayment" transaction made on "02 February 2024" + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Admin can successfully set Fraud flag to the loan + Then Admin can successfully unset Fraud flag to the loan + + @TestRailId:C3090 + Scenario: Verify that disbursement can be done on overpaid loan in case of cummulative loan schedule + When Admin sets the business date to "01 February 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 February 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 February 2024" with "1000" amount and expected disbursement date on "01 February 2024" + When Admin successfully disburse the loan on "01 February 2024" with "1000" EUR transaction amount + When Admin sets the business date to "02 February 2024" + And Customer makes "AUTOPAY" repayment on "02 February 2024" with 800 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 50 overpaid amount + When Admin sets the business date to "03 February 2024" + When Admin successfully disburse the loan on "03 February 2024" with "20" EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 30 overpaid amount + Then Loan Repayment schedule has 5 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 February 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 February 2024 | 01 February 2024 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 03 February 2024 | | 20.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 03 February 2024 | 02 February 2024 | 765.0 | 5.0 | 0.0 | 0.0 | 0.0 | 5.0 | 5.0 | 5.0 | 0.0 | 0.0 | + | 3 | 29 | 01 March 2024 | 02 February 2024 | 510.0 | 255.0 | 0.0 | 0.0 | 0.0 | 255.0 | 255.0 | 255.0 | 0.0 | 0.0 | + | 4 | 31 | 01 April 2024 | 02 February 2024 | 255.0 | 255.0 | 0.0 | 0.0 | 0.0 | 255.0 | 255.0 | 255.0 | 0.0 | 0.0 | + | 5 | 30 | 01 May 2024 | 02 February 2024 | 0.0 | 255.0 | 0.0 | 0.0 | 0.0 | 255.0 | 255.0 | 255.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1020.0 | 0 | 0.0 | 0 | 1020.0 | 1020.0 | 770.0 | 0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 February 2024 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 February 2024 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 02 February 2024 | Repayment | 800.0 | 770.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 03 February 2024 | Disbursement | 20.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + When Admin sets the business date to "04 February 2024" + When Admin successfully disburse the loan on "04 February 2024" with "30" EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + 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 | + | | | 01 February 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 February 2024 | 01 February 2024 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 03 February 2024 | | 20.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 03 February 2024 | 02 February 2024 | 765.0 | 5.0 | 0.0 | 0.0 | 0.0 | 5.0 | 5.0 | 5.0 | 0.0 | 0.0 | + | | | 04 February 2024 | | 30.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 3 | 0 | 04 February 2024 | 02 February 2024 | 787.0 | 8.0 | 0.0 | 0.0 | 0.0 | 8.0 | 8.0 | 8.0 | 0.0 | 0.0 | + | 4 | 29 | 01 March 2024 | 02 February 2024 | 525.0 | 262.0 | 0.0 | 0.0 | 0.0 | 262.0 | 262.0 | 262.0 | 0.0 | 0.0 | + | 5 | 31 | 01 April 2024 | 02 February 2024 | 263.0 | 262.0 | 0.0 | 0.0 | 0.0 | 262.0 | 262.0 | 262.0 | 0.0 | 0.0 | + | 6 | 30 | 01 May 2024 | 02 February 2024 | 0.0 | 263.0 | 0.0 | 0.0 | 0.0 | 263.0 | 263.0 | 263.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1050.0 | 0 | 0.0 | 0 | 1050.0 | 1050.0 | 800.0 | 0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 February 2024 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 February 2024 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 02 February 2024 | Repayment | 800.0 | 800.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 03 February 2024 | Disbursement | 20.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 04 February 2024 | Disbursement | 30.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + When Admin sets the business date to "05 February 2024" + When Admin successfully disburse the loan on "05 February 2024" with "40" EUR transaction amount + Then Loan status will be "ACTIVE" + Then Loan has 30 outstanding amount + Then Loan Repayment schedule has 7 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 February 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 February 2024 | 01 February 2024 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 03 February 2024 | | 20.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 03 February 2024 | 02 February 2024 | 765.0 | 5.0 | 0.0 | 0.0 | 0.0 | 5.0 | 5.0 | 5.0 | 0.0 | 0.0 | + | | | 04 February 2024 | | 30.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 3 | 0 | 04 February 2024 | 02 February 2024 | 787.0 | 8.0 | 0.0 | 0.0 | 0.0 | 8.0 | 8.0 | 8.0 | 0.0 | 0.0 | + | | | 05 February 2024 | | 40.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 4 | 0 | 05 February 2024 | 02 February 2024 | 817.0 | 10.0 | 0.0 | 0.0 | 0.0 | 10.0 | 10.0 | 10.0 | 0.0 | 0.0 | + | 5 | 29 | 01 March 2024 | 02 February 2024 | 545.0 | 272.0 | 0.0 | 0.0 | 0.0 | 272.0 | 272.0 | 272.0 | 0.0 | 0.0 | + | 6 | 31 | 01 April 2024 | 02 February 2024 | 273.0 | 272.0 | 0.0 | 0.0 | 0.0 | 272.0 | 272.0 | 272.0 | 0.0 | 0.0 | + | 7 | 30 | 01 May 2024 | | 0.0 | 273.0 | 0.0 | 0.0 | 0.0 | 273.0 | 243.0 | 243.0 | 0.0 | 30.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1090.0 | 0 | 0.0 | 0 | 1090.0 | 1060.0 | 810.0 | 0 | 30.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 February 2024 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 February 2024 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 02 February 2024 | Repayment | 800.0 | 800.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 03 February 2024 | Disbursement | 20.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 04 February 2024 | Disbursement | 30.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 05 February 2024 | Disbursement | 40.0 | 0.0 | 0.0 | 0.0 | 0.0 | 40.0 | + | 05 February 2024 | Down Payment | 10.0 | 10.0 | 0.0 | 0.0 | 0.0 | 30.0 | + + @TestRailId:C3103 + Scenario: Verify that fixed length in loan product is inherited by loan account + When Admin sets the business date to "01 February 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_FIXED_LENGTH | 01 February 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 February 2024" with "1000" amount and expected disbursement date on "01 February 2024" + When Admin successfully disburse the loan on "01 February 2024" with "1000" EUR transaction amount + Then LoanDetails has fixedLength field with int value: 90 + + @TestRailId:C3104 + Scenario: Verify that fixed legnth in loan product can be overwrote upon loan account creation + When Admin sets the business date to "01 February 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + When Admin creates a fully customized loan with fixed length 60 and 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_FIXED_LENGTH | 01 February 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 February 2024" with "1000" amount and expected disbursement date on "01 February 2024" + When Admin successfully disburse the loan on "01 February 2024" with "1000" EUR transaction amount + Then LoanDetails has fixedLength field with int value: 60 diff --git a/fineract-e2e-tests-runner/src/test/resources/features/LoanAccrualTransaction.feature b/fineract-e2e-tests-runner/src/test/resources/features/LoanAccrualTransaction.feature new file mode 100644 index 00000000000..945f9d8ce42 --- /dev/null +++ b/fineract-e2e-tests-runner/src/test/resources/features/LoanAccrualTransaction.feature @@ -0,0 +1,844 @@ +@LoanAccrualFeature +Feature: LoanAccrualTransaction + + @TestRailId:C2647 + Scenario: Verify that after COB job Accrual event is raised when loan has a fee-charge on disbursal date + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "01 January 2023" due date and 10 EUR transaction amount + When Admin sets the business date to "02 January 2023" + When Admin runs inline COB job for Loan + Then Loan Transactions tab has a transaction with date: "01 January 2023", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + Then LoanAccrualTransactionCreatedBusinessEvent is raised on "01 January 2023" + + @TestRailId:C2648 + Scenario: Verify that after COB job Accrual event is raised when loan has a fee-charge on disbursal date with partial repayment + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "01 January 2023" due date and 10 EUR transaction amount + And Customer makes "AUTOPAY" repayment on "01 January 2023" with 500 EUR transaction amount + When Admin sets the business date to "02 January 2023" + When Admin runs inline COB job for Loan + Then Loan Transactions tab has a transaction with date: "01 January 2023", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + Then LoanAccrualTransactionCreatedBusinessEvent is raised on "01 January 2023" + + @TestRailId:C2649 + Scenario: Verify that after COB job Accrual event is raised when loan has a fee-charge on disbursal date with full repayment and loan is closed + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "01 January 2023" due date and 10 EUR transaction amount + When Admin sets the business date to "02 January 2023" + And Customer makes "AUTOPAY" repayment on "02 January 2023" with 1010 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan Transactions tab has a transaction with date: "02 January 2023", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + Then LoanAccrualTransactionCreatedBusinessEvent is raised on "02 January 2023" + + @TestRailId:C2650 + Scenario: Verify that after COB job Accrual event is raised when loan has a fee-charge added with chargeback + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "02 January 2023" + And Customer makes "AUTOPAY" repayment on "02 January 2023" with 250 EUR transaction amount + When Admin sets the business date to "03 January 2023" + And Customer makes "AUTOPAY" repayment on "03 January 2023" with 250 EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "04 January 2023" due date and 10 EUR transaction amount + When Admin sets the business date to "04 January 2023" + And Admin runs COB job + When Admin sets the business date to "05 January 2023" + And Customer makes "AUTOPAY" repayment on "05 January 2023" with 510 EUR transaction amount + Then Loan has 0 outstanding amount + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 250 EUR transaction amount for Payment nr. 2 + Then Loan has 250 outstanding amount + Then Loan Transactions tab has a transaction with date: "05 January 2023", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + Then LoanAccrualTransactionCreatedBusinessEvent is raised on "05 January 2023" + + @TestRailId:C2651 + Scenario: Verify that after periodic accrual transaction job accrual event is raised when loan has a fee-charge added with waive charge and undo waive charge + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "01 January 2023", with Principal: "750", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "01 January 2023" with "750" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "750" EUR transaction amount + When Admin sets the business date to "01 February 2023" + And Customer makes "AUTOPAY" repayment on "01 February 2023" with 250 EUR transaction amount + When Admin sets the business date to "01 March 2023" + And Customer makes "AUTOPAY" repayment on "01 March 2023" with 250 EUR transaction amount + When Admin sets the business date to "01 April 2023" + And Customer makes "AUTOPAY" repayment on "01 April 2023" with 250 EUR transaction amount + When Customer makes a repayment undo on "01 April 2023" + When Admin sets the business date to "05 April 2023" + And Admin adds an NSF fee because of payment bounce with "05 April 2023" transaction date + When Admin sets the business date to "07 April 2023" + And Admin waives charge + When Admin sets the business date to "08 April 2023" + And Admin makes waive undone for charge + Then Loan status will be "ACTIVE" + Then Loan has 260 outstanding amount + And Admin runs the Add Periodic Accrual Transactions job + Then Loan Transactions tab has a transaction with date: "05 April 2023", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Accrual | 10.0 | 0.0 | 0.0 | 0.0 | 10.0 | 0.0 | + Then LoanAccrualTransactionCreatedBusinessEvent is raised on "05 April 2023" + + @TestRailId:C2652 + Scenario: Verify that after periodic accrual transaction job accrual event is raised when loan has a fee-charge added when loan is closed + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "02 January 2023" + And Customer makes "AUTOPAY" repayment on "02 January 2023" with 1000 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "02 January 2023" due date and 10 EUR transaction amount + And Admin runs the Add Periodic Accrual Transactions job + Then Loan Transactions tab has a transaction with date: "02 January 2023", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + Then LoanAccrualTransactionCreatedBusinessEvent is raised on "02 January 2023" + + @TestRailId:C2653 + Scenario: Verify that after disbursement and COB job Accrual event is raised when loan has a interest recalculation + When Admin sets the business date to "01 January 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 | + | PIN30_INTEREST_DECLINING_BALANCE_DAILY_RECALCULATION_COMPOUNDING_NONE | 01 January 2023 | 5000 | 12 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "01 January 2023" with "5000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "5000" EUR transaction amount + When Admin sets the business date to "02 January 2023" + When Admin runs the Add Periodic Accrual Transactions job + Then Loan Transactions tab has a transaction with date: "02 January 2023", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Accrual | 1.64 | 0.0 | 1.64 | 0.0 | 0.0 | 0.0 | + Then LoanAccrualTransactionCreatedBusinessEvent is raised on "02 January 2023" + + @TestRailId:C2654 + Scenario: Verify that after loan is closed accrual event is raised when loan has a interest recalculation + When Admin sets the business date to "01 January 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 | + | PIN30_INTEREST_DECLINING_BALANCE_DAILY_RECALCULATION_COMPOUNDING_NONE | 01 January 2023 | 1000 | 12 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 1 | MONTHS | 1 | MONTHS | 1 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "02 January 2023" + And Customer makes "AUTOPAY" repayment on "02 January 2023" with 1010.19 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan Transactions tab has a transaction with date: "02 January 2023", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Accrual | 10.19 | 0.0 | 10.19 | 0.0 | 0.0 | 0.0 | + Then LoanAccrualTransactionCreatedBusinessEvent is raised on "02 January 2023" + + @TestRailId:C2683 + Scenario: Verify that the final accrual is created when the loan goes to overpaid state + When Admin sets the business date to "1 July 2023" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 July 2023", with Principal: "5000", a loanTermFrequency: 1 months, and numberOfRepayments: 1 + And Admin successfully approves the loan on "1 July 2023" with "5000" amount and expected disbursement date on "1 July 2023" + And Admin successfully disburse the loan on "1 July 2023" with "5000" EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "10 July 2023" due date and 10 EUR transaction amount + When Admin sets the business date to "6 July 2023" + And Customer makes "AUTOPAY" repayment on "6 July 2023" with 5011 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan Repayment schedule has 1 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 July 2023 | | 5000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 August 2023 | 06 July 2023 | 0.0 | 5000.0 | 0.0 | 10.0 | 0.0 | 5010.0 | 5010.0 | 5010.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 5000 | 0 | 10 | 0 | 5010 | 5010 | 5010 | 0 | 0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 July 2023 | Disbursement | 5000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 5000.0 | + | 06 July 2023 | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + | 06 July 2023 | Repayment | 5011.0 | 5000.0 | 0.0 | 10.0 | 0.0 | 0.0 | + + @TestRailId:C2684 + Scenario: Verify that the accrual transaction correctly created in case a CBR is applied on the loan + When Admin sets the business date to "1 July 2023" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 July 2023", with Principal: "5000", a loanTermFrequency: 1 months, and numberOfRepayments: 1 + And Admin successfully approves the loan on "1 July 2023" with "5000" amount and expected disbursement date on "1 July 2023" + And Admin successfully disburse the loan on "1 July 2023" with "5000" EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "10 July 2023" due date and 10 EUR transaction amount + When Admin sets the business date to "6 July 2023" + And Customer makes "AUTOPAY" repayment on "6 July 2023" with 5011 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan Repayment schedule has 1 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 July 2023 | | 5000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 August 2023 | 06 July 2023 | 0.0 | 5000.0 | 0.0 | 10.0 | 0.0 | 5010.0 | 5010.0 | 5010.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 5000 | 0 | 10 | 0 | 5010 | 5010 | 5010 | 0 | 0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 July 2023 | Disbursement | 5000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 5000.0 | + | 06 July 2023 | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + | 06 July 2023 | Repayment | 5011.0 | 5000.0 | 0.0 | 10.0 | 0.0 | 0.0 | + When Admin makes Credit Balance Refund transaction on "06 July 2023" with 1 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan Repayment schedule has 1 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 July 2023 | | 5000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 August 2023 | 06 July 2023 | 0.0 | 5000.0 | 0.0 | 10.0 | 0.0 | 5010.0 | 5010.0 | 5010.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 5000 | 0 | 10 | 0 | 5010 | 5010 | 5010 | 0 | 0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 July 2023 | Disbursement | 5000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 5000.0 | + | 06 July 2023 | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + | 06 July 2023 | Repayment | 5011.0 | 5000.0 | 0.0 | 10.0 | 0.0 | 0.0 | + | 06 July 2023 | Credit Balance Refund | 1.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + + @TestRailId:C2685 + Scenario: Verify that the accrual transaction correctly created (overpay, undo repayment, overpay) + When Admin sets the business date to "1 July 2023" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 July 2023", with Principal: "5000", a loanTermFrequency: 1 months, and numberOfRepayments: 1 + And Admin successfully approves the loan on "1 July 2023" with "5000" amount and expected disbursement date on "1 July 2023" + And Admin successfully disburse the loan on "1 July 2023" with "5000" EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "10 July 2023" due date and 10 EUR transaction amount + When Admin sets the business date to "5 July 2023" + And Customer makes "AUTOPAY" repayment on "5 July 2023" with 1000 EUR transaction amount + When Admin sets the business date to "6 July 2023" + And Customer makes "AUTOPAY" repayment on "6 July 2023" with 4011 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan Repayment schedule has 1 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 July 2023 | | 5000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 August 2023 | 06 July 2023 | 0.0 | 5000.0 | 0.0 | 10.0 | 0.0 | 5010.0 | 5010.0 | 5010.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 5000 | 0 | 10 | 0 | 5010 | 5010 | 5010 | 0 | 0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 July 2023 | Disbursement | 5000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 5000.0 | + | 05 July 2023 | Repayment | 1000.0 | 990.0 | 0.0 | 10.0 | 0.0 | 4010.0 | + | 06 July 2023 | Repayment | 4011.0 | 4010.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 06 July 2023 | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + And Customer makes a repayment undo on "6 July 2023" + Then Loan status will be "ACTIVE" + When Admin sets the business date to "7 July 2023" + And Customer makes "AUTOPAY" repayment on "7 July 2023" with 4011 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan Repayment schedule has 1 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 July 2023 | | 5000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 August 2023 | 07 July 2023 | 0.0 | 5000.0 | 0.0 | 10.0 | 0.0 | 5010.0 | 5010.0 | 5010.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 5000 | 0 | 10 | 0 | 5010 | 5010 | 5010 | 0 | 0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 July 2023 | Disbursement | 5000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 5000.0 | + | 05 July 2023 | Repayment | 1000.0 | 990.0 | 0.0 | 10.0 | 0.0 | 4010.0 | + | 06 July 2023 | Repayment | 4011.0 | 4010.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 06 July 2023 | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + | 07 July 2023 | Repayment | 4011.0 | 4010.0 | 0.0 | 0.0 | 0.0 | 0.0 | + + @TestRailId:C2686 + Scenario: Verify that the accrual transaction correctly created (overpay, undo repayment, add charge, overpay) + When Admin sets the business date to "1 July 2023" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 July 2023", with Principal: "5000", a loanTermFrequency: 1 months, and numberOfRepayments: 1 + And Admin successfully approves the loan on "1 July 2023" with "5000" amount and expected disbursement date on "1 July 2023" + And Admin successfully disburse the loan on "1 July 2023" with "5000" EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "10 July 2023" due date and 10 EUR transaction amount + When Admin sets the business date to "5 July 2023" + And Customer makes "AUTOPAY" repayment on "5 July 2023" with 1000 EUR transaction amount + When Admin sets the business date to "6 July 2023" + And Customer makes "AUTOPAY" repayment on "6 July 2023" with 4011 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan Repayment schedule has 1 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 July 2023 | | 5000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 August 2023 | 06 July 2023 | 0.0 | 5000.0 | 0.0 | 10.0 | 0.0 | 5010.0 | 5010.0 | 5010.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 5000 | 0 | 10 | 0 | 5010 | 5010 | 5010 | 0 | 0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 July 2023 | Disbursement | 5000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 5000.0 | + | 05 July 2023 | Repayment | 1000.0 | 990.0 | 0.0 | 10.0 | 0.0 | 4010.0 | + | 06 July 2023 | Repayment | 4011.0 | 4010.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 06 July 2023 | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + And Customer makes a repayment undo on "6 July 2023" + Then Loan status will be "ACTIVE" + When Admin sets the business date to "7 July 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "20 July 2023" due date and 50 EUR transaction amount + And Customer makes "AUTOPAY" repayment on "7 July 2023" with 4061 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan Repayment schedule has 1 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 July 2023 | | 5000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 August 2023 | 07 July 2023 | 0.0 | 5000.0 | 0.0 | 60.0 | 0.0 | 5060.0 | 5060.0 | 5060.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 5000 | 0 | 60 | 0 | 5060 | 5060 | 5060 | 0 | 0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 July 2023 | Disbursement | 5000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 5000.0 | + | 05 July 2023 | Repayment | 1000.0 | 940.0 | 0.0 | 60.0 | 0.0 | 4060.0 | + | 06 July 2023 | Repayment | 4011.0 | 4010.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 06 July 2023 | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + | 07 July 2023 | Repayment | 4061.0 | 4060.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 07 July 2023 | Accrual | 50.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | + + @TestRailId:C2707 @Skip + Scenario: Verify that the accrual transaction is not reversed when multi disbursement happens + When Admin sets the business date to "26 April 2023" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "26 April 2023", with Principal: "1000", a loanTermFrequency: 1 months, and numberOfRepayments: 1 + And Admin successfully approves the loan on "26 April 2023" with "1000" amount and expected disbursement date on "1 May 2023" + And Admin successfully disburse the loan on "26 April 2023" with "1000" EUR transaction amount + Then Loan has 1000 outstanding amount + When Admin sets the business date to "27 April 2023" + And Admin successfully disburse the loan on "27 April 2023" with "30" EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "27 April 2023" due date and 10 EUR transaction amount + When Admin sets the business date to "28 April 2023" + And Admin runs COB job + And Admin successfully disburse the loan on "28 April 2023" with "20" EUR transaction amount + When Admin sets the business date to "29 April 2023" + And Admin runs COB job + Then Loan Repayment schedule has 1 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 | + | | | 26 April 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | | | 27 April 2023 | | 30.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | | | 28 April 2023 | | 20.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 26 May 2023 | | 0.0 | 1050.0 | 0.0 | 10.0 | 0.0 | 1060.0 | 0.0 | 0.0 | 0.0 | 1060.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1050 | 0 | 10 | 0 | 1060 | 0 | 0 | 0 | 1060 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 26 April 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 27 April 2023 | Disbursement | 30.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1030.0 | + | 27 April 2023 | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + | 28 April 2023 | Disbursement | 20.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1050.0 | + + @TestRailId:C2708 @Skip + Scenario: Verify that the accrual is correct when it is on the installment start date + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 May 2023", with Principal: "1000", a loanTermFrequency: 1 months, and numberOfRepayments: 1 + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + And Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan has 1000 outstanding amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "1 May 2023" due date and 10 EUR transaction amount + When Admin sets the business date to "2 May 2023" + And Admin runs COB job + When Admin sets the business date to "8 May 2023" + And Admin successfully disburse the loan on "8 May 2023" with "20" EUR transaction amount + Then Loan Repayment schedule has 1 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 May 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | | | 08 May 2023 | | 20.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 June 2023 | | 0.0 | 1020.0 | 0.0 | 10.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1020 | 0 | 10 | 0 | 1030 | 0 | 0 | 0 | 1030 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 May 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 May 2023 | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + | 08 May 2023 | Disbursement | 20.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1020.0 | + + @TestRailId:C2709 + Scenario:Verify that the accrual transaction is created for disbursement fee + When Admin sets the business date to "1 May 2023" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 May 2023", with Principal: "1000", a loanTermFrequency: 1 months, and numberOfRepayments: 1 + And Admin successfully approves the loan on "1 May 2023" with "1000" amount and expected disbursement date on "1 May 2023" + When Admin adds "LOAN_DISBURSEMENT_PERCENTAGE_FEE" charge with 1 % of transaction amount + And Admin successfully disburse the loan on "1 May 2023" with "1000" EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 May 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 May 2023 | Repayment (at time of disbursement) | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 1000.0 | + | 01 May 2023 | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + + @TestRailId:C2710 @Specific + Scenario: Verify global config charge-accrual-date function: single installment loan, charge-accrual-date = submitted-date, multiple charges with different submitted date + When Global config "charge-accrual-date" value set to "submitted-date" + When Admin sets the business date to "01 February 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 February 2023" + And Admin successfully approves the loan on "01 February 2023" with "1000" amount and expected disbursement date on "1 February 2023" + When Admin successfully disburse the loan on "01 February 2023" with "1000" EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "06 February 2023" due date and 10 EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "16 February 2023" due date and 10 EUR transaction amount + When Admin sets the business date to "02 February 2023" + When Admin runs inline COB job for Loan + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 06 February 2023 | Flat | 10.0 | 0.0 | 0.0 | 10.0 | + | Snooze fee | false | Specified due date | 16 February 2023 | Flat | 10.0 | 0.0 | 0.0 | 10.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 February 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 February 2023 | Accrual | 20.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has 1 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 February 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 03 March 2023 | | 0.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 1020.0 | 0.0 | 0.0 | 0.0 | 1020.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20 | 0 | 1020 | 0 | 0 | 0 | 1020 | + When Global config "charge-accrual-date" value set to "due-date" + + @TestRailId:C2711 + Scenario: Verify global config charge-accrual-date function: single installment loan, charge-accrual-date = due-date, multiple charges with different submitted date + When Global config "charge-accrual-date" value set to "due-date" + When Admin sets the business date to "01 February 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 February 2023" + And Admin successfully approves the loan on "01 February 2023" with "1000" amount and expected disbursement date on "1 February 2023" + When Admin successfully disburse the loan on "01 February 2023" with "1000" EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "06 February 2023" due date and 10 EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "16 February 2023" due date and 10 EUR transaction amount + When Admin sets the business date to "07 February 2023" + When Admin runs inline COB job for Loan + When Admin sets the business date to "17 February 2023" + When Admin runs inline COB job for Loan + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 06 February 2023 | Flat | 10.0 | 0.0 | 0.0 | 10.0 | + | Snooze fee | false | Specified due date | 16 February 2023 | Flat | 10.0 | 0.0 | 0.0 | 10.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 February 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 06 February 2023 | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + | 16 February 2023 | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has 1 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 February 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 03 March 2023 | | 0.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 1020.0 | 0.0 | 0.0 | 0.0 | 1020.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20 | 0 | 1020 | 0 | 0 | 0 | 1020 | + When Global config "charge-accrual-date" value set to "due-date" + + @TestRailId:C2712 @Specific + Scenario: Verify global config charge-accrual-date function: multiple installment loan, charge-accrual-date = submitted-date, multiple charges with different submitted date, due dates in same repayment period + When Global config "charge-accrual-date" value set to "submitted-date" + When Admin sets the business date to "01 February 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 | + | PIN30 | 1 February 2023 | 3000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "01 February 2023" with "3000" amount and expected disbursement date on "1 February 2023" + When Admin successfully disburse the loan on "01 February 2023" with "3000" EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "06 February 2023" due date and 10 EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "16 February 2023" due date and 10 EUR transaction amount + When Admin sets the business date to "02 February 2023" + When Admin runs inline COB job for Loan + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 06 February 2023 | Flat | 10.0 | 0.0 | 0.0 | 10.0 | + | Snooze fee | false | Specified due date | 16 February 2023 | Flat | 10.0 | 0.0 | 0.0 | 10.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 February 2023 | Disbursement | 3000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | + | 01 February 2023 | Accrual | 20.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | + 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 February 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 28 | 01 March 2023 | | 2000.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 1020.0 | 0.0 | 0.0 | 0.0 | 1020.0 | + | 2 | 31 | 01 April 2023 | | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 3 | 30 | 01 May 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 0 | 20 | 0 | 3020 | 0 | 0 | 0 | 3020 | + When Global config "charge-accrual-date" value set to "due-date" + + @TestRailId:C2713 + Scenario: Verify global config charge-accrual-date function: multiple installment loan, charge-accrual-date = due-date, multiple charges with different submitted date, due dates in same repayment period + When Global config "charge-accrual-date" value set to "due-date" + When Admin sets the business date to "01 February 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 | + | PIN30 | 1 February 2023 | 3000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "01 February 2023" with "3000" amount and expected disbursement date on "1 February 2023" + When Admin successfully disburse the loan on "01 February 2023" with "3000" EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "06 February 2023" due date and 10 EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "16 February 2023" due date and 10 EUR transaction amount + When Admin sets the business date to "07 February 2023" + When Admin runs inline COB job for Loan + When Admin sets the business date to "17 February 2023" + When Admin runs inline COB job for Loan + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 06 February 2023 | Flat | 10.0 | 0.0 | 0.0 | 10.0 | + | Snooze fee | false | Specified due date | 16 February 2023 | Flat | 10.0 | 0.0 | 0.0 | 10.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 February 2023 | Disbursement | 3000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | + | 06 February 2023 | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + | 16 February 2023 | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + 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 February 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 28 | 01 March 2023 | | 2000.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 1020.0 | 0.0 | 0.0 | 0.0 | 1020.0 | + | 2 | 31 | 01 April 2023 | | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 3 | 30 | 01 May 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 0 | 20 | 0 | 3020 | 0 | 0 | 0 | 3020 | + When Global config "charge-accrual-date" value set to "due-date" + + @TestRailId:C2714 @Specific + Scenario: Verify global config charge-accrual-date function: multiple installment loan, charge-accrual-date = submitted-date, multiple charges with different submitted date, due dates in different repayment periods + When Global config "charge-accrual-date" value set to "submitted-date" + When Admin sets the business date to "01 February 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 | + | PIN30 | 1 February 2023 | 3000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "01 February 2023" with "3000" amount and expected disbursement date on "1 February 2023" + When Admin successfully disburse the loan on "01 February 2023" with "3000" EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "06 February 2023" due date and 10 EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "06 March 2023" due date and 10 EUR transaction amount + When Admin sets the business date to "02 February 2023" + When Admin runs inline COB job for Loan + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 06 February 2023 | Flat | 10.0 | 0.0 | 0.0 | 10.0 | + | Snooze fee | false | Specified due date | 06 March 2023 | Flat | 10.0 | 0.0 | 0.0 | 10.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 February 2023 | Disbursement | 3000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | + | 01 February 2023 | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + | 01 February 2023 | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + 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 February 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 28 | 01 March 2023 | | 2000.0 | 1000.0 | 0.0 | 10.0 | 0.0 | 1010.0 | 0.0 | 0.0 | 0.0 | 1010.0 | + | 2 | 31 | 01 April 2023 | | 1000.0 | 1000.0 | 0.0 | 10.0 | 0.0 | 1010.0 | 0.0 | 0.0 | 0.0 | 1010.0 | + | 3 | 30 | 01 May 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 0 | 20 | 0 | 3020 | 0 | 0 | 0 | 3020 | + When Global config "charge-accrual-date" value set to "due-date" + + @TestRailId:C2715 + Scenario: Verify global config charge-accrual-date function: multiple installment loan, charge-accrual-date = due-date, multiple charges with different submitted date, due dates in different repayment periods + When Global config "charge-accrual-date" value set to "due-date" + When Admin sets the business date to "01 February 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 | + | PIN30 | 1 February 2023 | 3000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "01 February 2023" with "3000" amount and expected disbursement date on "1 February 2023" + When Admin successfully disburse the loan on "01 February 2023" with "3000" EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "06 February 2023" due date and 10 EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "06 March 2023" due date and 10 EUR transaction amount + When Admin sets the business date to "07 February 2023" + When Admin runs inline COB job for Loan + When Admin sets the business date to "07 March 2023" + When Admin runs inline COB job for Loan + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 06 February 2023 | Flat | 10.0 | 0.0 | 0.0 | 10.0 | + | Snooze fee | false | Specified due date | 06 March 2023 | Flat | 10.0 | 0.0 | 0.0 | 10.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 February 2023 | Disbursement | 3000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | + | 06 February 2023 | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + | 06 March 2023 | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + 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 February 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 28 | 01 March 2023 | | 2000.0 | 1000.0 | 0.0 | 10.0 | 0.0 | 1010.0 | 0.0 | 0.0 | 0.0 | 1010.0 | + | 2 | 31 | 01 April 2023 | | 1000.0 | 1000.0 | 0.0 | 10.0 | 0.0 | 1010.0 | 0.0 | 0.0 | 0.0 | 1010.0 | + | 3 | 30 | 01 May 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 0 | 20 | 0 | 3020 | 0 | 0 | 0 | 3020 | + When Global config "charge-accrual-date" value set to "due-date" + + @TestRailId:C2716 @Specific + Scenario: Verify global config charge-accrual-date function: single installment loan, charge-accrual-date = submitted-date, multi disbursement + When Global config "charge-accrual-date" value set to "submitted-date" + When Admin sets the business date to "01 February 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 February 2023" + And Admin successfully approves the loan on "01 February 2023" with "1000" amount and expected disbursement date on "1 February 2023" + When Admin successfully disburse the loan on "01 February 2023" with "500" EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "06 February 2023" due date and 10 EUR transaction amount + When Admin sets the business date to "02 February 2023" + When Admin runs inline COB job for Loan + When Admin sets the business date to "04 February 2023" + When Admin successfully disburse the loan on "04 February 2023" with "500" EUR transaction amount + When Admin runs inline COB job for Loan + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 06 February 2023 | Flat | 10.0 | 0.0 | 0.0 | 10.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 February 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 February 2023 | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + | 04 February 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has 1 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 | + | | | 04 February 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | | | 01 February 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 03 March 2023 | | 0.0 | 1000.0 | 0.0 | 10.0 | 0.0 | 1010.0 | 0.0 | 0.0 | 0.0 | 1010.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 10 | 0 | 1010 | 0 | 0 | 0 | 1010 | + When Global config "charge-accrual-date" value set to "due-date" + + @TestRailId:C2717 @Specific + Scenario: Verify global config charge-accrual-date function: single installment loan, charge-accrual-date = submitted-date, repayment reversal + When Global config "charge-accrual-date" value set to "submitted-date" + When Admin sets the business date to "01 February 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 February 2023" + And Admin successfully approves the loan on "01 February 2023" with "1000" amount and expected disbursement date on "1 February 2023" + When Admin successfully disburse the loan on "01 February 2023" with "1000" EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "06 February 2023" due date and 10 EUR transaction amount + When Admin sets the business date to "02 February 2023" + When Admin runs inline COB job for Loan + When Admin sets the business date to "04 February 2023" + And Customer makes "AUTOPAY" repayment on "04 February 2023" with 500 EUR transaction amount + When Admin runs inline COB job for Loan + When Admin sets the business date to "05 February 2023" + When Customer undo "1"th "Repayment" transaction made on "04 February 2023" + When Admin runs inline COB job for Loan + When Admin sets the business date to "06 February 2023" + When Admin runs inline COB job for Loan + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 06 February 2023 | Flat | 10.0 | 0.0 | 0.0 | 10.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 February 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 February 2023 | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + | 04 February 2023 | Repayment | 500.0 | 490.0 | 0.0 | 10.0 | 0.0 | 510.0 | + Then On Loan Transactions tab the "Repayment" Transaction with date "04 February 2023" is reverted + Then Loan Repayment schedule has 1 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 February 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 03 March 2023 | | 0.0 | 1000.0 | 0.0 | 10.0 | 0.0 | 1010.0 | 0.0 | 0.0 | 0.0 | 1010.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 10 | 0 | 1010 | 0 | 0 | 0 | 1010 | + When Global config "charge-accrual-date" value set to "due-date" + + @TestRailId:C2718 @Specific + Scenario: Verify global config charge-accrual-date function: single installment loan, charge-accrual-date = submitted-date, waive charge, undo waive + When Global config "charge-accrual-date" value set to "submitted-date" + When Admin sets the business date to "01 February 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 February 2023" + And Admin successfully approves the loan on "01 February 2023" with "1000" amount and expected disbursement date on "1 February 2023" + When Admin successfully disburse the loan on "01 February 2023" with "1000" EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "06 February 2023" due date and 10 EUR transaction amount + When Admin sets the business date to "02 February 2023" + When Admin runs inline COB job for Loan + When Admin sets the business date to "04 February 2023" + And Admin waives due date charge + When Admin runs inline COB job for Loan + When Admin sets the business date to "05 February 2023" + And Admin makes waive undone for charge + When Admin runs inline COB job for Loan + When Admin sets the business date to "06 February 2023" + When Admin runs inline COB job for Loan + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 06 February 2023 | Flat | 10.0 | 0.0 | 0.0 | 10.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 February 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 February 2023 | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + | 04 February 2023 | Waive loan charges | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 1000.0 | + Then On Loan Transactions tab the "Waive loan charges" Transaction with date "04 February 2023" is reverted + Then Loan Repayment schedule has 1 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 February 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 03 March 2023 | | 0.0 | 1000.0 | 0.0 | 10.0 | 0.0 | 1010.0 | 0.0 | 0.0 | 0.0 | 1010.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 10 | 0 | 1010 | 0 | 0 | 0 | 1010 | + When Global config "charge-accrual-date" value set to "due-date" + + @TestRailId:C2719 @Specific + Scenario: Verify global config charge-accrual-date function: multiple installment loan, charge-accrual-date = submitted-date, multi disbursement + When Global config "charge-accrual-date" value set to "submitted-date" + When Admin sets the business date to "01 February 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 | + | PIN30 | 1 February 2023 | 3000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "01 February 2023" with "3000" amount and expected disbursement date on "1 February 2023" + When Admin successfully disburse the loan on "01 February 2023" with "2000" EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "06 March 2023" due date and 10 EUR transaction amount + When Admin sets the business date to "02 February 2023" + When Admin runs inline COB job for Loan + When Admin sets the business date to "04 February 2023" + When Admin successfully disburse the loan on "04 February 2023" with "1000" EUR transaction amount + When Admin runs inline COB job for Loan + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 06 March 2023 | Flat | 10.0 | 0.0 | 0.0 | 10.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 February 2023 | Disbursement | 2000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 2000.0 | + | 01 February 2023 | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + | 04 February 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | + 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 February 2023 | | 2000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | | | 04 February 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 28 | 01 March 2023 | | 2000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 2 | 31 | 01 April 2023 | | 1000.0 | 1000.0 | 0.0 | 10.0 | 0.0 | 1010.0 | 0.0 | 0.0 | 0.0 | 1010.0 | + | 3 | 30 | 01 May 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 0 | 10 | 0 | 3010 | 0 | 0 | 0 | 3010 | + When Global config "charge-accrual-date" value set to "due-date" + + @TestRailId:C2720 @Specific + Scenario: Verify global config charge-accrual-date function: multiple installment loan, charge-accrual-date = submitted-date, repayment reversal + When Global config "charge-accrual-date" value set to "submitted-date" + When Admin sets the business date to "01 February 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 | + | PIN30 | 1 February 2023 | 3000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "01 February 2023" with "3000" amount and expected disbursement date on "1 February 2023" + When Admin successfully disburse the loan on "01 February 2023" with "3000" EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "06 March 2023" due date and 10 EUR transaction amount + When Admin sets the business date to "02 February 2023" + When Admin runs inline COB job for Loan + When Admin sets the business date to "04 February 2023" + And Customer makes "AUTOPAY" repayment on "04 February 2023" with 500 EUR transaction amount + When Admin runs inline COB job for Loan + When Admin sets the business date to "05 February 2023" + When Customer undo "1"th "Repayment" transaction made on "04 February 2023" + When Admin runs inline COB job for Loan + When Admin sets the business date to "06 February 2023" + When Admin runs inline COB job for Loan + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 06 March 2023 | Flat | 10.0 | 0.0 | 0.0 | 10.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 February 2023 | Disbursement | 3000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | + | 01 February 2023 | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + | 04 February 2023 | Repayment | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 2500.0 | + Then On Loan Transactions tab the "Repayment" Transaction with date "04 February 2023" is reverted + 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 February 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 28 | 01 March 2023 | | 2000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 2 | 31 | 01 April 2023 | | 1000.0 | 1000.0 | 0.0 | 10.0 | 0.0 | 1010.0 | 0.0 | 0.0 | 0.0 | 1010.0 | + | 3 | 30 | 01 May 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 0 | 10 | 0 | 3010 | 0 | 0 | 0 | 3010 | + When Global config "charge-accrual-date" value set to "due-date" + + @TestRailId:C2721 @Specific + Scenario: Verify global config charge-accrual-date function: multiple installment loan, charge-accrual-date = submitted-date, waive charge, undo waive + When Global config "charge-accrual-date" value set to "submitted-date" + When Admin sets the business date to "01 February 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 | + | PIN30 | 1 February 2023 | 3000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "01 February 2023" with "3000" amount and expected disbursement date on "1 February 2023" + When Admin successfully disburse the loan on "01 February 2023" with "3000" EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "06 March 2023" due date and 10 EUR transaction amount + When Admin sets the business date to "02 February 2023" + When Admin runs inline COB job for Loan + When Admin sets the business date to "04 February 2023" + And Admin waives due date charge + When Admin runs inline COB job for Loan + When Admin sets the business date to "05 February 2023" + And Admin makes waive undone for charge + When Admin runs inline COB job for Loan + When Admin sets the business date to "06 February 2023" + When Admin runs inline COB job for Loan + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 06 March 2023 | Flat | 10.0 | 0.0 | 0.0 | 10.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 February 2023 | Disbursement | 3000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | + | 01 February 2023 | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + | 04 February 2023 | Waive loan charges | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 3000.0 | + Then On Loan Transactions tab the "Waive loan charges" Transaction with date "04 February 2023" is reverted + 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 February 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 28 | 01 March 2023 | | 2000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 2 | 31 | 01 April 2023 | | 1000.0 | 1000.0 | 0.0 | 10.0 | 0.0 | 1010.0 | 0.0 | 0.0 | 0.0 | 1010.0 | + | 3 | 30 | 01 May 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 0 | 10 | 0 | 3010 | 0 | 0 | 0 | 3010 | + When Global config "charge-accrual-date" value set to "due-date" + + + @TestRailId:C2789 @Specific + Scenario: Verify accrual transaction for new fee for loan with accrued snooze fee and schedule adjustment + When Global config "charge-accrual-date" value set to "submitted-date" + When Admin sets the business date to "19 May 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 | + | PIN30 | 19 May 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 30 | DAYS | 30 | DAYS | 1 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "19 May 2023" with "1000" amount and expected disbursement date on "19 May 2023" + When Admin successfully disburse the loan on "19 May 2023" with "1000" EUR transaction amount + When Admin sets the business date to "12 June 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "18 July 2023" due date and 10 EUR transaction amount + When Batch API call with steps: rescheduleLoan from "18 June 2023" to "18 July 2023" submitted on date: "19 May 2023", approveReschedule on date: "19 May 2023" runs with enclosingTransaction: "true" + When Admin sets the business date to "13 June 2023" + When Admin runs inline COB job for Loan + Then Loan Transactions tab has a transaction with date: "12 June 2023", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + When Admin sets the business date to "18 July 2023" + And Customer makes "AUTOPAY" repayment on "18 July 2023" with 1010 EUR transaction amount + When Admin sets the business date to "19 July 2023" + When Customer makes a repayment undo on "19 July 2023" + When Admin adds "LOAN_NSF_FEE" due date charge with "19 July 2023" due date and 10 EUR transaction amount + When Admin sets the business date to "20 July 2023" + When Admin runs inline COB job for Loan + Then Loan Transactions tab has a transaction with date: "19 July 2023", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Accrual | 10.0 | 0.0 | 0.0 | 0.0 | 10.0 | 0.0 | + Then Loan Repayment schedule has 2 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 | + | | | 19 May 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 60 | 18 July 2023 | | 0.0 | 1000.0 | 0.0 | 10.0 | 0.0 | 1010.0 | 0.0 | 0.0 | 0.0 | 1010.0 | + | 2 | 1 | 19 July 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 10.0 | 10.0 | 0.0 | 0.0 | 0.0 | 10.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 10 | 10 | 1020 | 0 | 0 | 0 | 1020 | + When Global config "charge-accrual-date" value set to "due-date" diff --git a/fineract-e2e-tests-runner/src/test/resources/features/LoanCBR.feature b/fineract-e2e-tests-runner/src/test/resources/features/LoanCBR.feature new file mode 100644 index 00000000000..6445e8eb39f --- /dev/null +++ b/fineract-e2e-tests-runner/src/test/resources/features/LoanCBR.feature @@ -0,0 +1,1540 @@ +@LoanCBR +Feature: Credit Balance Refund + + @TestRailId:C2505 + Scenario: Verify that Loan status goes from overpaid to active in case of CBR transaction (with replaying when CBR>new balance → clears overpaid, remaining increasing loan balance) + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "03 January 2023" + And Customer makes "AUTOPAY" repayment on "03 January 2023" with 100 EUR transaction amount + When Admin sets the business date to "05 January 2023" + And Customer makes "AUTOPAY" repayment on "05 January 2023" with 500 EUR transaction amount + And Customer makes "AUTOPAY" repayment on "05 January 2023" with 600 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 0 outstanding amount + Then Loan has 200 overpaid amount + When Admin sets the business date to "07 January 2023" + When Admin makes Credit Balance Refund transaction on "07 January 2023" with 200 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + When Customer undo "1"th repayment on "3 January 2023" + Then Loan status will be "ACTIVE" + Then Loan has 100 outstanding amount + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "03 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 100.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 100.0 | | + | ASSET | 112601 | Loans Receivable | 100.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 100.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "05 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 500.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "05 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 500.0 | + | LIABILITY | l1 | Overpayment account | | 100.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 600.0 | | + Then Loan Transactions tab has a "CREDIT_BALANCE_REFUND" transaction with date "07 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 100.0 | | + | LIABILITY | l1 | Overpayment account | 100.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 200.0 | + + @TestRailId:C2511 + Scenario: Verify that Loan status goes from overpaid to closed in case of CBR transaction when transaction amount equals overpaid amount + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "3 January 2023" + And Customer makes "AUTOPAY" repayment on "3 January 2023" with 450 EUR transaction amount + When Admin sets the business date to "5 January 2023" + And Customer makes "AUTOPAY" repayment on "5 January 2023" with 450 EUR transaction amount + And Customer makes "AUTOPAY" repayment on "5 January 2023" with 300 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 0 outstanding amount + Then Loan has 200 overpaid amount + When Admin makes Credit Balance Refund transaction on "5 January 2023" with 200 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "03 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 450.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 450.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "05 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 450.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 450.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "05 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 100.0 | + | LIABILITY | l1 | Overpayment account | | 200.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 300.0 | | + Then Loan Transactions tab has a "CREDIT_BALANCE_REFUND" transaction with date "05 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | LIABILITY | l1 | Overpayment account | 200.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 200.0 | + + @TestRailId:C2515 + Scenario: Single repayment reversal + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "10 January 2023" + And Customer makes "AUTOPAY" repayment on "10 January 2023" with 1200 EUR transaction amount + When Admin sets the business date to "11 January 2023" + And Admin makes Credit Balance Refund transaction on "11 January 2023" with 200 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + When Customer undo "1"th repayment on "10 January 2023" + Then Loan status will be "ACTIVE" + Then Loan has 1200 outstanding amount + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "10 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | LIABILITY | l1 | Overpayment account | | 200.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 1200.0 | | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | l1 | Overpayment account | 200.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1200.0 | + Then Loan Transactions tab has a "CREDIT_BALANCE_REFUND" transaction with date "11 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 200.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 200.0 | + + + @TestRailId:C2516 + Scenario: Multi repayment reversal + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "10 January 2023" + And Customer makes "AUTOPAY" repayment on "10 January 2023" with 500 EUR transaction amount + When Admin sets the business date to "11 January 2023" + And Customer makes "AUTOPAY" repayment on "11 January 2023" with 700 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan has 200 overpaid amount + When Admin sets the business date to "13 January 2023" + And Admin makes Credit Balance Refund transaction on "13 January 2023" with 200 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + When Customer undo "1"th repayment on "10 January 2023" + Then Loan status will be "ACTIVE" + Then Loan has 500 outstanding amount + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "10 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 500.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | + | ASSET | 112601 | Loans Receivable | 500.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 500.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "11 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 700.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 700.0 | | + Then Loan Transactions tab has a "CREDIT_BALANCE_REFUND" transaction with date "13 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 200.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 200.0 | + + @TestRailId:C2517 + Scenario: Overpaid paid portion + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "10 January 2023" + And Customer makes "AUTOPAY" repayment on "10 January 2023" with 100 EUR transaction amount + When Admin sets the business date to "11 January 2023" + And Customer makes "AUTOPAY" repayment on "11 January 2023" with 1100 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan has 200 overpaid amount + When Admin sets the business date to "13 January 2023" + And Admin makes Credit Balance Refund transaction on "13 January 2023" with 200 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + When Customer undo "1"th repayment on "10 January 2023" + Then Loan status will be "ACTIVE" + Then Loan has 100 outstanding amount + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "10 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 100.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 100.0 | | + | ASSET | 112601 | Loans Receivable | 100.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 100.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "11 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | LIABILITY | l1 | Overpayment account | | 100.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 1100.0 | | + Then Loan Transactions tab has a "CREDIT_BALANCE_REFUND" transaction with date "13 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 100.0 | | + | LIABILITY | l1 | Overpayment account | 100.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 200.0 | + + @TestRailId:C2518 + Scenario: Repayment reversal + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "10 January 2023" + And Customer makes "AUTOPAY" repayment on "10 January 2023" with 1000 EUR transaction amount + When Admin sets the business date to "11 January 2023" + And Admin makes "PAYOUT_REFUND" transaction with "AUTOPAY" payment type on "11 January 2023" with 1000 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan has 1000 overpaid amount + When Admin sets the business date to "13 January 2023" + And Admin makes Credit Balance Refund transaction on "13 January 2023" with 1000 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + When Customer undo "1"th repayment on "10 January 2023" + Then Loan status will be "ACTIVE" + Then Loan has 1000 outstanding amount + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "10 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 1000.0 | | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "PAYOUT_REFUND" transaction with date "11 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 1000.0 | | + Then Loan Transactions tab has a "CREDIT_BALANCE_REFUND" transaction with date "13 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + + @TestRailId:C2519 + Scenario: Refund reversal + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "10 January 2023" + And Customer makes "AUTOPAY" repayment on "10 January 2023" with 1000 EUR transaction amount + When Admin sets the business date to "11 January 2023" + And Refund happens on "11 January 2023" with 1000 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan has 1000 overpaid amount + When Admin sets the business date to "13 January 2023" + And Admin makes Credit Balance Refund transaction on "13 January 2023" with 1000 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + When Refund undo happens on "13 January 2023" + Then Loan status will be "ACTIVE" + Then Loan has 1000 outstanding amount + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "10 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 1000.0 | | + Then Loan Transactions tab has a "PAYOUT_REFUND" transaction with date "11 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | LIABILITY | l1 | Overpayment account | | 1000.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 1000.0 | | + | LIABILITY | l1 | Overpayment account | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "CREDIT_BALANCE_REFUND" transaction with date "13 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + + @TestRailId:C2520 + Scenario: Partial refund reversal + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "10 January 2023" + And Customer makes "AUTOPAY" repayment on "10 January 2023" with 1000 EUR transaction amount + When Admin sets the business date to "11 January 2023" + And Refund happens on "11 January 2023" with 500 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan has 500 overpaid amount + When Admin sets the business date to "13 January 2023" + And Admin makes Credit Balance Refund transaction on "13 January 2023" with 500 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + When Refund undo happens on "13 January 2023" + Then Loan status will be "ACTIVE" + Then Loan has 500 outstanding amount + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "10 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 1000.0 | | + Then Loan Transactions tab has a "PAYOUT_REFUND" transaction with date "11 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | LIABILITY | l1 | Overpayment account | | 500.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | + | LIABILITY | l1 | Overpayment account | 500.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 500.0 | + Then Loan Transactions tab has a "CREDIT_BALANCE_REFUND" transaction with date "13 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 500.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 500.0 | + + @TestRailId:C2521 + Scenario: Chargeback after CBR + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "10 January 2023" + And Customer makes "AUTOPAY" repayment on "10 January 2023" with 500 EUR transaction amount + When Admin sets the business date to "11 January 2023" + And Customer makes "AUTOPAY" repayment on "11 January 2023" with 700 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan has 200 overpaid amount + When Admin sets the business date to "13 January 2023" + And Admin makes Credit Balance Refund transaction on "13 January 2023" with 200 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + When Admin sets the business date to "15 January 2023" + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 500 EUR transaction amount for Payment nr. 1 + Then Loan status will be "ACTIVE" + Then Loan has 500 outstanding amount + When Customer undo "2"th repayment on "11 January 2023" + Then Loan status will be "ACTIVE" + Then Loan has 1200 outstanding amount + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "10 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 500.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "11 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 500.0 | + | LIABILITY | l1 | Overpayment account | | 200.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 700.0 | | + | ASSET | 112601 | Loans Receivable | 500.0 | | + | LIABILITY | l1 | Overpayment account | 200.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 700.0 | + Then Loan Transactions tab has a "CREDIT_BALANCE_REFUND" transaction with date "13 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 200.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 200.0 | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "15 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 500.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 500.0 | + + @TestRailId:C2522 + Scenario: Refund after CBR scenario + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "10 January 2023" + And Customer makes "AUTOPAY" repayment on "10 January 2023" with 500 EUR transaction amount + When Admin sets the business date to "11 January 2023" + And Customer makes "AUTOPAY" repayment on "11 January 2023" with 700 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan has 200 overpaid amount + When Admin sets the business date to "13 January 2023" + And Admin makes Credit Balance Refund transaction on "13 January 2023" with 200 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + When Admin sets the business date to "15 January 2023" + And Refund happens on "15 January 2023" with 500 EUR transaction amount + When Admin sets the business date to "17 January 2023" + And Admin makes Credit Balance Refund transaction on "17 January 2023" with 500 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + When Customer undo "2"th repayment on "11 January 2023" + Then Loan has 700 outstanding amount + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "10 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 500.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "11 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 500.0 | + | LIABILITY | l1 | Overpayment account | | 200.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 700.0 | | + | ASSET | 112601 | Loans Receivable | 500.0 | | + | LIABILITY | l1 | Overpayment account | 200.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 700.0 | + Then Loan Transactions tab has a "CREDIT_BALANCE_REFUND" transaction with date "13 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 200.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 200.0 | + Then Loan Transactions tab has a "PAYOUT_REFUND" transaction with date "15 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 500.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | + Then Loan Transactions tab has a "CREDIT_BALANCE_REFUND" transaction with date "17 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 500.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 500.0 | + + @TestRailId:C2523 + Scenario: Single repayment reversal (after maturity) + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "1 February 2023" + And Customer makes "AUTOPAY" repayment on "1 February 2023" with 1200 EUR transaction amount + When Admin sets the business date to "11 February 2023" + And Admin makes Credit Balance Refund transaction on "11 February 2023" with 200 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + When Customer undo "1"th repayment on "1 February 2023" + Then Loan status will be "ACTIVE" + Then Loan has 1200 outstanding amount + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | LIABILITY | l1 | Overpayment account | | 200.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 1200.0 | | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | l1 | Overpayment account | 200.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1200.0 | + Then Loan Transactions tab has a "CREDIT_BALANCE_REFUND" transaction with date "11 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 200.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 200.0 | + + @TestRailId:C2524 + Scenario: Multi repayment reversal (after maturity) + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "1 February 2023" + And Customer makes "AUTOPAY" repayment on "1 February 2023" with 500 EUR transaction amount + When Admin sets the business date to "2 February 2023" + And Customer makes "AUTOPAY" repayment on "2 February 2023" with 700 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan has 200 overpaid amount + When Admin sets the business date to "11 February 2023" + And Admin makes Credit Balance Refund transaction on "11 February 2023" with 200 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + When Customer undo "1"th repayment on "1 February 2023" + Then Loan status will be "ACTIVE" + Then Loan has 500 outstanding amount + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 500.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | + | ASSET | 112601 | Loans Receivable | 500.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 500.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "02 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 700.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 700.0 | | + Then Loan Transactions tab has a "CREDIT_BALANCE_REFUND" transaction with date "11 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 200.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 200.0 | + + @TestRailId:C2525 + Scenario: Overpaid paid portion (after maturity) + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "1 February 2023" + And Customer makes "AUTOPAY" repayment on "1 February 2023" with 100 EUR transaction amount + When Admin sets the business date to "2 February 2023" + And Customer makes "AUTOPAY" repayment on "2 February 2023" with 1100 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan has 200 overpaid amount + When Admin sets the business date to "11 February 2023" + And Admin makes Credit Balance Refund transaction on "11 February 2023" with 200 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + When Customer undo "1"th repayment on "1 February 2023" + Then Loan status will be "ACTIVE" + Then Loan has 100 outstanding amount + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 100.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 100.0 | | + | ASSET | 112601 | Loans Receivable | 100.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 100.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "02 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | LIABILITY | l1 | Overpayment account | | 100.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 1100.0 | | + Then Loan Transactions tab has a "CREDIT_BALANCE_REFUND" transaction with date "11 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 100.0 | | + | LIABILITY | l1 | Overpayment account | 100.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 200.0 | + + @TestRailId:C2526 + Scenario: Repayment reversal (after maturity) + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "1 February 2023" + And Customer makes "AUTOPAY" repayment on "1 February 2023" with 1000 EUR transaction amount + When Admin sets the business date to "10 February 2023" + And Admin makes "PAYOUT_REFUND" transaction with "AUTOPAY" payment type on "10 February 2023" with 1000 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan has 1000 overpaid amount + When Admin sets the business date to "11 February 2023" + And Admin makes Credit Balance Refund transaction on "11 February 2023" with 1000 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + When Customer undo "1"th repayment on "1 February 2023" + Then Loan status will be "ACTIVE" + Then Loan has 1000 outstanding amount + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 1000.0 | | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "PAYOUT_REFUND" transaction with date "10 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 1000.0 | | + Then Loan Transactions tab has a "CREDIT_BALANCE_REFUND" transaction with date "11 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + + @TestRailId:C2527 + Scenario: Refund reversal (after maturity) + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "1 February 2023" + And Customer makes "AUTOPAY" repayment on "1 February 2023" with 1000 EUR transaction amount + When Admin sets the business date to "10 February 2023" + And Refund happens on "10 February 2023" with 1000 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan has 1000 overpaid amount + When Admin sets the business date to "11 February 2023" + And Admin makes Credit Balance Refund transaction on "11 February 2023" with 1000 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + When Refund undo happens on "10 February 2023" + Then Loan status will be "ACTIVE" + Then Loan has 1000 outstanding amount + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 1000.0 | | + Then Loan Transactions tab has a "PAYOUT_REFUND" transaction with date "10 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | LIABILITY | l1 | Overpayment account | | 1000.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 1000.0 | | + | LIABILITY | l1 | Overpayment account | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "CREDIT_BALANCE_REFUND" transaction with date "11 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + + @TestRailId:C2528 + Scenario: Partial refund reversal (after maturity) + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "1 February 2023" + And Customer makes "AUTOPAY" repayment on "1 February 2023" with 1000 EUR transaction amount + When Admin sets the business date to "10 February 2023" + And Refund happens on "10 February 2023" with 500 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan has 500 overpaid amount + When Admin sets the business date to "11 February 2023" + And Admin makes Credit Balance Refund transaction on "11 February 2023" with 500 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + When Refund undo happens on "10 February 2023" + Then Loan status will be "ACTIVE" + Then Loan has 500 outstanding amount + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 1000.0 | | + Then Loan Transactions tab has a "PAYOUT_REFUND" transaction with date "10 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | LIABILITY | l1 | Overpayment account | | 500.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | + | LIABILITY | l1 | Overpayment account | 500.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 500.0 | + Then Loan Transactions tab has a "CREDIT_BALANCE_REFUND" transaction with date "11 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 500.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 500.0 | + + @TestRailId:C2529 + Scenario: Chargeback after CBR (after maturity) + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "1 February 2023" + And Customer makes "AUTOPAY" repayment on "1 February 2023" with 500 EUR transaction amount + When Admin sets the business date to "2 February 2023" + And Customer makes "AUTOPAY" repayment on "2 February 2023" with 700 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan has 200 overpaid amount + When Admin sets the business date to "11 February 2023" + And Admin makes Credit Balance Refund transaction on "11 February 2023" with 200 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + When Admin sets the business date to "15 February 2023" + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 500 EUR transaction amount for Payment nr. 1 + Then Loan status will be "ACTIVE" + Then Loan has 500 outstanding amount + When Customer undo "2"th repayment on "2 February 2023" + Then Loan status will be "ACTIVE" + Then Loan has 1200 outstanding amount + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 500.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "02 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 500.0 | + | LIABILITY | l1 | Overpayment account | | 200.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 700.0 | | + | ASSET | 112601 | Loans Receivable | 500.0 | | + | LIABILITY | l1 | Overpayment account | 200.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 700.0 | + Then Loan Transactions tab has a "CREDIT_BALANCE_REFUND" transaction with date "11 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 200.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 200.0 | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "15 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 500.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 500.0 | + + @TestRailId:C2530 + Scenario: Refund after CBR scenario (after maturity) + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "1 February 2023" + And Customer makes "AUTOPAY" repayment on "1 February 2023" with 500 EUR transaction amount + When Admin sets the business date to "2 February 2023" + And Customer makes "AUTOPAY" repayment on "2 February 2023" with 700 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan has 200 overpaid amount + When Admin sets the business date to "11 February 2023" + And Admin makes Credit Balance Refund transaction on "11 February 2023" with 200 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + When Admin sets the business date to "15 February 2023" + And Refund happens on "15 February 2023" with 500 EUR transaction amount + When Admin sets the business date to "17 February 2023" + And Admin makes Credit Balance Refund transaction on "17 February 2023" with 500 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + When Customer undo "2"th repayment on "2 February 2023" + Then Loan has 700 outstanding amount + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 500.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "02 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 500.0 | + | LIABILITY | l1 | Overpayment account | | 200.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 700.0 | | + | ASSET | 112601 | Loans Receivable | 500.0 | | + | LIABILITY | l1 | Overpayment account | 200.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 700.0 | + Then Loan Transactions tab has a "CREDIT_BALANCE_REFUND" transaction with date "11 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 200.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 200.0 | + Then Loan Transactions tab has a "PAYOUT_REFUND" transaction with date "15 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 500.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | + Then Loan Transactions tab has a "CREDIT_BALANCE_REFUND" transaction with date "17 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 500.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 500.0 | + + @TestRailId:C2841 + Scenario: Verify that accruals created for charges after CBR post-maturity + When Admin sets the business date to "01 July 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "01 July 2023" + And Admin successfully approves the loan on "01 July 2023" with "1000" amount and expected disbursement date on "01 July 2023" + And Admin successfully disburse the loan on "01 July 2023" with "1000" EUR transaction amount + When Admin sets the business date to "31 July 2023" + And Customer makes "AUTOPAY" repayment on "31 July 2023" with 1000 EUR transaction amount + When Admin sets the business date to "01 August 2023" + When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "01 August 2023" with 200 EUR transaction amount and system-generated Idempotency key + When Admin runs inline COB job for Loan + When Admin sets the business date to "02 August 2023" + And Admin makes Credit Balance Refund transaction on "02 August 2023" with 200 EUR transaction amount + Then Loan Repayment schedule has 1 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 July 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 July 2023 | 31 July 2023 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 July 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 31 July 2023 | Repayment | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 01 August 2023 | Merchant Issued Refund | 200.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 02 August 2023 | Credit Balance Refund | 200.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + When Admin runs inline COB job for Loan + When Admin sets the business date to "03 August 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "03 August 2023" due date and 10 EUR transaction amount + When Admin runs inline COB job for Loan + When Admin sets the business date to "04 August 2023" + When Admin runs inline COB job for Loan + Then Loan Repayment schedule has 2 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 July 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 July 2023 | 31 July 2023 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | + | 2 | 3 | 03 August 2023 | | 0.0 | 200.0 | 0.0 | 10.0 | 0.0 | 210.0 | 200.0 | 200.0 | 0.0 | 10.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1200.0 | 0.0 | 10.0 | 0.0 | 1210.0 | 1200.0 | 200.0 | 0.0 | 10.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 July 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 31 July 2023 | Repayment | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 01 August 2023 | Merchant Issued Refund | 200.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + | 02 August 2023 | Credit Balance Refund | 200.0 | 10.0 | 0.0 | 0.0 | 0.0 | 10.0 | + | 03 August 2023 | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + + @TestRailId:C2885 + Scenario: Verify that Loan status goes from overpaid to active in case of CBR transaction (with replaying when CBR>new balance → clears overpaid, remaining increasing loan balance) - PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION loan product + When Admin sets the business date to "01 September 2023" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 250 EUR transaction amount + When Admin sets the business date to "01 October 2023" + And Customer makes "AUTOPAY" repayment on "01 October 2023" with 250 EUR transaction amount + When Admin sets the business date to "16 October 2023" + And Customer makes "AUTOPAY" repayment on "16 October 2023" with 350 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 0 outstanding amount + Then Loan has 100 overpaid amount + When Admin makes Credit Balance Refund transaction on "16 October 2023" with 100 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + When Customer undo "1"th repayment on "16 September 2023" + Then Loan status will be "ACTIVE" + Then Loan has 250 outstanding amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 01 October 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | 3 | 15 | 01 October 2023 | 16 October 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | 100.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1100.0 | 0 | 0 | 0 | 1100.0 | 850.0 | 0 | 500 | 250 | + Then On Loan Transactions tab the "Repayment" Transaction with date "16 September 2023" is reverted + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 October 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 16 October 2023 | Repayment | 350.0 | 350.0 | 0.0 | 0.0 | 0.0 | 150.0 | + | 16 October 2023 | Credit Balance Refund | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 September 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "DOWN_PAYMENT" transaction with date "01 September 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "16 September 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + | ASSET | 112601 | Loans Receivable | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 October 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "16 October 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 350.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 350.0 | | + Then Loan Transactions tab has a "CREDIT_BALANCE_REFUND" transaction with date "16 October 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 100.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 100.0 | + + @TestRailId:C2886 + Scenario: Verify that Loan status goes from overpaid to closed in case of CBR transaction when transaction amount equals overpaid amount - PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION loan product + When Admin sets the business date to "01 September 2023" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 250 EUR transaction amount + When Admin sets the business date to "01 October 2023" + And Customer makes "AUTOPAY" repayment on "01 October 2023" with 250 EUR transaction amount + When Admin sets the business date to "16 October 2023" + And Customer makes "AUTOPAY" repayment on "16 October 2023" with 350 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 0 outstanding amount + Then Loan has 100 overpaid amount + When Admin makes Credit Balance Refund transaction on "16 October 2023" with 100 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | 01 October 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 16 October 2023 | 16 October 2023 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 1000.0 | 0 | 0 | 0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 October 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 16 October 2023 | Repayment | 350.0 | 250.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 16 October 2023 | Credit Balance Refund | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 September 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "DOWN_PAYMENT" transaction with date "01 September 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "16 September 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 October 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "16 October 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | l1 | Overpayment account | | 100.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 350.0 | | + Then Loan Transactions tab has a "CREDIT_BALANCE_REFUND" transaction with date "16 October 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | LIABILITY | l1 | Overpayment account | 100.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 100.0 | + + @TestRailId:C2887 + Scenario: Verify that Loan status goes from overpaid to active in case of Refund transaction was reverted - PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION loan product + When Admin sets the business date to "01 September 2023" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 250 EUR transaction amount + When Admin sets the business date to "01 October 2023" + And Customer makes "AUTOPAY" repayment on "01 October 2023" with 250 EUR transaction amount + When Admin sets the business date to "16 October 2023" + And Customer makes "AUTOPAY" repayment on "16 October 2023" with 250 EUR transaction amount + And Refund happens on "16 October 2023" with 100 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 0 outstanding amount + Then Loan has 100 overpaid amount + When Admin makes Credit Balance Refund transaction on "16 October 2023" with 100 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + When Refund undo happens on "16 October 2023" + Then Loan status will be "ACTIVE" + Then Loan has 100 outstanding amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | 01 October 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | 250.0 | 0.0 | 0.0 | 100.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1100.0 | 0 | 0 | 0 | 1100.0 | 1000.0 | 0 | 0 | 100 | + Then On Loan Transactions tab the "Payout Refund" Transaction with date "16 October 2023" is reverted + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 October 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 16 October 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 16 October 2023 | Payout Refund | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 16 October 2023 | Credit Balance Refund | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 September 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "DOWN_PAYMENT" transaction with date "01 September 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "16 September 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 October 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "16 October 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "PAYOUT_REFUND" transaction with date "16 October 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | LIABILITY | l1 | Overpayment account | | 100.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 100.0 | | + | LIABILITY | l1 | Overpayment account | 100.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 100.0 | + Then Loan Transactions tab has a "CREDIT_BALANCE_REFUND" transaction with date "16 October 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 100.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 100.0 | + + @TestRailId:C2888 + Scenario: Multi repayment reversal (after maturity) - PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION loan product + When Admin sets the business date to "01 September 2023" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 250 EUR transaction amount + When Admin sets the business date to "01 October 2023" + And Customer makes "AUTOPAY" repayment on "01 October 2023" with 250 EUR transaction amount + When Admin sets the business date to "20 October 2023" + And Customer makes "AUTOPAY" repayment on "20 October 2023" with 350 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 0 outstanding amount + Then Loan has 100 overpaid amount + When Admin sets the business date to "25 October 2023" + When Admin makes Credit Balance Refund transaction on "25 October 2023" with 100 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + When Customer undo "1"th repayment on "20 October 2023" + Then Loan status will be "ACTIVE" + Then Loan has 250 outstanding amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 01 October 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | 3 | 15 | 01 October 2023 | 20 October 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 100.0 | 0.0 | 100.0 | 150.0 | + | 5 | 9 | 25 October 2023 | | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1100.0 | 0 | 0 | 0 | 1100.0 | 850.0 | 0 | 600 | 250 | + Then On Loan Transactions tab the "Repayment" Transaction with date "16 September 2023" is reverted + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 October 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 20 October 2023 | Repayment | 350.0 | 350.0 | 0.0 | 0.0 | 0.0 | 150.0 | + | 25 October 2023 | Credit Balance Refund | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 September 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "DOWN_PAYMENT" transaction with date "01 September 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "16 September 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + | ASSET | 112601 | Loans Receivable | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 October 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "20 October 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 350.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 350.0 | | + Then Loan Transactions tab has a "CREDIT_BALANCE_REFUND" transaction with date "25 October 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 100.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 100.0 | + + @TestRailId:C2889 + Scenario: Verify that Loan status goes from overpaid to active in case of CBR transaction (after maturity) - PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION loan product + When Admin sets the business date to "01 September 2023" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 250 EUR transaction amount + When Admin sets the business date to "01 October 2023" + And Customer makes "AUTOPAY" repayment on "01 October 2023" with 250 EUR transaction amount + When Admin sets the business date to "20 October 2023" + And Customer makes "AUTOPAY" repayment on "20 October 2023" with 200 EUR transaction amount + When Admin sets the business date to "21 October 2023" + And Customer makes "AUTOPAY" repayment on "21 October 2023" with 150 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 0 outstanding amount + Then Loan has 100 overpaid amount + When Admin makes Credit Balance Refund transaction on "21 October 2023" with 100 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + When Customer undo "1"th repayment on "20 September 2023" + Then Loan status will be "ACTIVE" + Then Loan has 250 outstanding amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 01 October 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | 3 | 15 | 01 October 2023 | 21 October 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 100.0 | 0.0 | 100.0 | 150.0 | + | 5 | 5 | 21 October 2023 | | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1100.0 | 0 | 0 | 0 | 1100.0 | 850.0 | 0 | 600 | 250 | + Then On Loan Transactions tab the "Repayment" Transaction with date "16 September 2023" is reverted + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 October 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 20 October 2023 | Repayment | 200.0 | 200.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 21 October 2023 | Repayment | 150.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | + | 21 October 2023 | Credit Balance Refund | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 September 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "DOWN_PAYMENT" transaction with date "01 September 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "16 September 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + | ASSET | 112601 | Loans Receivable | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 October 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "20 October 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 200.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 200.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "21 October 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 150.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 150.0 | | + Then Loan Transactions tab has a "CREDIT_BALANCE_REFUND" transaction with date "21 October 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 100.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 100.0 | + + @TestRailId:C2890 + Scenario: Verify that accruals created for charges after CBR post-maturity - PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION loan product + When Admin sets the business date to "01 September 2023" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 250 EUR transaction amount + When Admin sets the business date to "01 October 2023" + And Customer makes "AUTOPAY" repayment on "01 October 2023" with 250 EUR transaction amount + When Admin sets the business date to "16 October 2023" + And Customer makes "AUTOPAY" repayment on "16 October 2023" with 250 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + When Admin sets the business date to "17 October 2023" + When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "17 October 2023" with 100 EUR transaction amount and system-generated Idempotency key + When Admin runs inline COB job for Loan + When Admin sets the business date to "18 October 2023" + And Admin makes Credit Balance Refund transaction on "18 October 2023" with 100 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | 01 October 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 16 October 2023 | 16 October 2023 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 1000.0 | 0 | 0 | 0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 October 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 16 October 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 17 October 2023 | Merchant Issued Refund | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 18 October 2023 | Credit Balance Refund | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + When Admin runs inline COB job for Loan + When Admin sets the business date to "19 October 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "19 October 2023" due date and 10 EUR transaction amount + When Admin runs inline COB job for Loan + When Admin sets the business date to "20 October 2023" + When Admin runs inline COB job for Loan + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | 01 October 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 16 October 2023 | 16 October 2023 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 5 | 3 | 19 October 2023 | | 0.0 | 0.0 | 0.0 | 10.0 | 0.0 | 10.0 | 0.0 | 0.0 | 0.0 | 10.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 10 | 0 | 1010.0 | 1000.0 | 0 | 0 | 10 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 September 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 October 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 16 October 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 17 October 2023 | Merchant Issued Refund | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 18 October 2023 | Credit Balance Refund | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 19 October 2023 | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + + @TestRailId:C2989 + Scenario: Verify that CBR transaction date cannot be in the future + When Admin sets the business date to "01 September 2023" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" EUR transaction amount + When Admin sets the business date to "10 September 2023" + And Customer makes "AUTOPAY" repayment on "10 September 2023" with 1000 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 0 outstanding amount + Then Loan has 250 overpaid amount + When Admin sets the business date to "15 September 2023" + Then Credit Balance Refund transaction on future date "20 September 2023" with 250 EUR transaction amount will result an error + + @TestRailId:C3020 + Scenario: Verify that Charge-off and CBR transaction GL entries are correct in case of repayment reversal after CBR and Fraud flagged loan + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "1000" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "1000" EUR transaction amount + Then Admin can successfully set Fraud flag to the loan + And Admin does charge-off the loan on "01 January 2024" + Then Loan marked as charged-off on "01 January 2024" + When Admin sets the business date to "10 January 2024" + And Customer makes "AUTOPAY" repayment on "10 January 2024" with 1000 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 0 outstanding amount + Then Loan has 250 overpaid amount + When Admin sets the business date to "11 January 2024" + And Admin makes Credit Balance Refund transaction on "11 January 2024" with 250 EUR transaction amount + When Admin sets the business date to "12 January 2024" + When Customer undo "1"th "Repayment" transaction made on "10 January 2024" + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "DOWN_PAYMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 750.0 | + | EXPENSE | 744037 | Credit Loss/Bad Debt-Fraud | 750.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "10 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | INCOME | 744008 | Recoveries | | 750.0 | + | LIABILITY | l1 | Overpayment account | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 1000.0 | | + | INCOME | 744008 | Recoveries | 750.0 | | + | LIABILITY | l1 | Overpayment account | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "CREDIT_BALANCE_REFUND" transaction with date "11 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | EXPENSE | 744037 | Credit Loss/Bad Debt-Fraud | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | + + @TestRailId:C3021 + Scenario: Verify that Charge-off and CBR transaction GL entries are correct in case of repayment reversal after CBR and Non-Fraud loan + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "1000" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "1000" EUR transaction amount + And Admin does charge-off the loan on "01 January 2024" + Then Loan marked as charged-off on "01 January 2024" + When Admin sets the business date to "10 January 2024" + And Customer makes "AUTOPAY" repayment on "10 January 2024" with 1000 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 0 outstanding amount + Then Loan has 250 overpaid amount + When Admin sets the business date to "11 January 2024" + And Admin makes Credit Balance Refund transaction on "11 January 2024" with 250 EUR transaction amount + When Admin sets the business date to "12 January 2024" + When Customer undo "1"th "Repayment" transaction made on "10 January 2024" + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "DOWN_PAYMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 750.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 750.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "10 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | INCOME | 744008 | Recoveries | | 750.0 | + | LIABILITY | l1 | Overpayment account | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 1000.0 | | + | INCOME | 744008 | Recoveries | 750.0 | | + | LIABILITY | l1 | Overpayment account | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "CREDIT_BALANCE_REFUND" transaction with date "11 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | + + @TestRailId:C3040 + Scenario: Verify that Charge-off and CBR transaction GL entries are correct before and after a repayment reversal taken place after CBR - UC1 + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "1000" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "1000" EUR transaction amount + When Admin sets the business date to "02 January 2024" + And Customer makes "AUTOPAY" repayment on "02 January 2024" with 100 EUR transaction amount + When Admin sets the business date to "03 January 2024" + And Admin does charge-off the loan on "03 January 2024" + When Admin sets the business date to "04 January 2024" + When Customer makes "PAYOUT_REFUND" transaction with "AUTOPAY" payment type on "04 January 2024" with 1000 EUR transaction amount and system-generated Idempotency key + When Admin sets the business date to "05 January 2024" + And Admin makes Credit Balance Refund transaction on "05 January 2024" with 350 EUR transaction amount +# --- Before reverse/replay --- + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "DOWN_PAYMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "02 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 100.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 100.0 | | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "03 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 650.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 650.0 | | + Then Loan Transactions tab has a "PAYOUT_REFUND" transaction with date "04 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | EXPENSE | 744007 | Credit Loss/Bad Debt | | 650.0 | + | LIABILITY | l1 | Overpayment account | | 350.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 1000.0 | | + Then Loan Transactions tab has a "CREDIT_BALANCE_REFUND" transaction with date "05 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | LIABILITY | l1 | Overpayment account | 350.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 350.0 | +# --- After reverse/replay --- + When Admin sets the business date to "06 January 2024" + When Customer undo "1"th "Repayment" transaction made on "02 January 2024" + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "DOWN_PAYMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "02 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 100.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 100.0 | | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "03 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 750.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 750.0 | | + Then Loan Transactions tab has a "PAYOUT_REFUND" transaction with date "04 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | EXPENSE | 744007 | Credit Loss/Bad Debt | | 750.0 | + | LIABILITY | l1 | Overpayment account | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 1000.0 | | + Then Loan Transactions tab has a "CREDIT_BALANCE_REFUND" transaction with date "05 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 100.0 | | + | LIABILITY | l1 | Overpayment account | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 350.0 | + + @TestRailId:C3041 + Scenario: Verify that Charge-off and CBR transaction GL entries are correct before and after a repayment reversal taken place after CBR - UC2 + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "1000" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "1000" EUR transaction amount + And Admin does charge-off the loan on "01 January 2024" + Then Loan marked as charged-off on "01 January 2024" + When Admin sets the business date to "10 January 2024" + And Customer makes "AUTOPAY" repayment on "10 January 2024" with 1000 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 0 outstanding amount + Then Loan has 250 overpaid amount + When Admin sets the business date to "11 January 2024" + And Admin makes Credit Balance Refund transaction on "11 January 2024" with 250 EUR transaction amount +# --- Before reverse/replay --- + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "DOWN_PAYMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 750.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 750.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "10 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | INCOME | 744008 | Recoveries | | 750.0 | + | LIABILITY | l1 | Overpayment account | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 1000.0 | | + Then Loan Transactions tab has a "CREDIT_BALANCE_REFUND" transaction with date "11 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | LIABILITY | l1 | Overpayment account | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | +# --- After reverse/replay --- + When Admin sets the business date to "12 January 2024" + When Customer undo "1"th "Repayment" transaction made on "10 January 2024" + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "DOWN_PAYMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 750.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 750.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "10 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | INCOME | 744008 | Recoveries | | 750.0 | + | LIABILITY | l1 | Overpayment account | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 1000.0 | | + | INCOME | 744008 | Recoveries | 750.0 | | + | LIABILITY | l1 | Overpayment account | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "CREDIT_BALANCE_REFUND" transaction with date "11 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | + + @TestRailId:C3092 + Scenario: Verify that overpayment portion calculated properly in case of CBR reverse-replay + When Admin sets the business date to "25 January 2024" + 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 | + | PIN4_DOWNPAYMENT_ADVANCED_PAYMENT_ALLOCATION | 25 January 2024 | 212.87 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 30 | DAYS | 30 | DAYS | 1 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "25 January 2024" with "212.87" amount and expected disbursement date on "25 January 2024" + When Admin successfully disburse the loan on "25 January 2024" with "212.87" EUR transaction amount + When Admin sets the business date to "24 February 2024" + And Customer makes "AUTOPAY" repayment on "24 February 2024" with 212.87 EUR transaction amount + When Admin sets the business date to "29 February 2024" + When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "29 February 2024" with 36.99 EUR transaction amount and system-generated Idempotency key + When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "29 February 2024" with 18.94 EUR transaction amount and system-generated Idempotency key + When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "29 February 2024" with 36.99 EUR transaction amount and system-generated Idempotency key + When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "29 February 2024" with 31.91 EUR transaction amount and system-generated Idempotency key + When Admin sets the business date to "01 March 2024" + And Admin makes Credit Balance Refund transaction on "01 March 2024" with 124.83 EUR transaction amount + When Admin sets the business date to "02 March 2024" + When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "02 March 2024" with 19.99 EUR transaction amount and system-generated Idempotency key + When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "02 March 2024" with 19.99 EUR transaction amount and system-generated Idempotency key + When Customer undo "1"th "Merchant Issued Refund" transaction made on "29 February 2024" + Then Loan status will be "OVERPAID" + Then Loan has 2.99 overpaid 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 | + | | | 25 January 2024 | | 212.87 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 25 January 2024 | 24 February 2024 | 159.87 | 53.0 | 0.0 | 0.0 | 0.0 | 53.0 | 53.0 | 0.0 | 53.0 | 0.0 | + | 2 | 30 | 24 February 2024 | 24 February 2024 | 0.0 | 159.87 | 0.0 | 0.0 | 0.0 | 159.87 | 159.87 | 0.0 | 0.0 | 0.0 | + | 3 | 6 | 01 March 2024 | 02 March 2024 | 0.0 | 124.83 | 0.0 | 0.0 | 0.0 | 124.83 | 124.83 | 0.0 | 36.99 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 337.7 | 0.0 | 0.0 | 0.0 | 337.7 | 337.7 | 0.0 | 89.99 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 25 January 2024 | Disbursement | 212.87 | 0.0 | 0.0 | 0.0 | 0.0 | 212.87 | false | + | 24 February 2024 | Repayment | 212.87 | 212.87 | 0.0 | 0.0 | 0.0 | 0.0 | false | + | 29 February 2024 | Merchant Issued Refund | 36.99 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | true | + | 29 February 2024 | Merchant Issued Refund | 18.94 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | + | 29 February 2024 | Merchant Issued Refund | 36.99 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | + | 29 February 2024 | Merchant Issued Refund | 31.91 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | + | 01 March 2024 | Credit Balance Refund | 124.83 | 36.99 | 0.0 | 0.0 | 0.0 | 36.99 | false | + | 02 March 2024 | Merchant Issued Refund | 19.99 | 19.99 | 0.0 | 0.0 | 0.0 | 17.0 | false | + | 02 March 2024 | Merchant Issued Refund | 19.99 | 17.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | diff --git a/fineract-e2e-tests-runner/src/test/resources/features/LoanCharge.feature b/fineract-e2e-tests-runner/src/test/resources/features/LoanCharge.feature new file mode 100644 index 00000000000..b3f39d6d0a6 --- /dev/null +++ b/fineract-e2e-tests-runner/src/test/resources/features/LoanCharge.feature @@ -0,0 +1,1676 @@ +@ChargeFeature +Feature: LoanCharge + + @TestRailId:C50 + Scenario: Charge creation functionality with locale EN + When Admin creates a client with random data + When Admin successfully creates a new customised Loan submitted on date: "1 July 2022", with Principal: "6000", a loanTermFrequency: 24 months, and numberOfRepayments: 24 + And Admin adds a 10 % Processing charge to the loan with "en" locale on date: "10 July 2022" + Then Charge is successfully added to the loan with 600 EUR + + @TestRailId:C51 + Scenario: Charge creation functionality with locale DE + When Admin creates a client with random data + When Admin successfully creates a new customised Loan submitted on date: "1 July 2022", with Principal: "6000", a loanTermFrequency: 24 months, and numberOfRepayments: 24 + And Admin adds a 10 % Processing charge to the loan with "de_DE" locale on date: "10 Juli 2022" + Then Charge is successfully added to the loan with 600 EUR + + @TestRailId:C2450 + Scenario: Due date charge can be successfully applied when it is added on the loan account after the maturity date (NSF scenario of last installment) + When Admin sets the business date to "1 January 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 January 2022", with Principal: "750", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 January 2022" with "750" amount and expected disbursement date on "1 January 2022" + When Admin successfully disburse the loan on "1 January 2022" with "750" EUR transaction amount + When Admin sets the business date to "1 February 2022" + And Customer makes "AUTOPAY" repayment on "1 February 2022" with 250 EUR transaction amount + When Admin sets the business date to "1 March 2022" + And Customer makes "AUTOPAY" repayment on "1 March 2022" with 250 EUR transaction amount + When Admin sets the business date to "1 April 2022" + And Customer makes "AUTOPAY" repayment on "1 April 2022" with 250 EUR transaction amount + When Customer makes a repayment undo on "1 April 2022" + When Admin sets the business date to "5 April 2022" + And Admin adds an NSF fee because of payment bounce with "5 April 2022" transaction date + And Customer makes "AUTOPAY" repayment on "1 April 2022" with 260 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + + @TestRailId:C2451 + Scenario: Due date charge can be successfully applied when it is added on the loan account which already has a N+1 scenario (by chargeback) + When Admin sets the business date to "1 January 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 January 2022", with Principal: "750", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 January 2022" with "750" amount and expected disbursement date on "1 January 2022" + When Admin successfully disburse the loan on "1 January 2022" with "750" EUR transaction amount + When Admin sets the business date to "1 February 2022" + And Customer makes "AUTOPAY" repayment on "1 February 2022" with 250 EUR transaction amount + When Admin sets the business date to "1 March 2022" + And Customer makes "AUTOPAY" repayment on "1 March 2022" with 250 EUR transaction amount + When Admin sets the business date to "1 April 2022" + And Customer makes "AUTOPAY" repayment on "1 April 2022" with 250 EUR transaction amount + When Admin sets the business date to "1 May 2022" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 250 EUR transaction amount + And Customer makes "AUTOPAY" repayment on "1 May 2022" with 250 EUR transaction amount + When Customer makes a repayment undo on "1 May 2022" + When Admin sets the business date to "5 May 2022" + And Admin adds an NSF fee because of payment bounce with "5 May 2022" transaction date + When Admin sets the business date to "10 May 2022" + And Customer makes "AUTOPAY" repayment on "10 May 2022" with 260 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + + @TestRailId:C2452 + Scenario: Due date charge can be successfully applied, then waived when it is added on the loan account after the maturity date (NSF scenario of last installment) + When Admin sets the business date to "1 January 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 January 2022", with Principal: "750", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 January 2022" with "750" amount and expected disbursement date on "1 January 2022" + When Admin successfully disburse the loan on "1 January 2022" with "750" EUR transaction amount + When Admin sets the business date to "1 February 2022" + And Customer makes "AUTOPAY" repayment on "1 February 2022" with 250 EUR transaction amount + When Admin sets the business date to "1 March 2022" + And Customer makes "AUTOPAY" repayment on "1 March 2022" with 250 EUR transaction amount + When Admin sets the business date to "1 April 2022" + And Customer makes "AUTOPAY" repayment on "1 April 2022" with 250 EUR transaction amount + When Customer makes a repayment undo on "1 April 2022" + Then Loan status will be "ACTIVE" + Then Loan has 250 outstanding amount + When Admin sets the business date to "5 April 2022" + And Admin adds an NSF fee because of payment bounce with "5 April 2022" transaction date + Then Loan status will be "ACTIVE" + Then Loan has 260 outstanding amount + When Admin sets the business date to "7 April 2022" + And Admin waives charge + Then Loan status will be "ACTIVE" + Then Loan has 250 outstanding amount + + + @TestRailId:C2453 + Scenario: Due date charge can be successfully applied, waived, then waive reversed when it is added on the loan account after the maturity date (NSF scenario of last installment) + When Admin sets the business date to "1 January 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 January 2022", with Principal: "750", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 January 2022" with "750" amount and expected disbursement date on "1 January 2022" + When Admin successfully disburse the loan on "1 January 2022" with "750" EUR transaction amount + When Admin sets the business date to "1 February 2022" + And Customer makes "AUTOPAY" repayment on "1 February 2022" with 250 EUR transaction amount + When Admin sets the business date to "1 March 2022" + And Customer makes "AUTOPAY" repayment on "1 March 2022" with 250 EUR transaction amount + When Admin sets the business date to "1 April 2022" + And Customer makes "AUTOPAY" repayment on "1 April 2022" with 250 EUR transaction amount + When Customer makes a repayment undo on "1 April 2022" + When Admin sets the business date to "5 April 2022" + And Admin adds an NSF fee because of payment bounce with "5 April 2022" transaction date + When Admin sets the business date to "7 April 2022" + And Admin waives charge + When Admin sets the business date to "8 April 2022" + And Admin makes waive undone for charge + Then Loan status will be "ACTIVE" + Then Loan has 260 outstanding amount + +# TODO clear, make it work properly + @Skip @TestRailId:C2472 + Scenario: Charge adjustment works properly + When Admin sets the business date to "22 October 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "22 October 2022", with Principal: "1000", a loanTermFrequency: 2 months, and numberOfRepayments: 2 + And Admin successfully approves the loan on "22 October 2022" with "1000" amount and expected disbursement date on "22 October 2022" + When Admin successfully disburse the loan on "22 October 2022" with "1000" EUR transaction amount + When Admin sets the business date to "23 October 2022" + And Admin adds an NSF fee because of payment bounce with "23 October 2022" transaction date + Then Loan has 1010 outstanding amount + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 10 | 1010 | 0 | 0 | 0 | 1010 | +## check transactions last transaction ID type:accrual amount:10, fee:10 depends on NSF penalty or fee / nekunk +# TODO Accrual job 500 Error +# And Admin runs the Add Periodic Accrual Transactions job +# Then Loan Transactions tab has a transaction with date: "04 November 2022", and with the following data: +# | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | +# | Repayment | 10.0 | 0.0 | 0.0 | 0.0 | 10.0 | 600.0 | + + +## chek Journal entries for transaction ID --> type/account name/debit-credit amount + # TODO can be done when journal entry paging is fixed +# Then The transaction type "Accrual" with date "23 October 2022" has the following journal entries data: Type="ASSET", Account name="Interest/Fee Receivable", Type="INCOME", Account name="Fee Income", Type="", Account name="" + +## check charges --> due/paid/waived/outstanding + Then Loan Charges tab has a given charge with the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 23 October 2022 | Flat | 10.0 | 0.0 | 0.0 | 10.0 | + + When Admin sets the business date to "04 November 2022" + +## charge adjustment for nsf fee with 3 + When Admin makes a charge adjustment for the last "LOAN_NSF_FEE" type charge which is due on "23 October 2022" with 3 EUR transaction amount and externalId "" + Then Loan has 1007 outstanding amount + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 10 | 1010 | 3 | 3 | 0 | 1007 | + Then Loan Transactions tab has a transaction with date: "23 October 2022", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Charge Adjustment | 3.0 | 0.0 | 0.0 | 0.0 | 3.0 | 1000.0 | + +## chek Journal entries for transaction ID --> type/account name/debit-credit amount +# TODO can be done when journal entry paging is fixed +# Then The transaction type "Charge Adjustment" with date "04 November 2022" has the following journal entries data: Type="ASSET", Account name="Interest/Fee Receivable", Type="INCOME", Account name="Fee Income", Type="", Account name="" + Then Loan Charges tab has a given charge with the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 23 October 2022 | Flat | 10.0 | 3.0 | 0.0 | 7.0 | +# + And Customer makes "AUTOPAY" repayment on "25 October 2022" with 8 EUR transaction amount + Then Loan has 999 outstanding amount + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 10 | 1010 | 11 | 11 | 0 | 999 | + Then Loan Transactions tab has a transaction with date: "25 October 2022", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Charge Adjustment | 3.0 | 1.0 | 0.0 | 0.0 | 2.0 | 999.0 | + +# TODO can be done when journal entry paging is fixed +# Then The transaction type "Charge Adjustment" with date "04 November 2022" has the following journal entries data: Type="ASSET", Account name="Interest/Fee Receivable", Type="INCOME", Account name="Fee Income", Type="ASSET", Account name="Loans Receivable" + Then Loan Charges tab has a given charge with the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 23 October 2022 | Flat | 10.0 | 10.0 | 0.0 | 0.0 | +# +## charge adjustment with 8 will fail + When Admin makes a charge adjustment for the last "LOAN_NSF_FEE" type charge which is due on "23 October 2022" with transaction amount higher than the available charge amount + +## revert last charge adjustment (was amount 3) + When Admin reverts the charge adjustment which was raised on "04 November 2022" with 3 EUR transaction amount + Then Loan has 1002 outstanding amount + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 10 | 1010 | 8 | 8 | 0 | 1002 | + Then In Loan Transactions the latest Transaction has Transaction type="Charge Adjustment" and is reverted +# TODO can be done when journal entry paging is fixed +# Then The transaction type "Charge Adjustment" with date "04 November 2022" has the following journal entries data: Type="ASSET", Account name="Interest/Fee Receivable", Type="INCOME", Account name="Fee Income", Type="ASSET", Account name="Loans Receivable" + Then Loan Charges tab has a given charge with the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 23 October 2022 | Flat | 10.0 | 8.0 | 0.0 | 2.0 | +# +## Add snooze fee on 10/27/2022 with amount 9 (az eloyo legzen penaltz ez meg fee( + And Admin adds "LOAN_SNOOZE_FEE" due date charge with "27 October 2022" due date and 9 EUR transaction amount + Then Loan has 1011 outstanding amount + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 9 | 10 | 1019 | 8 | 8 | 0 | 1011 | + Then In Loan Transactions the latest Transaction has Transaction type="Charge Adjustment" and is reverted +# TODO can be done when journal entry paging is fixed +# Then The transaction type "Charge Adjustment" with date "04 November 2022" has the following journal entries data: Type="ASSET", Account name="Interest/Fee Receivable", Type="INCOME", Account name="Fee Income", Type="ASSET", Account name="Loans Receivable" + Then Loan Charges tab has a given charge with the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 27 October 2022 | Flat | 9.0 | 0.0 | 0.0 | 9.0 | +# Then In Loan Charges the given Charge has the following data: +# | nth Charge | Name | isPenalty | Due as of | Due | Paid | Waived | Outstanding | +# | | Snooze fee | false | 27 October 2022 | 9 | 0 | 0 | 9 | +# +## charge adjustment for snooze fee with 4 + When Admin makes a charge adjustment for the last "LOAN_SNOOZE_FEE" type charge which is due on "27 October 2022" with 4 EUR transaction amount and externalId "" + Then Loan has 1007 outstanding amount + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 9 | 10 | 1019 | 12 | 12 | 0 | 1007 | + Then Loan Transactions tab has a transaction with date: "04 November 2022", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Charge Adjustment | 4.0 | 0.0 | 0.0 | 2.0 | 2.0 | 1000.0 | + +# TODO can be done when journal entry paging is fixed +# Then The transaction type "Charge Adjustment" with date "04 November 2022" has the following journal entries data: Type="ASSET", Account name="Interest/Fee Receivable", Type="INCOME", Account name="Fee Income", Type="", Account name="" + Then Loan Charges tab has a given charge with the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 27 October 2022 | Flat | 9.0 | 2.0 | 0.0 | 7.0 | +# Then In Loan Charges the given Charge has the following data: +# | nth Charge | Name | isPenalty | Due as of | Due | Paid | Waived | Outstanding | +# | | Snooze fee | false | 27 October 2022 | 9 | 2 | 0 | 7 | +# + And Customer makes "AUTOPAY" repayment on "31 October 2022" with 507 EUR transaction amount + Then Loan has 500 outstanding amount + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 9 | 10 | 1019 | 519 | 519 | 0 | 500 | + Then Loan Transactions tab has a transaction with date: "04 November 2022", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Charge Adjustment | 4.0 | 4.0 | 0.0 | 0.0 | 0.0 | 500.0 | + +# TODO can be done when journal entry paging is fixed +# Then The transaction type "Charge Adjustment" with date "04 November 2022" has the following journal entries data: Type="ASSET", Account name="Loans Receivable", Type="INCOME", Account name="Fee Income", Type="", Account name="" + Then Loan Charges tab has a given charge with the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 27 October 2022 | Flat | 9.0 | 9.0 | 0.0 | 0.0 | +# Then In Loan Charges the given Charge has the following data: +# | nth Charge | Name | isPenalty | Due as of | Due | Paid | Waived | Outstanding | +# | | Snooze fee | false | 27 October 2022 | 9 | 9 | 0 | 0 | +# +## charge adjustment for nsf fee with 5 / hol jegyzi meg az ID-t? + When Admin makes a charge adjustment for the last "LOAN_NSF_FEE" type charge which is due on "23 October 2022" with 5 EUR transaction amount and externalId "" + Then Loan has 495 outstanding amount + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 9 | 10 | 1019 | 524 | 524 | 0 | 495 | + Then Loan Transactions tab has a transaction with date: "04 November 2022", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Charge Adjustment | 5.0 | 5.0 | 0.0 | 0.0 | 0.0 | 495.0 | + +# TODO can be done when journal entry paging is fixed +# Then The transaction type "Charge Adjustment" with date "04 November 2022" has the following journal entries data: Type="ASSET", Account name="Loans Receivable", Type="INCOME", Account name="Fee Income", Type="", Account name="" + Then Loan Charges tab has a given charge with the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 27 October 2022 | Flat | 9.0 | 9.0 | 0.0 | 0.0 | +# Then In Loan Charges the given Charge has the following data: +# | nth Charge | Name | isPenalty | Due as of | Due | Paid | Waived | Outstanding | +# | | Snooze fee | false | 27 October 2022 | 9 | 9 | 0 | 0 | + + And Customer makes "AUTOPAY" repayment on "1 November 2022" with 494 EUR transaction amount + Then Loan has 1 outstanding amount + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 9 | 10 | 1019 | 1018 | 1018 | 0 | 1 | + Then Loan Transactions tab has a transaction with date: "04 November 2022", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Charge Adjustment | 5.0 | 5.0 | 0.0 | 0.0 | 0.0 | 1.0 | + +# TODO can be done when journal entry paging is fixed +# Then The transaction type "Charge Adjustment" with date "04 November 2022" has the following journal entries data: Type="ASSET", Account name="Loans Receivable", Type="INCOME", Account name="Fee Income", Type="", Account name="" + Then Loan Charges tab has a given charge with the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 27 October 2022 | Flat | 9.0 | 9.0 | 0.0 | 0.0 | +# Then In Loan Charges the given Charge has the following data: +# | nth Charge | Name | isPenalty | Due as of | Due | Paid | Waived | Outstanding | +# | | Snooze fee | false | 27 October 2022 | 9 | 9 | 0 | 0 | +# +# # charge adjustment for snooze fee with 1 + When Admin makes a charge adjustment for the last "LOAN_SNOOZE_FEE" type charge which is due on "27 October 2022" with 1 EUR transaction amount and externalId "" + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 9 | 10 | 1019 | 1019 | 1019 | 0 | 0 | + Then Loan Transactions tab has a transaction with date: "04 November 2022", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Charge Adjustment | 1.0 | 1.0 | 0.0 | 0.0 | 0.0 | 0.0 | + +# TODO can be done when journal entry paging is fixed +# Then The transaction type "Charge Adjustment" with date "04 November 2022" has the following journal entries data: Type="ASSET", Account name="Loans Receivable", Type="INCOME", Account name="Fee Income", Type="", Account name="" + Then Loan Charges tab has a given charge with the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 27 October 2022 | Flat | 9.0 | 9.0 | 0.0 | 0.0 | +# Then In Loan Charges the given Charge has the following data: +# | nth Charge | Name | isPenalty | Due as of | Due | Paid | Waived | Outstanding | +# | | Snooze fee | false | 27 October 2022 | 9 | 9 | 0 | 0 | +# +# # revert last charge adjustment (was amount 1) + When Admin reverts the charge adjustment which was raised on "04 November 2022" with 1 EUR transaction amount + Then Loan status will be "ACTIVE" + Then Loan has 1 outstanding amount + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 9 | 10 | 1019 | 1018 | 1018 | 0 | 1 | +# TODO do it with nth transaction and not latest, because accrual is working now, so the last transaction will be accrual and the one before will be the reverted Charge Adjustment +# Then In Loan Transactions the latest Transaction has Transaction type="Charge Adjustment" and is reverted +# TODO can be done when journal entry paging is fixed +# Then The transaction type "Charge Adjustment" with date "04 November 2022" has the following journal entries data: Type="ASSET", Account name="Loans Receivable", Type="INCOME", Account name="Fee Income", Type="", Account name="" + Then Loan Charges tab has a given charge with the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 27 October 2022 | Flat | 9.0 | 9.0 | 0.0 | 0.0 | +# Then In Loan Charges the given Charge has the following data: +# | nth Charge | Name | isPenalty | Due as of | Due | Paid | Waived | Outstanding | +# | | Snooze fee | false | 27 October 2022 | 9 | 9 | 0 | 0 | +# +# # charge adjustment for nsf fee with 1 + When Admin makes a charge adjustment for the last "LOAN_NSF_FEE" type charge which is due on "23 October 2022" with 1 EUR transaction amount and externalId "" + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 9 | 10 | 1019 | 1019 | 1019 | 0 | 0 | + Then Loan Transactions tab has a transaction with date: "04 November 2022", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Charge Adjustment | 1.0 | 1.0 | 0.0 | 0.0 | 0.0 | 0.0 | + +# TODO can be done when journal entry paging is fixed +# Then The transaction type "Charge Adjustment" with date "04 November 2022" has the following journal entries data: Type="ASSET", Account name="Loans Receivable", Type="INCOME", Account name="Fee Income", Type="", Account name="" + Then Loan Charges tab has a given charge with the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 27 October 2022 | Flat | 9.0 | 9.0 | 0.0 | 0.0 | +# Then In Loan Charges the given Charge has the following data: +# | nth Charge | Name | isPenalty | Due as of | Due | Paid | Waived | Outstanding | +# | | Snooze fee | false | 27 October 2022 | 9 | 9 | 0 | 0 | +# +# # charge adjustment for nsf fee with 2 + When Admin makes a charge adjustment for the last "LOAN_NSF_FEE" type charge which is due on "23 October 2022" with 2 EUR transaction amount and externalId "" + Then Loan status will be "OVERPAID" + Then Loan has 0 outstanding amount + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 9 | 10 | 1019 | 1019 | 1019 | 0 | 0 | + Then Loan Transactions tab has a transaction with date: "04 November 2022", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Charge Adjustment | 2.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + Then Loan has 2 overpaid amount + +# TODO can be done when journal entry paging is fixed +# Then The transaction type "Charge Adjustment" with date "04 November 2022" has the following journal entries data: Type="LIABILITY", Account name="Overpayment account", Type="INCOME", Account name="Fee Income", Type="", Account name="" + Then Loan Charges tab has a given charge with the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 27 October 2022 | Flat | 9.0 | 9.0 | 0.0 | 0.0 | +# Then In Loan Charges the given Charge has the following data: +# | nth Charge | Name | isPenalty | Due as of | Due | Paid | Waived | Outstanding | +# | | Snooze fee | false | 27 October 2022 | 9 | 9 | 0 | 0 | +# +# # revert last charge adjustment (was amount 2) + When Admin reverts the charge adjustment which was raised on "04 November 2022" with 2 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 9 | 10 | 1019 | 1019 | 1019 | 0 | 0 | + Then In Loan Transactions the latest Transaction has Transaction type="Charge Adjustment" and is reverted +# TODO can be done when journal entry paging is fixed +# Then The transaction type "Charge Adjustment" with date "04 November 2022" has the following journal entries data: Type="LIABILITY", Account name="Overpayment account", Type="INCOME", Account name="Fee Income", Type="", Account name="" + Then Loan Charges tab has a given charge with the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 27 October 2022 | Flat | 9.0 | 9.0 | 0.0 | 0.0 | +# Then In Loan Charges the given Charge has the following data: +# | nth Charge | Name | isPenalty | Due as of | Due | Paid | Waived | Outstanding | +# | | Snooze fee | false | 27 October 2022 | 9 | 9 | 0 | 0 | + + @TestRailId:C2532 + Scenario: Verify that charge can be added to loan on disbursement date (loan status is 'active') + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "01 January 2023" due date and 10 EUR transaction amount + Then Loan Charges tab has a given charge with the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 01 January 2023 | Flat | 10.0 | 0.0 | 0.0 | 10.0 | + Then Loan's actualMaturityDate is "31 January 2023" + + @TestRailId:C2533 + Scenario: Verify that charge can be added to loan after disbursement date (loan status is 'active') + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin sets the business date to "10 January 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "10 January 2023" due date and 10 EUR transaction amount + Then Loan Charges tab has a given charge with the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 10 January 2023 | Flat | 10.0 | 0.0 | 0.0 | 10.0 | + Then Loan's actualMaturityDate is "31 January 2023" + + @TestRailId:C2534 + Scenario: Verify that charge can be added to loan after partial repayment (loan status is 'active') + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin sets the business date to "10 January 2023" + And Customer makes "AUTOPAY" repayment on "10 January 2023" with 500 EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "10 January 2023" due date and 10 EUR transaction amount + Then Loan Charges tab has a given charge with the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 10 January 2023 | Flat | 10.0 | 10.0 | 0.0 | 0.0 | + Then Loan's actualMaturityDate is "31 January 2023" + + @TestRailId:C2535 + Scenario: Verify that charge can be added to loan which is reopened by chargeback transaction after got overpaid by repayment (loan status is 'active') + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin sets the business date to "10 January 2023" + And Customer makes "AUTOPAY" repayment on "10 January 2023" with 1200 EUR transaction amount + Then Loan status will be "OVERPAID" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 300 EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "10 January 2023" due date and 10 EUR transaction amount + Then Loan Charges tab has a given charge with the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 10 January 2023 | Flat | 10.0 | 10.0 | 0.0 | 0.0 | + Then Loan's actualMaturityDate is "31 January 2023" + + @TestRailId:C2536 + Scenario: Verify that charge can be added to loan which is reopened by payment undo transaction after got overpaid by repayment (loan status is 'active') + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin sets the business date to "05 January 2023" + And Customer makes "AUTOPAY" repayment on "05 January 2023" with 700 EUR transaction amount + When Admin sets the business date to "10 January 2023" + And Customer makes "AUTOPAY" repayment on "10 January 2023" with 500 EUR transaction amount + Then Loan status will be "OVERPAID" + When Customer undo "1"th transaction made on "05 January 2023" + Then Loan status will be "ACTIVE" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "10 January 2023" due date and 10 EUR transaction amount + Then Loan Charges tab has a given charge with the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 10 January 2023 | Flat | 10.0 | 10.0 | 0.0 | 0.0 | + Then Loan's actualMaturityDate is "31 January 2023" + + @TestRailId:C2537 + Scenario: Verify that charge can be added to loan which is reopened by undo goodwill credit transaction after got overpaid by goodwill credit transaction (loan status is 'active') + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin sets the business date to "10 January 2023" + And Customer makes "AUTOPAY" repayment on "10 January 2023" with 900 EUR transaction amount + When Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "10 January 2023" with 300 EUR transaction amount and system-generated Idempotency key + Then Loan status will be "OVERPAID" + When Customer undo "2"th transaction made on "10 January 2023" + Then Loan status will be "ACTIVE" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "10 January 2023" due date and 10 EUR transaction amount + Then Loan Charges tab has a given charge with the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 10 January 2023 | Flat | 10.0 | 10.0 | 0.0 | 0.0 | + Then Loan's actualMaturityDate is "31 January 2023" + + @TestRailId:C2538 + Scenario: Verify that charge can be added to loan which is reopened by undo repayment after got overpaid by goodwill credit transaction (loan status is 'active') + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin sets the business date to "10 January 2023" + And Customer makes "AUTOPAY" repayment on "10 January 2023" with 900 EUR transaction amount + When Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "10 January 2023" with 300 EUR transaction amount and system-generated Idempotency key + Then Loan status will be "OVERPAID" + When Customer undo "1"th transaction made on "10 January 2023" + Then Loan status will be "ACTIVE" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "10 January 2023" due date and 10 EUR transaction amount + Then Loan Charges tab has a given charge with the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 10 January 2023 | Flat | 10.0 | 10.0 | 0.0 | 0.0 | + Then Loan's actualMaturityDate is "31 January 2023" + + @TestRailId:C2601 + Scenario: Verify that loanChargePaidByList section has the correct data in loanDetails and in LoanTransactionMakeRepaymentPostBusinessEvent + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "03 January 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "03 January 2023" due date and 10 EUR transaction amount + When Admin sets the business date to "04 January 2023" + When Admin adds "LOAN_NSF_FEE" due date charge with "04 January 2023" due date and 20 EUR transaction amount + When Admin sets the business date to "05 January 2023" + And Customer makes "AUTOPAY" repayment on "05 January 2023" with 200 EUR transaction amount + Then Loan details and LoanTransactionMakeRepaymentPostBusinessEvent has the following data in loanChargePaidByList section: + | amount | name | + | 10.0 | Snooze fee | + | 20.0 | NSF fee | + + @TestRailId:C2606 + Scenario: Verify that after COB job Accrual entry is made when loan has a fee-charge on disbursal date + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "01 January 2023" due date and 10 EUR transaction amount + When Admin sets the business date to "02 January 2023" + When Admin runs inline COB job for Loan + Then Loan Transactions tab has a transaction with date: "01 January 2023", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + + @TestRailId:C2607 + Scenario: Verify that after COB job Accrual entry is made when loan has a penalty-charge on disbursal date + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "01 January 2023" due date and 10 EUR transaction amount + When Admin sets the business date to "02 January 2023" + When Admin runs inline COB job for Loan + Then Loan Transactions tab has a transaction with date: "01 January 2023", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Accrual | 10.0 | 0.0 | 0.0 | 0.0 | 10.0 | 0.0 | + + @TestRailId:C2635 + Scenario: Verify that charge can be added to loan which is paid off and overpaid by refund + When Admin sets the business date to "10 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "10 January 2023" + And Admin successfully approves the loan on "10 January 2023" with "1000" amount and expected disbursement date on "10 January 2023" + When Admin successfully disburse the loan on "10 January 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin sets the business date to "10 January 2023" + And Customer makes "AUTOPAY" repayment on "10 January 2023" with 1000 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + When Admin makes "PAYOUT_REFUND" transaction with "AUTOPAY" payment type on "10 January 2023" with 50 EUR transaction amount + Then Loan status will be "OVERPAID" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "10 January 2023" due date and 10 EUR transaction amount + Then Loan Charges tab has a given charge with the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 10 January 2023 | Flat | 10.0 | 10.0 | 0.0 | 0.0 | + + @TestRailId:C2672 + Scenario: FEE01 - Verify the loan creation with charge: disbursement percentage fee + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + When Admin adds "LOAN_DISBURSEMENT_PERCENTAGE_FEE" charge with 1.5 % of transaction amount + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Repayment (at time of disbursement) | 15.0 | 0.0 | 0.0 | 15.0 | 0.0 | 1000.0 | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2023 | Accrual | 15.0 | 0.0 | 0.0 | 15.0 | 0.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Disbursement percentage fee | false | Disbursement | | % Amount | 15.0 | 15.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 15.0 | | 15.0 | 15.0 | | | | + | 1 | 30 | 31 January 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 15 | 0 | 1015 | 15 | 0 | 0 | 1000 | + + + @TestRailId:C2673 + Scenario: FEE02 - Verify the loan creation with charge: flat fee + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "10 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "10 January 2023" due date and 15 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 10 January 2023 | Flat | 15.0 | 0.0 | 0.0 | 15.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 January 2023 | | 0.0 | 1000.0 | 0.0 | 15.0 | 0.0 | 1015.0 | 0.0 | 0.0 | 0.0 | 1015.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 15 | 0 | 1015 | 0 | 0 | 0 | 1015 | + + @TestRailId:C2674 + Scenario: FEE03 - Verify the loan creation with charge: installment percentage fee + When Admin sets the business date to "01 January 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 | + | PIN30_INTEREST_FLAT | 1 January 2023 | 3000 | 12 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "01 January 2023" with "3000" amount and expected disbursement date on "10 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "3000" EUR transaction amount + When Admin adds "LOAN_INSTALLMENT_PERCENTAGE_FEE" charge with 1.5 % of transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 3000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment percentage fee | false | Installment Fee | | % Loan Amount + Interest | 46.35 | 0.0 | 0.0 | 46.35 | + 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 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 2000.0 | 1000.0 | 30.0 | 15.45 | 0.0 | 1045.45 | 0.0 | 0.0 | 0.0 | 1045.45 | + | 2 | 28 | 01 March 2023 | | 1000.0 | 1000.0 | 30.0 | 15.45 | 0.0 | 1045.45 | 0.0 | 0.0 | 0.0 | 1045.45 | + | 3 | 31 | 01 April 2023 | | 0.0 | 1000.0 | 30.0 | 15.45 | 0.0 | 1045.45 | 0.0 | 0.0 | 0.0 | 1045.45 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 90 | 46.35 | 0 | 3136.35 | 0 | 0 | 0 | 3136.35 | + + @TestRailId:C2675 + Scenario: FEE04 - Verify the loan creation with charge: overdue fee on principal + When Admin sets the business date to "01 January 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 | + | PIN30_INTEREST_FLAT_OVERDUE_FROM_AMOUNT | 1 January 2023 | 3000 | 12 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "01 January 2023" with "3000" amount and expected disbursement date on "10 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "3000" EUR transaction amount + When Admin sets the business date to "01 May 2023" + When Admin runs inline COB job for Loan + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 3000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | + | 01 February 2023 | Accrual | 45.0 | 0.0 | 30.0 | 0.0 | 15.0 | 0.0 | + | 01 March 2023 | Accrual | 45.0 | 0.0 | 30.0 | 0.0 | 15.0 | 0.0 | + | 01 April 2023 | Accrual | 45.0 | 0.0 | 30.0 | 0.0 | 15.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | % Late fee | true | Overdue Fees | 01 February 2023 | % Amount | 15.0 | 0.0 | 0.0 | 15.0 | + | % Late fee | true | Overdue Fees | 01 March 2023 | % Amount | 15.0 | 0.0 | 0.0 | 15.0 | + | % Late fee | true | Overdue Fees | 01 April 2023 | % Amount | 15.0 | 0.0 | 0.0 | 15.0 | + 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 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 2000.0 | 1000.0 | 30.0 | 0.0 | 15.0 | 1045.0 | 0.0 | 0.0 | 0.0 | 1045.0 | + | 2 | 28 | 01 March 2023 | | 1000.0 | 1000.0 | 30.0 | 0.0 | 15.0 | 1045.0 | 0.0 | 0.0 | 0.0 | 1045.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 1000.0 | 30.0 | 0.0 | 15.0 | 1045.0 | 0.0 | 0.0 | 0.0 | 1045.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 90 | 0.0 | 45 | 3135.0 | 0 | 0 | 0 | 3135.0 | + + @TestRailId:C2676 + Scenario: FEE05 - Verify the loan creation with charge: overdue fee on principal+interest + When Admin sets the business date to "01 January 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 | + | PIN30_INTEREST_FLAT_OVERDUE_FROM_AMOUNT_INTEREST | 1 January 2023 | 3000 | 12 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "01 January 2023" with "3000" amount and expected disbursement date on "10 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "3000" EUR transaction amount + When Admin sets the business date to "01 May 2023" + When Admin runs inline COB job for Loan + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 3000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | + | 01 February 2023 | Accrual | 45.45 | 0.0 | 30.0 | 0.0 | 15.45 | 0.0 | + | 01 March 2023 | Accrual | 45.45 | 0.0 | 30.0 | 0.0 | 15.45 | 0.0 | + | 01 April 2023 | Accrual | 45.45 | 0.0 | 30.0 | 0.0 | 15.45 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | % Late fee amount+interest | true | Overdue Fees | 01 February 2023 | % Loan Amount + Interest | 15.45 | 0.0 | 0.0 | 15.45 | + | % Late fee amount+interest | true | Overdue Fees | 01 March 2023 | % Loan Amount + Interest | 15.45 | 0.0 | 0.0 | 15.45 | + | % Late fee amount+interest | true | Overdue Fees | 01 April 2023 | % Loan Amount + Interest | 15.45 | 0.0 | 0.0 | 15.45 | + 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 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 2000.0 | 1000.0 | 30.0 | 0.0 | 15.45 | 1045.45 | 0.0 | 0.0 | 0.0 | 1045.45 | + | 2 | 28 | 01 March 2023 | | 1000.0 | 1000.0 | 30.0 | 0.0 | 15.45 | 1045.45 | 0.0 | 0.0 | 0.0 | 1045.45 | + | 3 | 31 | 01 April 2023 | | 0.0 | 1000.0 | 30.0 | 0.0 | 15.45 | 1045.45 | 0.0 | 0.0 | 0.0 | 1045.45 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 90 | 0.0 | 46.35 | 3136.35 | 0 | 0 | 0 | 3136.35 | + +# TODO Create loan product suitable for LOAN_TRANCHE_DISBURSEMENT_PERCENTAGE_FEE, replace, fix expected results + @Skip @TestRailId:C2677 + Scenario: FEE06 - Verify the loan creation with charge: tranche disbursement percentage fee, multi disbursement + When Admin sets the business date to "01 January 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 | + | PIN30_INTEREST_DECLINING_BALANCE_SAR_RECALCULATION_SAME_AS_REPAYMENT_COMPOUNDING_NONE_MULTI_DISBURSEMENT | 1 January 2023 | 3000 | 12 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "01 January 2023" with "3000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin adds "LOAN_TRANCHE_DISBURSEMENT_PERCENTAGE_FEE" charge with 1.5 % of transaction amount + When Admin sets the business date to "01 February 2023" + When Admin successfully disburse the loan on "01 February 2023" with "1000" EUR transaction amount + When Admin sets the business date to "01 March 2023" + When Admin successfully disburse the loan on "01 March 2023" with "1000" EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Repayment (at time of disbursement) | 15.0 | 0.0 | 0.0 | 15.0 | 0.0 | 0.0 | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Disbursement percentage fee | false | Disbursement | | % Amount | 15.0 | 15.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 15.0 | | 15.0 | 15.0 | | | | + | 1 | 30 | 31 January 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 15 | 0 | 1015 | 15 | 0 | 0 | 1000 | + + @TestRailId:C2790 + Scenario: Verify that partially waived installment fee applied correctly in reverse-replay logic + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + When Admin adds "LOAN_INSTALLMENT_PERCENTAGE_FEE" charge with 10 % of transaction amount + When Admin sets the business date to "15 January 2023" + And Customer makes "AUTOPAY" repayment on "15 January 2023" with 5 EUR transaction amount + When Admin sets the business date to "20 January 2023" + And Admin waives due date charge + And Customer makes "AUTOPAY" repayment on "18 January 2023" with 15 EUR transaction amount + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 January 2023 | | 0.0 | 1000.0 | 0.0 | 100.0 | 0.0 | 1100.0 | 20.0 | 20.0 | 0.0 | 985.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 100.0 | 0 | 1100.0 | 20 | 20 | 0 | 985.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 15 January 2023 | Repayment | 5.0 | 0.0 | 0.0 | 5.0 | 0.0 | 1000.0 | + | 18 January 2023 | Repayment | 15.0 | 15.0 | 0.0 | 0.0 | 0.0 | 985.0 | + | 20 January 2023 | Waive loan charges | 95.0 | 0.0 | 0.0 | 0.0 | 0.0 | 985.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Installment percentage fee | false | Installment Fee | | % Loan Amount + Interest | 100.0 | 5.0 | 95.0 | 0.0 | + + @TestRailId:C2909 + Scenario: Verify that adding charge on a closed loan after maturity date is creating an N+1 installment - PIN30 product + When Admin sets the business date to "01 October 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 October 2023" + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "31 October 2023" + And Customer makes "AUTOPAY" repayment on "31 October 2023" with 1000 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + When Admin sets the business date to "01 November 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "01 November 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 2 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 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 October 2023 | 31 October 2023 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | + | 2 | 1 | 01 November 2023 | | 0.0 | 0.0 | 0.0 | 20.0 | 0.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20.0 | 0 | 1020.0 | 1000 | 0 | 0 | 20.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 October 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 31 October 2023 | Repayment | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 01 November 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + + @TestRailId:C2910 + Scenario: Verify that adding charge on a closed loan after maturity date is creating an N+1 installment - PIN4 auto payment enabled + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "16 October 2023" + And Customer makes "AUTOPAY" repayment on "16 October 2023" with 250 EUR transaction amount + When Admin sets the business date to "31 October 2023" + And Customer makes "AUTOPAY" repayment on "31 October 2023" with 250 EUR transaction amount + When Admin sets the business date to "15 November 2023" + And Customer makes "AUTOPAY" repayment on "15 November 2023" with 250 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + When Admin sets the business date to "16 November 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "16 November 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 October 2023 | 16 October 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 October 2023 | 31 October 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 15 November 2023 | 15 November 2023 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 5 | 1 | 16 November 2023 | | 0.0 | 0.0 | 0.0 | 20.0 | 0.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 20 | 0 | 1020.0 | 1000.0 | 0 | 0 | 20 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 October 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 October 2023 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 October 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 31 October 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 15 November 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 16 November 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + + @TestRailId:C2911 + Scenario: Verify that adding charge on a closed loan after maturity date is creating an N+1 installment - PIN4 auto payment disabled + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + And Customer makes "AUTOPAY" repayment on "01 October 2023" with 250 EUR transaction amount + When Admin sets the business date to "16 October 2023" + And Customer makes "AUTOPAY" repayment on "16 October 2023" with 250 EUR transaction amount + When Admin sets the business date to "31 October 2023" + And Customer makes "AUTOPAY" repayment on "31 October 2023" with 250 EUR transaction amount + When Admin sets the business date to "15 November 2023" + And Customer makes "AUTOPAY" repayment on "15 November 2023" with 250 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + When Admin sets the business date to "16 November 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "16 November 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 October 2023 | 16 October 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 October 2023 | 31 October 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 15 November 2023 | 15 November 2023 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 5 | 1 | 16 November 2023 | | 0.0 | 0.0 | 0.0 | 20.0 | 0.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 20 | 0 | 1020.0 | 1000.0 | 0 | 0 | 20 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 October 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 October 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 October 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 31 October 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 15 November 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 16 November 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + + @TestRailId:C2912 @AdvancedPaymentAllocation + Scenario: Verify that adding charge on a closed loan after maturity date is creating an N+1 installment - PIN4 advanced payment allocation product + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "16 October 2023" + And Customer makes "AUTOPAY" repayment on "16 October 2023" with 250 EUR transaction amount + When Admin sets the business date to "31 October 2023" + And Customer makes "AUTOPAY" repayment on "31 October 2023" with 250 EUR transaction amount + When Admin sets the business date to "15 November 2023" + And Customer makes "AUTOPAY" repayment on "15 November 2023" with 250 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + When Admin sets the business date to "16 November 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "16 November 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 October 2023 | 16 October 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 October 2023 | 31 October 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 15 November 2023 | 15 November 2023 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 5 | 1 | 16 November 2023 | | 0.0 | 0.0 | 0.0 | 20.0 | 0.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 20 | 0 | 1020.0 | 1000.0 | 0 | 0 | 20 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 October 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 October 2023 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 October 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 31 October 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 15 November 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 16 November 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + + @TestRailId:C2914 + Scenario: Verify that adding charge on a active loan / partial repayment after maturity date is creating an N+1 installment - PIN30 product + When Admin sets the business date to "01 October 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 October 2023" + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "31 October 2023" + And Customer makes "AUTOPAY" repayment on "31 October 2023" with 800 EUR transaction amount + Then Loan status will be "ACTIVE" + Then Loan has 200 outstanding amount + When Admin sets the business date to "01 November 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "01 November 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 2 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 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 October 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 800.0 | 0.0 | 0.0 | 200.0 | + | 2 | 1 | 01 November 2023 | | 0.0 | 0.0 | 0.0 | 20.0 | 0.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20.0 | 0 | 1020.0 | 800 | 0 | 0 | 220.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 October 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 31 October 2023 | Repayment | 800.0 | 800.0 | 0.0 | 0.0 | 0.0 | 200.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 01 November 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + + @TestRailId:C2915 + Scenario: Verify that adding charge on a active loan / partial repayment after maturity date is creating an N+1 installment - PIN4 auto payment enabled + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "16 October 2023" + And Customer makes "AUTOPAY" repayment on "16 October 2023" with 250 EUR transaction amount + When Admin sets the business date to "31 October 2023" + And Customer makes "AUTOPAY" repayment on "31 October 2023" with 250 EUR transaction amount + When Admin sets the business date to "15 November 2023" + And Customer makes "AUTOPAY" repayment on "15 November 2023" with 100 EUR transaction amount + Then Loan status will be "ACTIVE" + Then Loan has 150 outstanding amount + When Admin sets the business date to "16 November 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "16 November 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 October 2023 | 16 October 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 October 2023 | 31 October 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 15 November 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 100.0 | 0.0 | 0.0 | 150.0 | + | 5 | 1 | 16 November 2023 | | 0.0 | 0.0 | 0.0 | 20.0 | 0.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 20 | 0 | 1020.0 | 850.0 | 0 | 0 | 170 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 October 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 October 2023 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 October 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 31 October 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 15 November 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 150.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 16 November 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + + @TestRailId:C2916 + Scenario: Verify that adding charge on a active loan / partial repayment after maturity date is creating an N+1 installment - PIN4 auto payment disabled + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + And Customer makes "AUTOPAY" repayment on "01 October 2023" with 250 EUR transaction amount + When Admin sets the business date to "16 October 2023" + And Customer makes "AUTOPAY" repayment on "16 October 2023" with 250 EUR transaction amount + When Admin sets the business date to "31 October 2023" + And Customer makes "AUTOPAY" repayment on "31 October 2023" with 250 EUR transaction amount + When Admin sets the business date to "15 November 2023" + And Customer makes "AUTOPAY" repayment on "15 November 2023" with 100 EUR transaction amount + Then Loan status will be "ACTIVE" + Then Loan has 150 outstanding amount + When Admin sets the business date to "16 November 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "16 November 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 October 2023 | 16 October 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 October 2023 | 31 October 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 15 November 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 100.0 | 0.0 | 0.0 | 150.0 | + | 5 | 1 | 16 November 2023 | | 0.0 | 0.0 | 0.0 | 20.0 | 0.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 20 | 0 | 1020.0 | 850.0 | 0 | 0 | 170 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 October 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 October 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 October 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 31 October 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 15 November 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 150.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 16 November 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + + @TestRailId:C2917 @AdvancedPaymentAllocation + Scenario: Verify that adding charge on an active loan / partial repayment after maturity date is creating an N+1 installment - PIN4 advanced payment allocation product + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "16 October 2023" + And Customer makes "AUTOPAY" repayment on "16 October 2023" with 250 EUR transaction amount + When Admin sets the business date to "31 October 2023" + And Customer makes "AUTOPAY" repayment on "31 October 2023" with 250 EUR transaction amount + When Admin sets the business date to "15 November 2023" + And Customer makes "AUTOPAY" repayment on "15 November 2023" with 100 EUR transaction amount + Then Loan status will be "ACTIVE" + Then Loan has 150 outstanding amount + When Admin sets the business date to "16 November 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "16 November 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 October 2023 | 16 October 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 October 2023 | 31 October 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 15 November 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 100.0 | 0.0 | 0.0 | 150.0 | + | 5 | 1 | 16 November 2023 | | 0.0 | 0.0 | 0.0 | 20.0 | 0.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 20 | 0 | 1020.0 | 850.0 | 0 | 0 | 170 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 October 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 October 2023 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 October 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 31 October 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 15 November 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 150.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 16 November 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + + @TestRailId:C2918 + Scenario: Verify that adding charge on a active loan / no repayment made, after maturity date is creating an N+1 installment - PIN30 product + When Admin sets the business date to "01 October 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 October 2023" + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + Then Loan has 1000 outstanding amount + When Admin sets the business date to "01 November 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "01 November 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 2 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 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 October 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 2 | 1 | 01 November 2023 | | 0.0 | 0.0 | 0.0 | 20.0 | 0.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20.0 | 0 | 1020.0 | 0 | 0 | 0 | 1020.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 October 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 01 November 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + + @TestRailId:C2919 + Scenario: Verify that adding charge on a active loan / no repayment made, after maturity date is creating an N+1 installment - PIN4 auto payment enabled + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + Then Loan has 750 outstanding amount + When Admin sets the business date to "16 November 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "16 November 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 October 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 31 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 15 November 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 16 November 2023 | | 0.0 | 0.0 | 0.0 | 20.0 | 0.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 20 | 0 | 1020.0 | 250.0 | 0 | 0 | 770 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 October 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 October 2023 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 16 November 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + + @TestRailId:C2920 + Scenario: Verify that adding charge on a active loan / no repayment made, after maturity date is creating an N+1 installment - PIN4 auto payment disabled + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + Then Loan has 1000 outstanding amount + When Admin sets the business date to "16 November 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "16 November 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 October 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 31 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 15 November 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 16 November 2023 | | 0.0 | 0.0 | 0.0 | 20.0 | 0.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 20 | 0 | 1020.0 | 0.0 | 0 | 0 | 1020 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 October 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 16 November 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + + @TestRailId:C2921 @AdvancedPaymentAllocation + Scenario: Verify that adding charge on an active loan / no repayment made, after maturity date is creating an N+1 installment - PIN4 advanced payment allocation product + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + Then Loan status will be "ACTIVE" + Then Loan has 750 outstanding amount + When Admin sets the business date to "16 November 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "16 November 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 October 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 31 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 15 November 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 1 | 16 November 2023 | | 0.0 | 0.0 | 0.0 | 20.0 | 0.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 20 | 0 | 1020.0 | 250.0 | 0 | 0 | 770 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 October 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 October 2023 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 16 November 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + + @TestRailId:C2923 @AdvancedPaymentAllocation + Scenario: Verify Loan charge reverse-replaying logic for PIN4 advanced payment allocation product - UC1 + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "10 October 2023" + And Customer makes "AUTOPAY" repayment on "10 October 2023" with 300 EUR transaction amount + When Admin sets the business date to "20 October 2023" + And Customer makes "AUTOPAY" repayment on "20 October 2023" with 250 EUR transaction amount + When Admin sets the business date to "10 November 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "09 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 October 2023 | 10 October 2023 | 500.0 | 250.0 | 0.0 | 20.0 | 0.0 | 270.0 | 270.0 | 270.0 | 0.0 | 0.0 | + | 3 | 15 | 31 October 2023 | 20 October 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 4 | 15 | 15 November 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 30.0 | 30.0 | 0.0 | 220.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 20.0 | 0.0 | 1020.0 | 800.0 | 550.0 | 0.0 | 220.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 October 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 October 2023 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 10 October 2023 | Repayment | 300.0 | 280.0 | 0.0 | 20.0 | 0.0 | 470.0 | + | 20 October 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 220.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 09 October 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + + @TestRailId:C2924 @AdvancedPaymentAllocation + Scenario: Verify Loan charge reverse-replaying logic for PIN4 advanced payment allocation product - UC2 + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "10 October 2023" + And Customer makes "AUTOPAY" repayment on "10 October 2023" with 300 EUR transaction amount + When Admin sets the business date to "20 October 2023" + And Customer makes "AUTOPAY" repayment on "20 October 2023" with 250 EUR transaction amount + When Admin sets the business date to "10 November 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "10 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 October 2023 | 20 October 2023 | 500.0 | 250.0 | 0.0 | 20.0 | 0.0 | 270.0 | 270.0 | 250.0 | 20.0 | 0.0 | + | 3 | 15 | 31 October 2023 | 20 October 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 4 | 15 | 15 November 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 30.0 | 30.0 | 0.0 | 220.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 20.0 | 0.0 | 1020.0 | 800.0 | 530.0 | 20.0 | 220.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 October 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 October 2023 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 10 October 2023 | Repayment | 300.0 | 300.0 | 0.0 | 0.0 | 0.0 | 450.0 | + | 20 October 2023 | Repayment | 250.0 | 230.0 | 0.0 | 20.0 | 0.0 | 220.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 10 October 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + + @TestRailId:C2925 @AdvancedPaymentAllocation + Scenario: Verify Loan charge reverse-replaying logic for PIN4 advanced payment allocation product - UC3 + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "10 October 2023" + And Customer makes "AUTOPAY" repayment on "10 October 2023" with 300 EUR transaction amount + When Admin sets the business date to "20 October 2023" + And Customer makes "AUTOPAY" repayment on "20 October 2023" with 250 EUR transaction amount + When Admin sets the business date to "10 November 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "11 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 October 2023 | 20 October 2023 | 500.0 | 250.0 | 0.0 | 20.0 | 0.0 | 270.0 | 270.0 | 250.0 | 20.0 | 0.0 | + | 3 | 15 | 31 October 2023 | 20 October 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 4 | 15 | 15 November 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 30.0 | 30.0 | 0.0 | 220.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 20.0 | 0.0 | 1020.0 | 800.0 | 530.0 | 20.0 | 220.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 October 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 October 2023 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 10 October 2023 | Repayment | 300.0 | 300.0 | 0.0 | 0.0 | 0.0 | 450.0 | + | 20 October 2023 | Repayment | 250.0 | 230.0 | 0.0 | 20.0 | 0.0 | 220.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 11 October 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + + @TestRailId:C2926 @AdvancedPaymentAllocation + Scenario: Verify Loan charge reverse-replaying logic for PIN4 advanced payment allocation product - UC4 + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "10 October 2023" + And Customer makes "AUTOPAY" repayment on "10 October 2023" with 300 EUR transaction amount + When Admin sets the business date to "20 October 2023" + And Customer makes "AUTOPAY" repayment on "20 October 2023" with 250 EUR transaction amount + When Admin sets the business date to "10 November 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "16 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 October 2023 | 20 October 2023 | 500.0 | 250.0 | 0.0 | 20.0 | 0.0 | 270.0 | 270.0 | 250.0 | 20.0 | 0.0 | + | 3 | 15 | 31 October 2023 | 20 October 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 4 | 15 | 15 November 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 30.0 | 30.0 | 0.0 | 220.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 20.0 | 0.0 | 1020.0 | 800.0 | 530.0 | 20.0 | 220.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 October 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 October 2023 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 10 October 2023 | Repayment | 300.0 | 300.0 | 0.0 | 0.0 | 0.0 | 450.0 | + | 20 October 2023 | Repayment | 250.0 | 230.0 | 0.0 | 20.0 | 0.0 | 220.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 16 October 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + + @TestRailId:C2927 @AdvancedPaymentAllocation + Scenario: Verify Loan charge reverse-replaying logic for PIN4 advanced payment allocation product - UC5 + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "10 October 2023" + And Customer makes "AUTOPAY" repayment on "10 October 2023" with 300 EUR transaction amount + When Admin sets the business date to "20 October 2023" + And Customer makes "AUTOPAY" repayment on "20 October 2023" with 250 EUR transaction amount + When Admin sets the business date to "10 November 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "17 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 October 2023 | 10 October 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 3 | 15 | 31 October 2023 | 20 October 2023 | 250.0 | 250.0 | 0.0 | 20.0 | 0.0 | 270.0 | 270.0 | 270.0 | 0.0 | 0.0 | + | 4 | 15 | 15 November 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 30.0 | 30.0 | 0.0 | 220.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 20.0 | 0.0 | 1020.0 | 800.0 | 550.0 | 0.0 | 220.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 October 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 October 2023 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 10 October 2023 | Repayment | 300.0 | 300.0 | 0.0 | 0.0 | 0.0 | 450.0 | + | 20 October 2023 | Repayment | 250.0 | 230.0 | 0.0 | 20.0 | 0.0 | 220.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 17 October 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + + @TestRailId:C2928 @AdvancedPaymentAllocation + Scenario: Verify Loan charge reverse-replaying logic for PIN4 advanced payment allocation product - UC6 + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "16 October 2023" + And Customer makes "AUTOPAY" repayment on "16 October 2023" with 300 EUR transaction amount + When Admin sets the business date to "10 November 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "10 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 October 2023 | 16 October 2023 | 500.0 | 250.0 | 0.0 | 20.0 | 0.0 | 270.0 | 270.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 30.0 | 30.0 | 0.0 | 220.0 | + | 4 | 15 | 15 November 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 20.0 | 0.0 | 1020.0 | 550.0 | 30.0 | 0.0 | 470.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 October 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 October 2023 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 October 2023 | Repayment | 300.0 | 280.0 | 0.0 | 20.0 | 0.0 | 470.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 10 October 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + + @TestRailId:C2929 @AdvancedPaymentAllocation + Scenario: Verify Loan charge reverse-replaying logic for PIN4 advanced payment allocation product - UC7 + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "16 October 2023" + And Customer makes "AUTOPAY" repayment on "16 October 2023" with 300 EUR transaction amount + When Admin sets the business date to "10 November 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "16 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 October 2023 | | 500.0 | 250.0 | 0.0 | 20.0 | 0.0 | 270.0 | 250.0 | 0.0 | 0.0 | 20.0 | + | 3 | 15 | 31 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 50.0 | 50.0 | 0.0 | 200.0 | + | 4 | 15 | 15 November 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 20.0 | 0.0 | 1020.0 | 550.0 | 50.0 | 0.0 | 470.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 October 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 October 2023 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 October 2023 | Repayment | 300.0 | 300.0 | 0.0 | 0.0 | 0.0 | 450.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 16 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + + @TestRailId:C2930 @AdvancedPaymentAllocation + Scenario: Verify Loan charge reverse-replaying logic for PIN4 advanced payment allocation product - UC8 + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "16 October 2023" + And Customer makes "AUTOPAY" repayment on "16 October 2023" with 300 EUR transaction amount + When Admin sets the business date to "10 November 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "17 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 October 2023 | 16 October 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 October 2023 | | 250.0 | 250.0 | 0.0 | 20.0 | 0.0 | 270.0 | 50.0 | 50.0 | 0.0 | 220.0 | + | 4 | 15 | 15 November 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 20.0 | 0.0 | 1020.0 | 550.0 | 50.0 | 0.0 | 470.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 October 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 October 2023 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 October 2023 | Repayment | 300.0 | 300.0 | 0.0 | 0.0 | 0.0 | 450.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 17 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + + @TestRailId:C2931 @AdvancedPaymentAllocation + Scenario: Verify Loan charge reverse-replaying logic for PIN4 advanced payment allocation product - UC9 + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "16 October 2023" + And Customer makes "AUTOPAY" repayment on "16 October 2023" with 300 EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "16 October 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 October 2023 | | 500.0 | 250.0 | 0.0 | 20.0 | 0.0 | 270.0 | 250.0 | 0.0 | 0.0 | 20.0 | + | 3 | 15 | 31 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 50.0 | 50.0 | 0.0 | 200.0 | + | 4 | 15 | 15 November 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 20.0 | 0.0 | 1020.0 | 550.0 | 50.0 | 0.0 | 470.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 October 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 October 2023 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 October 2023 | Repayment | 300.0 | 300.0 | 0.0 | 0.0 | 0.0 | 450.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 16 October 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + + @TestRailId:C2932 @AdvancedPaymentAllocation + Scenario: Verify Loan charge reverse-replaying logic for PIN4 advanced payment allocation product - UC10 + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "16 October 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "16 October 2023" due date and 20 EUR transaction amount + And Customer makes "AUTOPAY" repayment on "16 October 2023" with 300 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 October 2023 | 16 October 2023 | 500.0 | 250.0 | 0.0 | 20.0 | 0.0 | 270.0 | 270.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 30.0 | 30.0 | 0.0 | 220.0 | + | 4 | 15 | 15 November 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 20.0 | 0.0 | 1020.0 | 550.0 | 30.0 | 0.0 | 470.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 October 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 October 2023 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 October 2023 | Repayment | 300.0 | 280.0 | 0.0 | 20.0 | 0.0 | 470.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 16 October 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + + @TestRailId:C2933 @AdvancedPaymentAllocation + Scenario: Verify Loan charge reverse-replaying logic for PIN4 advanced payment allocation product - UC11 + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "15 October 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "15 October 2023" due date and 20 EUR transaction amount + When Admin sets the business date to "16 October 2023" + And Customer makes "AUTOPAY" repayment on "16 October 2023" with 300 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 October 2023 | 16 October 2023 | 500.0 | 250.0 | 0.0 | 20.0 | 0.0 | 270.0 | 270.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 30.0 | 30.0 | 0.0 | 220.0 | + | 4 | 15 | 15 November 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 20.0 | 0.0 | 1020.0 | 550.0 | 30.0 | 0.0 | 470.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 October 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 October 2023 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 16 October 2023 | Repayment | 300.0 | 280.0 | 0.0 | 20.0 | 0.0 | 470.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 15 October 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + + @TestRailId:C2993 + Scenario: Waive charge on PIN4 cumulative loan product + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2023 | 750 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2023" with "750" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "750" EUR transaction amount + When Admin sets the business date to "01 February 2023" + And Customer makes "AUTOPAY" repayment on "01 February 2023" with 250 EUR transaction amount + When Admin sets the business date to "01 March 2023" + And Customer makes "AUTOPAY" repayment on "01 March 2023" with 250 EUR transaction amount + When Admin sets the business date to "01 April 2023" + And Customer makes "AUTOPAY" repayment on "01 April 2023" with 250 EUR transaction amount + When Customer makes a repayment undo on "01 April 2023" + When Admin sets the business date to "05 April 2023" + And Admin adds an NSF fee because of payment bounce with "05 April 2023" transaction date + When Admin sets the business date to "07 April 2023" + And Admin waives charge + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 05 April 2023 | Flat | 10.0 | 0.0 | 10.0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 750.0 | 0.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 01 January 2023 | Down Payment | 187.5 | 187.5 | 0.0 | 0.0 | 0.0 | 562.5 | + | 01 February 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 312.5 | + | 01 March 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 62.5 | + | 01 April 2023 | Repayment | 250.0 | 62.5 | 0.0 | 0.0 | 0.0 | 0.0 | + | 05 April 2023 | Waive loan charges | 10.0 | 0.0 | 0.0 | 0.0 | 0.0 | 62.5 | + Then On Loan Transactions tab the "Repayment" Transaction with date "01 April 2023" is reverted + Then Loan Repayment schedule has 5 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 | Waived | Outstanding | + | | | 01 January 2023 | | 750.0 | | | 0.0 | | 0.0 | 0.0 | | | | | + | 1 | 0 | 01 January 2023 | 01 February 2023 | 562.0 | 188.0 | 0.0 | 0.0 | 0.0 | 188.0 | 188.0 | 0.0 | 0.5 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2023 | 01 February 2023 | 375.0 | 187.0 | 0.0 | 0.0 | 0.0 | 187.0 | 187.0 | 0.0 | 187.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2023 | 01 March 2023 | 188.0 | 187.0 | 0.0 | 0.0 | 0.0 | 187.0 | 187.0 | 0.0 | 187.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 188.0 | 0.0 | 0.0 | 0.0 | 188.0 | 125.5 | 0.0 | 125.5 | 0.0 | 62.5 | + | 5 | 49 | 05 April 2023 | 05 April 2023 | 0.0 | 0.0 | 0.0 | 0.0 | 10.0 | 10.0 | 0.0 | 0.0 | 0.0 | 10.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Waived | Outstanding | + | 750 | 0 | 0 | 10 | 760 | 687.5 | 0 | 500 | 10 | 62.5 | + + @TestRailId:C2994 + Scenario: Waive charge on PIN4 progressive loan + When Admin sets the business date to "01 January 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 January 2023 | 750 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2023" with "750" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "750" EUR transaction amount + When Admin sets the business date to "01 February 2023" + And Customer makes "AUTOPAY" repayment on "01 February 2023" with 250 EUR transaction amount + When Admin sets the business date to "01 March 2023" + And Customer makes "AUTOPAY" repayment on "01 March 2023" with 250 EUR transaction amount + When Admin sets the business date to "01 April 2023" + And Customer makes "AUTOPAY" repayment on "01 April 2023" with 250 EUR transaction amount + When Customer makes a repayment undo on "01 April 2023" + When Admin sets the business date to "05 April 2023" + And Admin adds an NSF fee because of payment bounce with "05 April 2023" transaction date + When Admin sets the business date to "07 April 2023" + And Admin waives charge + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 05 April 2023 | Flat | 10.0 | 0.0 | 10.0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 750.0 | 0.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 01 February 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 March 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 01 April 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 05 April 2023 | Waive loan charges | 10.0 | 0.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then On Loan Transactions tab the "Repayment" Transaction with date "01 April 2023" is reverted + Then Loan Repayment schedule has 5 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 | Waived | Outstanding | + | | | 01 January 2023 | | 750.0 | | | 0.0 | | 0.0 | 0.0 | | | | | + | 1 | 0 | 01 January 2023 | 01 February 2023 | 562.5 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | 187.5 | 0.0 | 187.5 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2023 | 01 March 2023 | 375.0 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | 187.5 | 0.0 | 187.5 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2023 | | 187.5 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | 125.0 | 0.0 | 125.0 | 0.0 | 62.5 | + | 4 | 15 | 15 February 2023 | | 0.0 | 187.5 | 0.0 | 0.0 | 0.0 | 187.5 | 0.0 | 0.0 | 0.0 | 0.0 | 187.5 | + | 5 | 49 | 05 April 2023 | 05 April 2023 | 0.0 | 0.0 | 0.0 | 0.0 | 10.0 | 10.0 | 0.0 | 0.0 | 0.0 | 10.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Waived | Outstanding | + | 750 | 0 | 0 | 10 | 760 | 500 | 0 | 500 | 10 | 250 | + + @TestRailId:C2995 + Scenario: Verify that when a charge added after maturity had been waived the added N+1 installment will be paid with a paid by date (obligations met date) of the transaction date of the waive charge transaction + When Admin sets the business date to "01 January 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 January 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "22 February 2023" + When Admin adds "LOAN_NSF_FEE" due date charge with "22 February 2023" due date and 100 EUR transaction amount + When Admin sets the business date to "31 March 2023" + And Admin waives due date charge + When Admin runs inline COB job for Loan + Then Loan Repayment schedule has 5 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 | Waived | Outstanding | + | | | 01 January 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | | + | 1 | 0 | 01 January 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 January 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 31 January 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 7 | 22 February 2023 | 22 February 2023 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Waived | Outstanding | + | 1000.0 | 0.0 | 0.0 | 100.0 | 1100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 1000.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 22 February 2023 | Waive loan charges | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 22 February 2023 | Flat | 100.0 | 0.0 | 100.0 | 0.0 | diff --git a/fineract-e2e-tests-runner/src/test/resources/features/LoanChargeOff.feature b/fineract-e2e-tests-runner/src/test/resources/features/LoanChargeOff.feature new file mode 100644 index 00000000000..eff4c408dda --- /dev/null +++ b/fineract-e2e-tests-runner/src/test/resources/features/LoanChargeOff.feature @@ -0,0 +1,1583 @@ +@ChargeOffFeature +Feature: Charge-off + + @TestRailId:C2565 + Scenario: As a user I want to do a Charge-off for non-fraud loan after disbursement + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "22 February 2023" + And Admin does charge-off the loan on "22 February 2023" + Then Loan marked as charged-off on "22 February 2023" + Then Loan status will be "ACTIVE" + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 1000.0 | | + + @TestRailId:C2566 + Scenario: As a user I want to do a Charge-off for non-fraud loan after repayment + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "5 January 2023" + And Customer makes "AUTOPAY" repayment on "5 January 2023" with 250 EUR transaction amount + When Admin sets the business date to "22 February 2023" + And Admin does charge-off the loan on "22 February 2023" + Then Loan marked as charged-off on "22 February 2023" + Then Loan status will be "ACTIVE" + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "05 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 750.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 750.0 | | + + @TestRailId:C2567 + Scenario: As a user I want to do a Repayment undo after Charge-off for non-fraud + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "5 January 2023" + And Customer makes "AUTOPAY" repayment on "5 January 2023" with 250 EUR transaction amount + When Admin sets the business date to "22 February 2023" + And Admin does charge-off the loan on "22 February 2023" + Then Loan marked as charged-off on "22 February 2023" + When Customer undo "1"th repayment on "05 January 2023" + Then Loan status will be "ACTIVE" + Then On Loan Transactions tab the "Repayment" Transaction with date "05 January 2023" is reverted + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "05 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + | ASSET | 112601 | Loans Receivable | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 1000.0 | | + + @TestRailId:C2568 + Scenario: As a user I want to do Charge-off for fraud loan when FEE is added + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + And Admin adds an NSF fee because of payment bounce with "1 January 2023" transaction date + When Admin sets the business date to "22 February 2023" + And Admin does charge-off the loan on "22 February 2023" + Then Loan marked as charged-off on "22 February 2023" + Then Loan status will be "ACTIVE" + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 10.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 1000.0 | | + | INCOME | 404008 | Fee Charge Off | 10.0 | | + + @TestRailId:C2569 + Scenario: As a user I want to do a Merchant Refund after charge-off (fee portion) + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + And Admin adds an NSF fee because of payment bounce with "1 January 2023" transaction date + When Admin sets the business date to "22 February 2023" + And Admin does charge-off the loan on "22 February 2023" + Then Loan marked as charged-off on "22 February 2023" + When Admin makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "22 February 2023" with 100 EUR transaction amount + Then Loan status will be "ACTIVE" + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 10.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 1000.0 | | + | INCOME | 404008 | Fee Charge Off | 10.0 | | + Then Loan Transactions tab has a "MERCHANT_ISSUED_REFUND" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | EXPENSE | 744007 | Credit Loss/Bad Debt | | 90.0 | + | INCOME | 404008 | Fee Charge Off | | 10.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 100.0 | | + + @TestRailId:C2570 + Scenario: As a user I want to do a Charge-off for non-fraud loan when FEE and PENALTY added + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + And Admin adds an NSF fee because of payment bounce with "1 January 2023" transaction date + When Admin sets the business date to "22 February 2023" + And Admin adds a 10 % Processing charge to the loan with "en" locale on date: "22 February 2023" + And Admin does charge-off the loan on "22 February 2023" + Then Loan marked as charged-off on "22 February 2023" + Then Loan status will be "ACTIVE" + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 110.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 1000.0 | | + | INCOME | 404008 | Fee Charge Off | 110.0 | | + + @Skip @TestRailId:C2571 @chargeoffOnLoanWithInterest + Scenario: As a user I want to do Charge-off for non-fraud loan when FEE and PENALTY added (interest portion) + When Admin sets the business date to "1 January 2023" + 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 | + | PIN30_INTEREST_FLAT | 1 January 2023 | 1000 | 12 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + And Admin adds an NSF fee because of payment bounce with "1 January 2023" transaction date + When Admin sets the business date to "22 February 2023" + And Admin adds a 10 % Processing charge to the loan with "en" locale on date: "22 February 2023" + And Admin does charge-off the loan on "22 February 2023" + Then Loan marked as charged-off on "22 February 2023" + Then Loan status will be "ACTIVE" + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 143.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 1000.0 | | + | INCOME | 404001 | Interest Income Charge Off | 30.0 | | + | INCOME | 404008 | Fee Charge Off | 113.0 | | + + @Skip @TestRailId:C2572 @chargeoffOnLoanWithInterest + Scenario: As a user I want to do a Merchant Refund after charge-off for non fraud loan (interest portion) + When Admin sets the business date to "1 January 2023" + 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 | + | PIN30_INTEREST_FLAT | 1 January 2023 | 1000 | 12 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + And Admin adds an NSF fee because of payment bounce with "1 January 2023" transaction date + When Admin sets the business date to "22 February 2023" + And Admin adds a 10 % Processing charge to the loan with "en" locale on date: "22 February 2023" + And Admin does charge-off the loan on "22 February 2023" + Then Loan marked as charged-off on "22 February 2023" + When Admin makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "22 February 2023" with 500 EUR transaction amount + Then Loan status will be "ACTIVE" + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 143.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 1000.0 | | + | INCOME | 404001 | Interest Income Charge Off | 30.0 | | + | INCOME | 404008 | Fee Charge Off | 113.0 | | + Then Loan Transactions tab has a "MERCHANT_ISSUED_REFUND" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | EXPENSE | 744007 | Credit Loss/Bad Debt | | 367.0 | + | INCOME | 404001 | Interest Income Charge Off | | 20.0 | + | INCOME | 404008 | Fee Charge Off | | 113.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | + + + @Skip @TestRailId:C2573 @chargeoffOnLoanWithInterest + Scenario: As a user I want to do a Payout refund after charge-off for non fraud loan (interest portion) + When Admin sets the business date to "1 January 2023" + 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 | + | PIN30_INTEREST_FLAT | 1 January 2023 | 1000 | 12 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + And Admin adds an NSF fee because of payment bounce with "1 January 2023" transaction date + When Admin sets the business date to "22 February 2023" + And Admin adds a 10 % Processing charge to the loan with "en" locale on date: "22 February 2023" + And Admin does charge-off the loan on "22 February 2023" + Then Loan marked as charged-off on "22 February 2023" + When Admin makes "PAYOUT_REFUND" transaction with "AUTOPAY" payment type on "22 February 2023" with 500 EUR transaction amount + Then Loan status will be "ACTIVE" + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 143.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 1000.0 | | + | INCOME | 404001 | Interest Income Charge Off | 30.0 | | + | INCOME | 404008 | Fee Charge Off | 113.0 | | + Then Loan Transactions tab has a "PAYOUT_REFUND" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | EXPENSE | 744007 | Credit Loss/Bad Debt | | 367.0 | + | INCOME | 404001 | Interest Income Charge Off | | 20.0 | + | INCOME | 404008 | Fee Charge Off | | 113.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | + + @Skip @TestRailId:C2574 @chargeoffOnLoanWithInterest + Scenario: As a user I want to do a Repayment after Charge-off for fraud loan when FEE and PENALTY added (product with interest) + When Admin sets the business date to "1 January 2023" + 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 | + | PIN30_INTEREST_FLAT | 1 January 2023 | 1000 | 12 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + And Admin adds an NSF fee because of payment bounce with "1 January 2023" transaction date + When Admin sets the business date to "22 February 2023" + And Admin adds a 10 % Processing charge to the loan with "en" locale on date: "22 February 2023" + And Admin does charge-off the loan on "22 February 2023" + Then Loan marked as charged-off on "22 February 2023" + When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "22 February 2023" with 500 EUR transaction amount and system-generated Idempotency key + Then Loan status will be "ACTIVE" + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 143.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 1000.0 | | + | INCOME | 404001 | Interest Income Charge Off | 30.0 | | + | INCOME | 404008 | Fee Charge Off | 113.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | INCOME | 744008 | Recoveries | | 500.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | + + + @TestRailId:C2575 + Scenario: As a user I want to do a Charge-off for fraud loan after disbursement + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "22 February 2023" + Then Admin can successfully set Fraud flag to the loan + And Admin does charge-off the loan on "22 February 2023" + Then Loan marked as charged-off on "22 February 2023" + Then Loan status will be "ACTIVE" + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | EXPENSE | 744037 | Credit Loss/Bad Debt-Fraud | 1000.0 | | + + @TestRailId:C2576 + Scenario: As a user I want to do a Repayment undo after Charge-off for fraud loan + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "5 January 2023" + And Customer makes "AUTOPAY" repayment on "5 January 2023" with 250 EUR transaction amount + When Admin sets the business date to "22 February 2023" + Then Admin can successfully set Fraud flag to the loan + And Admin does charge-off the loan on "22 February 2023" + Then Loan marked as charged-off on "22 February 2023" + When Customer undo "1"th repayment on "05 January 2023" + Then Loan status will be "ACTIVE" + Then On Loan Transactions tab the "Repayment" Transaction with date "05 January 2023" is reverted + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "05 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + | ASSET | 112601 | Loans Receivable | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | EXPENSE | 744037 | Credit Loss/Bad Debt-Fraud | 1000.0 | | + + @TestRailId:C2577 + Scenario: As a user I want to do a Charge-off for fraud loan when FEE is added + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + And Admin adds an NSF fee because of payment bounce with "1 January 2023" transaction date + When Admin sets the business date to "22 February 2023" + Then Admin can successfully set Fraud flag to the loan + And Admin does charge-off the loan on "22 February 2023" + Then Loan marked as charged-off on "22 February 2023" + Then Loan status will be "ACTIVE" + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 10.0 | + | EXPENSE | 744037 | Credit Loss/Bad Debt-Fraud | 1000.0 | | + | INCOME | 404008 | Fee Charge Off | 10.0 | | + + @TestRailId:C2578 + Scenario: As a user I want to do a Charge-off for fraud loan when FEE and PENALTY added + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + And Admin adds an NSF fee because of payment bounce with "1 January 2023" transaction date + When Admin sets the business date to "22 February 2023" + And Admin adds a 10 % Processing charge to the loan with "en" locale on date: "22 February 2023" + Then Admin can successfully set Fraud flag to the loan + And Admin does charge-off the loan on "22 February 2023" + Then Loan marked as charged-off on "22 February 2023" + Then Loan status will be "ACTIVE" + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 110.0 | + | EXPENSE | 744037 | Credit Loss/Bad Debt-Fraud | 1000.0 | | + | INCOME | 404008 | Fee Charge Off | 110.0 | | + + @Skip @TestRailId:C2579 @chargeoffOnLoanWithInterest + Scenario: As a user I want to do a Charge-off for fraud loan when FEE and PENALTY added (interest portion) + When Admin sets the business date to "1 January 2023" + 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 | + | PIN30_INTEREST_FLAT | 1 January 2023 | 1000 | 12 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + And Admin adds an NSF fee because of payment bounce with "1 January 2023" transaction date + When Admin sets the business date to "22 February 2023" + And Admin adds a 10 % Processing charge to the loan with "en" locale on date: "22 February 2023" + Then Admin can successfully set Fraud flag to the loan + And Admin does charge-off the loan on "22 February 2023" + Then Loan marked as charged-off on "22 February 2023" + Then Loan status will be "ACTIVE" + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 143.0 | + | EXPENSE | 744037 | Credit Loss/Bad Debt-Fraud | 1000.0 | | + | INCOME | 404001 | Interest Income Charge Off | 30.0 | | + | INCOME | 404008 | Fee Charge Off | 113.0 | | + + @Skip @TestRailId:C2580 @chargeoffOnLoanWithInterest + Scenario: As a user I want to do a Merchant issue refund for fraud loan when FEE and PENALTY added (interest portion) + When Admin sets the business date to "1 January 2023" + 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 | + | PIN30_INTEREST_FLAT | 1 January 2023 | 1000 | 12 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + And Admin adds an NSF fee because of payment bounce with "1 January 2023" transaction date + When Admin sets the business date to "22 February 2023" + And Admin adds a 10 % Processing charge to the loan with "en" locale on date: "22 February 2023" + Then Admin can successfully set Fraud flag to the loan + And Admin does charge-off the loan on "22 February 2023" + Then Loan marked as charged-off on "22 February 2023" + When Admin makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "22 February 2023" with 500 EUR transaction amount + Then Loan status will be "ACTIVE" + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 143.0 | + | EXPENSE | 744037 | Credit Loss/Bad Debt-Fraud | 1000.0 | | + | INCOME | 404001 | Interest Income Charge Off | 30.0 | | + | INCOME | 404008 | Fee Charge Off | 113.0 | | + Then Loan Transactions tab has a "MERCHANT_ISSUED_REFUND" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | EXPENSE | 744037 | Credit Loss/Bad Debt-Fraud | | 367.0 | + | INCOME | 404001 | Interest Income Charge Off | | 20.0 | + | INCOME | 404008 | Fee Charge Off | | 113.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | + + @Skip @TestRailId:C2581 @chargeoffOnLoanWithInterest + Scenario: As a user I want to do Payout refund for fraud loan when FEE and PENALTY added (interest portion) + When Admin sets the business date to "1 January 2023" + 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 | + | PIN30_INTEREST_FLAT | 1 January 2023 | 1000 | 12 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + And Admin adds an NSF fee because of payment bounce with "1 January 2023" transaction date + When Admin sets the business date to "22 February 2023" + And Admin adds a 10 % Processing charge to the loan with "en" locale on date: "22 February 2023" + Then Admin can successfully set Fraud flag to the loan + And Admin does charge-off the loan on "22 February 2023" + Then Loan marked as charged-off on "22 February 2023" + When Customer makes "PAYOUT_REFUND" transaction with "AUTOPAY" payment type on "22 February 2023" with 500 EUR transaction amount and system-generated Idempotency key + Then Loan status will be "ACTIVE" + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 143.0 | + | EXPENSE | 744037 | Credit Loss/Bad Debt-Fraud | 1000.0 | | + | INCOME | 404001 | Interest Income Charge Off | 30.0 | | + | INCOME | 404008 | Fee Charge Off | 113.0 | | + Then Loan Transactions tab has a "PAYOUT_REFUND" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | EXPENSE | 744037 | Credit Loss/Bad Debt-Fraud | | 367.0 | + | INCOME | 404001 | Interest Income Charge Off | | 20.0 | + | INCOME | 404008 | Fee Charge Off | | 113.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | + + + @Skip @TestRailId:C2582 @chargeoffOnLoanWithInterest + Scenario: As a user I want to do a Repayment after Charge-off for fraud loan when FEE and PENALTY added + When Admin sets the business date to "1 January 2023" + 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 | + | PIN30_INTEREST_FLAT | 1 January 2023 | 1000 | 12 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + And Admin adds an NSF fee because of payment bounce with "1 January 2023" transaction date + When Admin sets the business date to "22 February 2023" + And Admin adds a 10 % Processing charge to the loan with "en" locale on date: "22 February 2023" + Then Admin can successfully set Fraud flag to the loan + And Admin does charge-off the loan on "22 February 2023" + Then Loan marked as charged-off on "22 February 2023" + When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "22 February 2023" with 500 EUR transaction amount and system-generated Idempotency key + Then Loan status will be "ACTIVE" + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 143.0 | + | EXPENSE | 744037 | Credit Loss/Bad Debt-Fraud | 1000.0 | | + | INCOME | 404001 | Interest Income Charge Off | 30.0 | | + | INCOME | 404008 | Fee Charge Off | 113.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | INCOME | 744008 | Recoveries | | 500.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | + + + @Skip @TestRailId:C2591 @chargeoffOnLoanWithInterest + Scenario: As a user I want to repay a loan which was charged-off + When Admin sets the business date to "1 January 2023" + 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 | + | PIN30_INTEREST_FLAT | 1 January 2023 | 1000 | 12 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + And Admin adds an NSF fee because of payment bounce with "1 January 2023" transaction date + When Admin sets the business date to "22 February 2023" + And Admin adds a 10 % Processing charge to the loan with "en" locale on date: "22 February 2023" + Then Admin can successfully set Fraud flag to the loan + And Admin does charge-off the loan on "22 February 2023" + Then Loan marked as charged-off on "22 February 2023" + When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "22 February 2023" with 500 EUR transaction amount and system-generated Idempotency key + Then Loan status will be "ACTIVE" + When Admin sets the business date to "23 February 2023" + When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "23 February 2023" with 643 EUR transaction amount and system-generated Idempotency key + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan marked as charged-off on "22 February 2023" + Then Loan has 0 outstanding 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 22 February 2023 | 666.67 | 333.33 | 10.0 | 0.0 | 10.0 | 353.33 | 353.33 | 0.0 | 343.33 | 0.0 | + | 2 | 28 | 01 March 2023 | 23 February 2023 | 333.34 | 333.33 | 10.0 | 103.0 | 0.0 | 446.33 | 446.33 | 446.33 | 0.0 | 0.0 | + | 3 | 31 | 01 April 2023 | 23 February 2023 | 0.0 | 333.34 | 10.0 | 0.0 | 0.0 | 343.34 | 343.34 | 343.34 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 30 | 103 | 10 | 1143 | 1143 | 789.67 | 343.33 | 0 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 143.0 | + | EXPENSE | 744037 | Credit Loss/Bad Debt-Fraud | 1000.0 | | + | INCOME | 404001 | Interest Income Charge Off | 30.0 | | + | INCOME | 404008 | Fee Charge Off | 113.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | INCOME | 744008 | Recoveries | | 500.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | + Then Loan Transactions tab has a "ACCRUAL" transaction with date "23 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112603 | Interest/Fee Receivable | 30.0 | | + | INCOME | 404000 | Interest Income | | 30.0 | + | ASSET | 112603 | Interest/Fee Receivable | 103.0 | | + | INCOME | 404007 | Fee Income | | 103.0 | + | ASSET | 112603 | Interest/Fee Receivable | 10.0 | | + | INCOME | 404007 | Fee Income | | 10.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "23 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | INCOME | 744008 | Recoveries | | 643.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 643.0 | | + + @Skip @TestRailId:C2592 @chargeoffOnLoanWithInterest + Scenario: As a user I want to do a charge-off undo before any other transactions on the loan + When Admin sets the business date to "1 January 2023" + 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 | + | PIN30_INTEREST_FLAT | 1 January 2023 | 1000 | 12 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + And Admin adds an NSF fee because of payment bounce with "1 January 2023" transaction date + When Admin sets the business date to "22 February 2023" + And Admin adds a 10 % Processing charge to the loan with "en" locale on date: "22 February 2023" + Then Admin can successfully set Fraud flag to the loan + And Admin does charge-off the loan on "22 February 2023" + Then Loan marked as charged-off on "22 February 2023" + 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 666.67 | 333.33 | 10.0 | 0.0 | 10.0 | 353.33 | 0.0 | 0.0 | 0.0 | 353.33 | + | 2 | 28 | 01 March 2023 | | 333.34 | 333.33 | 10.0 | 103.0 | 0.0 | 446.33 | 0.0 | 0.0 | 0.0 | 446.33 | + | 3 | 31 | 01 April 2023 | | 0.0 | 333.34 | 10.0 | 0.0 | 0.0 | 343.34 | 0.0 | 0.0 | 0.0 | 343.34 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 30 | 103 | 10 | 1143 | 0 | 0 | 0 | 1143 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 143.0 | + | EXPENSE | 744037 | Credit Loss/Bad Debt-Fraud | 1000.0 | | + | INCOME | 404001 | Interest Income Charge Off | 30.0 | | + | INCOME | 404008 | Fee Charge Off | 113.0 | | + Then Admin does a charge-off undo the loan + When Admin sets the business date to "23 February 2023" + When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "23 February 2023" with 200 EUR transaction amount and system-generated Idempotency key + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 143.0 | + | EXPENSE | 744037 | Credit Loss/Bad Debt-Fraud | 1000.0 | | + | INCOME | 404001 | Interest Income Charge Off | 30.0 | | + | INCOME | 404008 | Fee Charge Off | 113.0 | | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | ASSET | 112603 | Interest/Fee Receivable | 143.0 | | + | EXPENSE | 744037 | Credit Loss/Bad Debt-Fraud | | 1000.0 | + | INCOME | 404001 | Interest Income Charge Off | | 30.0 | + | INCOME | 404008 | Fee Charge Off | | 113.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "23 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 180.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 20.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 200.0 | | + + @TestRailId:C2593 + Scenario: As a user I want to do a Charge-off before the last repayment + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "22 February 2023" + When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "22 February 2023" with 200 EUR transaction amount and system-generated Idempotency key + When Admin sets the business date to "23 February 2023" + Then Charge-off undo is not possible on "21 February 2023" + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 January 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 200.0 | 0.0 | 200.0 | 800.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 0 | 1000 | 200 | 0 | 200 | 800 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 200.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 200.0 | | + + @TestRailId:C2594 + Scenario: As a user I want to do a Charge-off between 2 repayments + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "22 February 2023" + When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "22 February 2023" with 200 EUR transaction amount and system-generated Idempotency key + When Admin sets the business date to "24 February 2023" + When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "24 February 2023" with 200 EUR transaction amount and system-generated Idempotency key + When Admin sets the business date to "25 February 2023" + Then Charge-off undo is not possible on "23 February 2023" + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 January 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 400.0 | 0.0 | 400.0 | 600.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 0 | 1000 | 400 | 0 | 400 | 600 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 200.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 200.0 | | + + @TestRailId:C2595 + Scenario: As a user I want to do a backdated Charge-off when only disbursement transaction happened + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "22 February 2023" + And Admin does charge-off the loan on "10 February 2023" + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 January 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 0 | 1000 | 0 | 0 | 0 | 1000 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "10 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 1000.0 | | + + @TestRailId:C2596 + Scenario: As a user I want to do an undo on a transaction which was created before the Charge-off + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "22 February 2023" + And Customer makes "AUTOPAY" repayment on "22 January 2023" with 250 EUR transaction amount + When Admin sets the business date to "23 February 2023" + And Admin does charge-off the loan on "23 February 2023" + When Customer undo "1"th repayment on "22 January 2023" + Then On Loan Transactions tab the "Repayment" Transaction with date "22 January 2023" is reverted + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 January 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 0 | 1000 | 0 | 0 | 0 | 1000 | + + @TestRailId:C2597 + Scenario: As a user I want to do an undo on a transaction which was created on the Charge-off day + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "22 February 2023" + And Customer makes "AUTOPAY" repayment on "22 January 2023" with 250 EUR transaction amount + And Admin does charge-off the loan on "22 February 2023" + When Customer undo "1"th repayment on "22 January 2023" + Then On Loan Transactions tab the "Repayment" Transaction with date "22 January 2023" is reverted + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 January 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 0 | 1000 | 0 | 0 | 0 | 1000 | + + @TestRailId:C2598 + Scenario: As a user I want to do a second Charge-off + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "22 February 2023" + And Admin does charge-off the loan on "22 February 2023" + Then Second Charge-off is not possible on "22 February 2023" + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 January 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 0 | 1000 | 0 | 0 | 0 | 1000 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 1000.0 | | + + @TestRailId:C2599 + Scenario: As a user I want to do a second Charge-off undo + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "22 February 2023" + And Admin does charge-off the loan on "22 February 2023" + When Admin does a charge-off undo the loan + And Charge-off undo is not possible as the loan is not charged-off + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 January 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 0 | 1000 | 0 | 0 | 0 | 1000 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + + @TestRailId:C2600 + Scenario: As a user I want to add charge after Charge-off + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "22 February 2023" + And Admin does charge-off the loan on "22 February 2023" + When Admin is not able to add "LOAN_SNOOZE_FEE" due date charge with "22 February 2023" due date and 200 EUR transaction amount because the of charged-off account + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 January 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 0 | 1000 | 0 | 0 | 0 | 1000 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 1000.0 | | + + # TODO: Add reschedule related tests for "Reschedule" and "Close as Reschedule" actions if the reschedule API fixed + + + @TestRailId:C2706 + Scenario: Verify that Charge-off NOT results an error anymore when to be applied on a loan with an interest + When Admin sets the business date to "1 January 2023" + 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 | + | PIN30_INTEREST_FLAT | 1 January 2023 | 1000 | 12 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + And Admin adds an NSF fee because of payment bounce with "1 January 2023" transaction date + When Admin sets the business date to "22 February 2023" + And Admin adds a 10 % Processing charge to the loan with "en" locale on date: "22 February 2023" + And Admin does charge-off the loan on "22 February 2023" + 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 667.0 | 333.0 | 10.0 | 0.0 | 10.0 | 353.0 | 0.0 | 0.0 | 0.0 | 353.0 | + | 2 | 28 | 01 March 2023 | | 334.0 | 333.0 | 10.0 | 103.0 | 0.0 | 446.0 | 0.0 | 0.0 | 0.0 | 446.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 334.0 | 10.0 | 0.0 | 0.0 | 344.0 | 0.0 | 0.0 | 0.0 | 344.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 30 | 103 | 10 | 1143 | 0 | 0 | 0 | 1143 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 22 February 2023 | Charge-off | 1143.0 | 1000.0 | 30.0 | 103.0 | 10.0 | 0.0 | + + @TestRailId:C2761 + Scenario: Verify that charge-off is reversed/replayed if Scheduled repayment which was placed on a date before the charge-off is reversed after the charge-off + When Admin sets the business date to "01 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + And Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "25 January 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "25 January 2023" due date and 20 EUR transaction amount + When Admin sets the business date to "01 March 2023" + When Customer makes "REPAYMENT" transaction with "SCHEDULED" payment type on "01 March 2023" with 1000 EUR transaction amount and system-generated Idempotency key + When Admin sets the business date to "01 June 2023" + And Admin does charge-off the loan on "01 June 2023" + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 January 2023 | | 0.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 1020.0 | 1000.0 | 0.0 | 1000.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20 | 0 | 1020 | 1000 | 0 | 1000 | 20 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 March 2023 | Repayment | 1000.0 | 980.0 | 0.0 | 20.0 | 0.0 | 20.0 | + | 01 June 2023 | Charge-off | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 0.0 | + When Admin sets the business date to "05 June 2023" + When Customer undo "1"th "Repayment" transaction made on "01 March 2023" + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 January 2023 | | 0.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 1020.0 | 0.0 | 0.0 | 0.0 | 1020.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20 | 0 | 1020 | 0 | 0 | 0 | 1020 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 March 2023 | Repayment | 1000.0 | 980.0 | 0.0 | 20.0 | 0.0 | 20.0 | + | 01 June 2023 | Charge-off | 1020.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 0.0 | + Then On Loan Transactions tab the "Repayment" Transaction with date "01 March 2023" is reverted + + @TestRailId:C2762 + Scenario: Verify that charge-off is reversed/replayed if Real time repayment which was placed on a date before the charge-off is reversed after the charge-off + When Admin sets the business date to "01 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + And Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "25 January 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "25 January 2023" due date and 20 EUR transaction amount + When Admin sets the business date to "10 February 2023" + When Customer makes "REPAYMENT" transaction with "REAL_TIME" payment type on "10 February 2023" with 1020 EUR transaction amount and system-generated Idempotency key + When Admin sets the business date to "15 February 2023" + When Admin adds "LOAN_NSF_FEE" due date charge with "15 February 2023" due date and 15 EUR transaction amount + When Admin sets the business date to "01 June 2023" + And Admin does charge-off the loan on "01 June 2023" + Then Loan Repayment schedule has 2 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 January 2023 | 10 February 2023 | 0.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 1020.0 | 1020.0 | 0.0 | 1020.0 | 0.0 | + | 2 | 15 | 15 February 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 15.0 | 15.0 | 0.0 | 0.0 | 0.0 | 15.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20 | 15 | 1035 | 1020 | 0 | 1020 | 15 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 February 2023 | Accrual | 20.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 10 February 2023 | Repayment | 1020.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 01 June 2023 | Charge-off | 15.0 | 0.0 | 0.0 | 0.0 | 15.0 | 0.0 | + When Admin sets the business date to "10 June 2023" + When Customer undo "1"th "Repayment" transaction made on "10 February 2023" + Then Loan Repayment schedule has 2 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 January 2023 | | 0.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 1020.0 | 0.0 | 0.0 | 0.0 | 1020.0 | + | 2 | 15 | 15 February 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 15.0 | 15.0 | 0.0 | 0.0 | 0.0 | 15.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20 | 15 | 1035 | 0 | 0 | 0 | 1035 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 February 2023 | Accrual | 20.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 10 February 2023 | Repayment | 1020.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 01 June 2023 | Charge-off | 1035.0 | 1000.0 | 0.0 | 20.0 | 15.0 | 0.0 | + Then On Loan Transactions tab the "Repayment" Transaction with date "10 February 2023" is reverted + + @TestRailId:C2763 + Scenario: Verify that charge-off is reversed/replayed if Autopay repayment which was placed on a date before the charge-off is reversed after the charge-off + When Admin sets the business date to "01 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + And Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "25 January 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "25 January 2023" due date and 20 EUR transaction amount + When Admin sets the business date to "10 February 2023" + When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "10 February 2023" with 1020 EUR transaction amount and system-generated Idempotency key + When Admin sets the business date to "15 February 2023" + When Admin adds "LOAN_NSF_FEE" due date charge with "15 February 2023" due date and 15 EUR transaction amount + When Admin sets the business date to "01 June 2023" + And Admin does charge-off the loan on "01 June 2023" + Then Loan Repayment schedule has 2 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 January 2023 | 10 February 2023 | 0.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 1020.0 | 1020.0 | 0.0 | 1020.0 | 0.0 | + | 2 | 15 | 15 February 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 15.0 | 15.0 | 0.0 | 0.0 | 0.0 | 15.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20 | 15 | 1035 | 1020 | 0 | 1020 | 15 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 February 2023 | Accrual | 20.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 10 February 2023 | Repayment | 1020.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 01 June 2023 | Charge-off | 15.0 | 0.0 | 0.0 | 0.0 | 15.0 | 0.0 | + When Admin sets the business date to "10 June 2023" + When Customer undo "1"th "Repayment" transaction made on "10 February 2023" + Then Loan Repayment schedule has 2 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 January 2023 | | 0.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 1020.0 | 0.0 | 0.0 | 0.0 | 1020.0 | + | 2 | 15 | 15 February 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 15.0 | 15.0 | 0.0 | 0.0 | 0.0 | 15.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20 | 15 | 1035 | 0 | 0 | 0 | 1035 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 February 2023 | Accrual | 20.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 10 February 2023 | Repayment | 1020.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 01 June 2023 | Charge-off | 1035.0 | 1000.0 | 0.0 | 20.0 | 15.0 | 0.0 | + Then On Loan Transactions tab the "Repayment" Transaction with date "10 February 2023" is reverted + + @TestRailId:C2764 + Scenario: Verify that charge-off is NOT reversed/replayed if OCA repayment which was placed and reversed on a date after the charge-off + When Admin sets the business date to "01 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + And Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "25 January 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "25 January 2023" due date and 20 EUR transaction amount + When Admin sets the business date to "01 June 2023" + And Admin does charge-off the loan on "01 June 2023" + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 January 2023 | | 0.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 1020.0 | 0.0 | 0.0 | 0.0 | 1020.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20 | 0 | 1020 | 0 | 0 | 0 | 1020 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 June 2023 | Charge-off | 1020.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 0.0 | + When Admin sets the business date to "10 June 2023" + When Customer makes "REPAYMENT" transaction with "OCA_PAYMENT" payment type on "10 June 2023" with 1000 EUR transaction amount and system-generated Idempotency key + When Customer undo "1"th "Repayment" transaction made on "10 June 2023" + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 January 2023 | | 0.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 1020.0 | 0.0 | 0.0 | 0.0 | 1020.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20 | 0 | 1020 | 0 | 0 | 0 | 1020 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 June 2023 | Charge-off | 1020.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 10 June 2023 | Repayment | 1000.0 | 980.0 | 0.0 | 20.0 | 0.0 | 20.0 | + Then On Loan Transactions tab the "Repayment" Transaction with date "10 June 2023" is reverted + + @TestRailId:C2765 + Scenario: Verify that charge-off is reversed/replayed if Goodwill credit transaction is placed on a date before the charge-off on business date after the charge-off + When Admin sets the business date to "01 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + And Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "25 January 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "25 January 2023" due date and 20 EUR transaction amount + When Admin sets the business date to "01 June 2023" + And Admin does charge-off the loan on "01 June 2023" + When Admin sets the business date to "10 June 2023" + When Admin makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "29 January 2023" with 500 EUR transaction amount + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 January 2023 | | 0.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 1020.0 | 500.0 | 500.0 | 0.0 | 520.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20 | 0 | 1020 | 500 | 500 | 0 | 520 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 29 January 2023 | Goodwill Credit | 500.0 | 480.0 | 0.0 | 20.0 | 0.0 | 520.0 | + | 01 June 2023 | Charge-off | 520.0 | 520.0 | 0.0 | 0.0 | 0.0 | 0.0 | + + @TestRailId:C2766 + Scenario: As a user I want to do a undo Charge-off with reversal external Id + When Admin sets the business date to "1 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2023" + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "22 February 2023" + And Admin does charge-off the loan on "22 February 2023" + Then Loan marked as charged-off on "22 February 2023" + Then Loan status will be "ACTIVE" + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 1000.0 | | + When Admin sets the business date to "23 February 2023" + And Admin does a charge-off undo the loan with reversal external Id + Then Loan Charge-off undo event has reversed on date "23 February 2023" for charge-off undo + + @TestRailId:C2767 + Scenario: Verify that charge-off is reversed/replayed in case of partial payment, charge-off, second part of payment, reverse 1st payment + When Admin sets the business date to "01 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + And Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "10 February 2023" + When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "10 February 2023" with 500 EUR transaction amount and system-generated Idempotency key + When Admin sets the business date to "01 June 2023" + And Admin does charge-off the loan on "01 June 2023" + When Admin sets the business date to "05 June 2023" + When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "05 June 2023" with 500 EUR transaction amount and system-generated Idempotency key + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 January 2023 | 05 June 2023 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 1000.0 | 0.0 | 1000.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 0 | 1000 | 1000 | 0 | 1000 | 0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 February 2023 | Repayment | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 June 2023 | Charge-off | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 05 June 2023 | Repayment | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | + When Admin sets the business date to "10 June 2023" + When Customer undo "1"th "Repayment" transaction made on "10 February 2023" + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 January 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 500.0 | 0.0 | 500.0 | 500.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 0 | 1000 | 500 | 0 | 500 | 500 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 February 2023 | Repayment | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 June 2023 | Charge-off | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 05 June 2023 | Repayment | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then On Loan Transactions tab the "Repayment" Transaction with date "10 February 2023" is reverted + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "10 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 500.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | + | ASSET | 112601 | Loans Receivable | 500.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 500.0 | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "01 June 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 1000.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "05 June 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | INCOME | 744008 | Recoveries | | 500.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | + + @TestRailId:C2768 + Scenario: Verify that charge-off is results an error in case of partial payment, charge-off, fee added after charge-off + When Admin sets the business date to "01 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + And Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "10 February 2023" + When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "10 February 2023" with 300 EUR transaction amount and system-generated Idempotency key + When Admin sets the business date to "01 June 2023" + And Admin does charge-off the loan on "01 June 2023" + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 January 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 300.0 | 0.0 | 300.0 | 700.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 0 | 1000 | 300 | 0 | 300 | 700 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 February 2023 | Repayment | 300.0 | 300.0 | 0.0 | 0.0 | 0.0 | 700.0 | + | 01 June 2023 | Charge-off | 700.0 | 700.0 | 0.0 | 0.0 | 0.0 | 0.0 | + When Admin sets the business date to "10 June 2023" + Then Loan charge transaction with the following data results a 403 error and "CHARGED_OFF" error message + | Charge type | dueDate | amount | + | LOAN_SNOOZE_FEE | 10 June 2023 | 20 | + + @TestRailId:C2779 + Scenario: Verify that on interest bearing loans the accrual of interest is stopped when the loan is charged-off + When Admin sets the business date to "01 January 2023" + 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 | + | PIN30_INTEREST_DECLINING_BALANCE_PERIOD_DAILY | 01 January 2023 | 1000 | 12 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 1 | MONTHS | 1 | MONTHS | 1 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + And Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin runs inline COB job for Loan + When Admin sets the business date to "02 January 2023" + When Admin runs inline COB job for Loan + When Admin sets the business date to "03 January 2023" + When Admin runs inline COB job for Loan + When Admin sets the business date to "04 January 2023" + When Admin runs inline COB job for Loan + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 0.0 | 1000.0 | 10.19 | 0.0 | 0.0 | 1010.19 | 0.0 | 0.0 | 0.0 | 1010.19 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 10.19 | 0 | 0 | 1010.19 | 0 | 0 | 0 | 1010.19 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 02 January 2023 | Accrual | 0.33 | 0.0 | 0.33 | 0.0 | 0.0 | 0.0 | + | 03 January 2023 | Accrual | 0.33 | 0.0 | 0.33 | 0.0 | 0.0 | 0.0 | + When Admin sets the business date to "05 January 2023" + And Admin does charge-off the loan on "05 January 2023" + When Admin runs inline COB job for Loan + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 0.0 | 1000.0 | 10.19 | 0.0 | 0.0 | 1010.19 | 0.0 | 0.0 | 0.0 | 1010.19 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 10.19 | 0 | 0 | 1010.19 | 0 | 0 | 0 | 1010.19 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 02 January 2023 | Accrual | 0.33 | 0.0 | 0.33 | 0.0 | 0.0 | 0.0 | + | 03 January 2023 | Accrual | 0.33 | 0.0 | 0.33 | 0.0 | 0.0 | 0.0 | + | 05 January 2023 | Charge-off | 1010.19 | 1000.0 | 10.19 | 0.0 | 0.0 | 0.0 | + + @TestRailId:C2780 + Scenario: Verify that on interest bearing loans the accrual of interest is resumed and aggregated when the charge-off is reverted + When Admin sets the business date to "01 January 2023" + 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 | + | PIN30_INTEREST_DECLINING_BALANCE_PERIOD_DAILY | 01 January 2023 | 1000 | 12 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 1 | MONTHS | 1 | MONTHS | 1 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + And Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin runs inline COB job for Loan + When Admin sets the business date to "02 January 2023" + When Admin runs inline COB job for Loan + When Admin sets the business date to "03 January 2023" + When Admin runs inline COB job for Loan + When Admin sets the business date to "04 January 2023" + And Admin does charge-off the loan on "04 January 2023" + When Admin runs inline COB job for Loan + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 0.0 | 1000.0 | 10.19 | 0.0 | 0.0 | 1010.19 | 0.0 | 0.0 | 0.0 | 1010.19 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 10.19 | 0 | 0 | 1010.19 | 0 | 0 | 0 | 1010.19 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 02 January 2023 | Accrual | 0.33 | 0.0 | 0.33 | 0.0 | 0.0 | 0.0 | + | 04 January 2023 | Charge-off | 1010.19 | 1000.0 | 10.19 | 0.0 | 0.0 | 0.0 | + When Admin sets the business date to "05 January 2023" + When Admin runs inline COB job for Loan + When Admin sets the business date to "06 January 2023" + When Admin runs inline COB job for Loan + When Admin sets the business date to "07 January 2023" + Then Admin does a charge-off undo the loan + When Admin runs inline COB job for Loan + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 0.0 | 1000.0 | 10.19 | 0.0 | 0.0 | 1010.19 | 0.0 | 0.0 | 0.0 | 1010.19 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 10.19 | 0 | 0 | 1010.19 | 0 | 0 | 0 | 1010.19 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 02 January 2023 | Accrual | 0.33 | 0.0 | 0.33 | 0.0 | 0.0 | 0.0 | + | 04 January 2023 | Charge-off | 1010.19 | 1000.0 | 10.19 | 0.0 | 0.0 | 0.0 | + | 06 January 2023 | Accrual | 1.31 | 0.0 | 1.31 | 0.0 | 0.0 | 0.0 | + Then On Loan Transactions tab the "Charge-off" Transaction with date "04 January 2023" is reverted + + @TestRailId:C2781 + Scenario: Verify that on interest bearing loans the accrual of interest is stopped when the loan is charged-off even if fully paid after the charge-off + When Admin sets the business date to "01 January 2023" + 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 | + | PIN30_INTEREST_DECLINING_BALANCE_PERIOD_DAILY | 01 January 2023 | 1000 | 12 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 1 | MONTHS | 1 | MONTHS | 1 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + And Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin runs inline COB job for Loan + When Admin sets the business date to "02 January 2023" + When Admin runs inline COB job for Loan + When Admin sets the business date to "03 January 2023" + When Admin runs inline COB job for Loan + When Admin sets the business date to "04 January 2023" + And Admin does charge-off the loan on "04 January 2023" + When Admin runs inline COB job for Loan + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 0.0 | 1000.0 | 10.19 | 0.0 | 0.0 | 1010.19 | 0.0 | 0.0 | 0.0 | 1010.19 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 10.19 | 0 | 0 | 1010.19 | 0 | 0 | 0 | 1010.19 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 02 January 2023 | Accrual | 0.33 | 0.0 | 0.33 | 0.0 | 0.0 | 0.0 | + | 04 January 2023 | Charge-off | 1010.19 | 1000.0 | 10.19 | 0.0 | 0.0 | 0.0 | + When Admin sets the business date to "05 January 2023" + When Admin runs inline COB job for Loan + When Admin sets the business date to "06 January 2023" + When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "06 January 2023" with 1010.19 EUR transaction amount and system-generated Idempotency key + When Admin runs inline COB job for Loan + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 06 January 2023 | 0.0 | 1000.0 | 10.19 | 0.0 | 0.0 | 1010.19 | 1010.19 | 1010.19 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 10.19 | 0 | 0 | 1010.19 | 1010.19 | 1010.19 | 0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 02 January 2023 | Accrual | 0.33 | 0.0 | 0.33 | 0.0 | 0.0 | 0.0 | + | 04 January 2023 | Charge-off | 1010.19 | 1000.0 | 10.19 | 0.0 | 0.0 | 0.0 | + | 06 January 2023 | Repayment | 1010.19 | 1000.0 | 10.19 | 0.0 | 0.0 | 0.0 | + + @TestRailId:C2782 + Scenario: Verify that the accrual of charges is not happened when the loan is charged-off on charge's due date but resumed when the charge-off is reverted + When Admin sets the business date to "01 January 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + And Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin runs inline COB job for Loan + When Admin sets the business date to "02 January 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "02 January 2023" due date and 10 EUR transaction amount + When Admin runs inline COB job for Loan + When Admin sets the business date to "03 January 2023" + When Admin runs inline COB job for Loan + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 January 2023 | | 0.0 | 1000.0 | 0.0 | 10.0 | 0.0 | 1010.0 | 0.0 | 0.0 | 0.0 | 1010.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0.0 | 10 | 0 | 1010.0 | 0 | 0 | 0 | 1010.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 02 January 2023 | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + When Admin sets the business date to "04 January 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "04 January 2023" due date and 15 EUR transaction amount + And Admin does charge-off the loan on "04 January 2023" + When Admin runs inline COB job for Loan + When Admin sets the business date to "05 January 2023" + When Admin runs inline COB job for Loan + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 January 2023 | | 0.0 | 1000.0 | 0.0 | 25.0 | 0.0 | 1025.0 | 0.0 | 0.0 | 0.0 | 1025.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0.0 | 25 | 0 | 1025.0 | 0 | 0 | 0 | 1025.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 02 January 2023 | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + | 04 January 2023 | Charge-off | 1025.0 | 1000.0 | 0.0 | 25.0 | 0.0 | 0.0 | + When Admin sets the business date to "06 January 2023" + When Admin runs inline COB job for Loan + When Admin sets the business date to "07 January 2023" + Then Admin does a charge-off undo the loan + When Admin runs inline COB job for Loan + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 January 2023 | | 0.0 | 1000.0 | 0.0 | 25.0 | 0.0 | 1025.0 | 0.0 | 0.0 | 0.0 | 1025.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0.0 | 25 | 0 | 1025.0 | 0 | 0 | 0 | 1025.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 02 January 2023 | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + | 04 January 2023 | Charge-off | 1025.0 | 1000.0 | 0.0 | 25.0 | 0.0 | 0.0 | + | 06 January 2023 | Accrual | 15.0 | 0.0 | 0.0 | 15.0 | 0.0 | 0.0 | + Then On Loan Transactions tab the "Charge-off" Transaction with date "04 January 2023" is reverted + + @TestRailId:C2891 @AdvancedPaymentAllocation + Scenario: Verify that the user is able to do a Charge-off for fraud loan when FEE and PENALTY added - PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION product + When Admin sets the business date to "1 January 2023" + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + And Admin adds an NSF fee because of payment bounce with "1 January 2023" transaction date + When Admin sets the business date to "22 February 2023" + And Admin adds a 10 % Processing charge to the loan with "en" locale on date: "22 February 2023" + Then Admin can successfully set Fraud flag to the loan + And Admin does charge-off the loan on "22 February 2023" + Then Loan marked as charged-off on "22 February 2023" + Then Loan status will be "ACTIVE" + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 750.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 110.0 | + | EXPENSE | 744037 | Credit Loss/Bad Debt-Fraud | 750.0 | | + | INCOME | 404008 | Fee Charge Off | 110.0 | | + + @TestRailId:C2892 @AdvancedPaymentAllocation + Scenario: Verify that the user is able to do a Charge-off for non-fraud loan after disbursement - PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION product + When Admin sets the business date to "1 January 2023" + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "22 February 2023" + And Admin does charge-off the loan on "22 February 2023" + Then Loan marked as charged-off on "22 February 2023" + Then Loan status will be "ACTIVE" + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 750.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 750.0 | | + + @TestRailId:C2893 @AdvancedPaymentAllocation + Scenario: Verify that the user is able to do a Charge-off for non-fraud loan after repayment - PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION product + When Admin sets the business date to "1 January 2023" + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "5 January 2023" + And Customer makes "AUTOPAY" repayment on "5 January 2023" with 250 EUR transaction amount + When Admin sets the business date to "22 February 2023" + And Admin does charge-off the loan on "22 February 2023" + Then Loan marked as charged-off on "22 February 2023" + Then Loan status will be "ACTIVE" + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "05 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 500.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 500.0 | | + + @TestRailId:C2894 @AdvancedPaymentAllocation + Scenario: Verify that the user is able to do a Repayment undo after Charge-off for non-fraud - PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION product + When Admin sets the business date to "1 January 2023" + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "5 January 2023" + And Customer makes "AUTOPAY" repayment on "5 January 2023" with 250 EUR transaction amount + When Admin sets the business date to "22 February 2023" + And Admin does charge-off the loan on "22 February 2023" + Then Loan marked as charged-off on "22 February 2023" + When Customer undo "1"th repayment on "05 January 2023" + Then Loan status will be "ACTIVE" + Then On Loan Transactions tab the "Repayment" Transaction with date "05 January 2023" is reverted + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "05 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + | ASSET | 112601 | Loans Receivable | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "22 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 750.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 750.0 | | + + @TestRailId:C2895 @AdvancedPaymentAllocation + Scenario: Verify that the user is able to do a backdated Charge-off when only disbursement transaction happened - PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION product + When Admin sets the business date to "1 January 2023" + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "22 February 2023" + And Admin does charge-off the loan on "10 February 2023" + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 01 January 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 31 January 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 15 February 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 0 | 1000 | 250 | 0 | 0 | 750 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2023 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 10 February 2023 | Charge-off | 750.0 | 750.0 | 0.0 | 0.0 | 0.0 | 0.0 | + + @TestRailId:C2896 @AdvancedPaymentAllocation + Scenario: Verify that charge-off is reversed/replayed if Goodwill credit transaction is placed on a date before the charge-off on business date after the charge-off - - PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION product + When Admin sets the business date to "01 January 2023" + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + And Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "25 January 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "25 January 2023" due date and 20 EUR transaction amount + When Admin sets the business date to "01 June 2023" + And Admin does charge-off the loan on "01 June 2023" + When Admin sets the business date to "10 June 2023" + When Admin makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "29 January 2023" with 500 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2023 | 01 January 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2023 | 29 January 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | 3 | 15 | 31 January 2023 | | 250.0 | 250.0 | 0.0 | 20.0 | 0.0 | 270.0 | 0.0 | 0.0 | 0.0 | 270.0 | + | 4 | 15 | 15 February 2023 | 29 January 2023 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20 | 0 | 1020 | 750 | 250 | 250 | 270 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2023 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 29 January 2023 | Goodwill Credit | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 01 June 2023 | Charge-off | 270.0 | 250.0 | 0.0 | 20.0 | 0.0 | 0.0 | + + @TestRailId:C3067 @AdvancedPaymentAllocation + Scenario: Verify charge-off GL entries in case of reverse-replay on fraud loan + When Admin sets the business date to "01 February 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 February 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 February 2024" with "1000" amount and expected disbursement date on "01 February 2024" + When Admin successfully disburse the loan on "01 February 2024" with "1000" EUR transaction amount + When Admin sets the business date to "02 February 2024" + And Customer makes "AUTOPAY" repayment on "02 February 2024" with 100 EUR transaction amount + When Admin sets the business date to "03 February 2024" + Then Admin can successfully set Fraud flag to the loan + When Admin sets the business date to "03 February 2024" + And Admin does charge-off the loan on "03 February 2024" + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "03 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 650.0 | + | EXPENSE | 744037 | Credit Loss/Bad Debt-Fraud | 650.0 | | + When Admin sets the business date to "04 February 2024" + When Customer undo "1"th "Repayment" transaction made on "02 February 2024" + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "03 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 750.0 | + | EXPENSE | 744037 | Credit Loss/Bad Debt-Fraud | 750.0 | | + Then In Loan transactions the replayed "CHARGE_OFF" transaction with date "03 February 2024" has a reverted transaction pair with the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 650.0 | + | EXPENSE | 744037 | Credit Loss/Bad Debt-Fraud | 650.0 | | + | ASSET | 112601 | Loans Receivable | 650.0 | | + | EXPENSE | 744037 | Credit Loss/Bad Debt-Fraud | | 650.0 | + diff --git a/fineract-e2e-tests-runner/src/test/resources/features/LoanChargeback.feature b/fineract-e2e-tests-runner/src/test/resources/features/LoanChargeback.feature new file mode 100644 index 00000000000..8448fa1f80d --- /dev/null +++ b/fineract-e2e-tests-runner/src/test/resources/features/LoanChargeback.feature @@ -0,0 +1,2846 @@ +@LoanChargeback +Feature: LoanChargeback + + @TestRailId:C2441 + Scenario: As an admin I would like to check chargeback function is working properly on a closed loan in case of payment type: REPAYMENT_ADJUSTMENT_CHARGEBACK + When Admin sets the business date to "1 January 2022" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2022" + And Admin successfully approves the loan on "1 January 2022" with "1000" amount and expected disbursement date on "1 January 2022" + When Admin successfully disburse the loan on "1 January 2022" with "1000" EUR transaction amount + When Admin sets the business date to "1 February 2022" + And Customer makes "AUTOPAY" repayment on "1 February 2022" with 1000 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + When Admin sets the business date to "25 February 2022" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 250 EUR transaction amount + Then Loan has 250 outstanding amount + Then Loan status will be "ACTIVE" + + @TestRailId:C2442 + Scenario: As an admin I would like to check chargeback function is working properly on a closed loan in case of payment type: REPAYMENT_ADJUSTMENT_REFUND + When Admin sets the business date to "1 January 2022" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2022" + And Admin successfully approves the loan on "1 January 2022" with "1000" amount and expected disbursement date on "1 January 2022" + When Admin successfully disburse the loan on "1 January 2022" with "1000" EUR transaction amount + When Admin sets the business date to "1 February 2022" + And Customer makes "AUTOPAY" repayment on "1 February 2022" with 1000 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + When Admin sets the business date to "25 February 2022" + When Admin makes "REPAYMENT_ADJUSTMENT_REFUND" chargeback with 250 EUR transaction amount + Then Loan has 250 outstanding amount + Then Loan status will be "ACTIVE" + + @TestRailId:C2443 + Scenario: As an admin I would like to check chargeback function is working properly when chargeback comes after the loan was fully repaid and closed + When Admin sets the business date to "1 January 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 January 2022", with Principal: "750", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 January 2022" with "750" amount and expected disbursement date on "1 January 2022" + When Admin successfully disburse the loan on "1 January 2022" with "750" EUR transaction amount + When Admin sets the business date to "1 February 2022" + And Customer makes "AUTOPAY" repayment on "1 February 2022" with 250 EUR transaction amount + When Admin sets the business date to "1 March 2022" + And Customer makes "AUTOPAY" repayment on "1 March 2022" with 250 EUR transaction amount + When Admin sets the business date to "1 April 2022" + And Customer makes "AUTOPAY" repayment on "1 April 2022" with 250 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + When Admin sets the business date to "25 April 2022" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 250 EUR transaction amount + Then Loan has 250 outstanding amount + Then Loan status will be "ACTIVE" + + @TestRailId:C2444 + Scenario: As an admin I would like to check chargeback function is working properly when repayment happens again after chargeback + When Admin sets the business date to "1 January 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 January 2022", with Principal: "750", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 January 2022" with "750" amount and expected disbursement date on "1 January 2022" + When Admin successfully disburse the loan on "1 January 2022" with "750" EUR transaction amount + When Admin sets the business date to "1 February 2022" + And Customer makes "AUTOPAY" repayment on "1 February 2022" with 250 EUR transaction amount + When Admin sets the business date to "1 March 2022" + And Customer makes "AUTOPAY" repayment on "1 March 2022" with 250 EUR transaction amount + When Admin sets the business date to "1 April 2022" + And Customer makes "AUTOPAY" repayment on "1 April 2022" with 250 EUR transaction amount + When Admin sets the business date to "25 April 2022" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 250 EUR transaction amount + Then Loan has 250 outstanding amount + Then Loan status will be "ACTIVE" + And Customer makes "AUTOPAY" repayment on "25 April 2022" with 250 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + + @TestRailId:C2445 + Scenario: As an admin I would like to check chargeback function is working properly when a second chargeback happens after the repayment + When Admin sets the business date to "1 January 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 January 2022", with Principal: "750", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 January 2022" with "750" amount and expected disbursement date on "1 January 2022" + When Admin successfully disburse the loan on "1 January 2022" with "750" EUR transaction amount + When Admin sets the business date to "1 February 2022" + And Customer makes "AUTOPAY" repayment on "1 February 2022" with 250 EUR transaction amount + When Admin sets the business date to "1 March 2022" + And Customer makes "AUTOPAY" repayment on "1 March 2022" with 250 EUR transaction amount + When Admin sets the business date to "1 April 2022" + And Customer makes "AUTOPAY" repayment on "1 April 2022" with 250 EUR transaction amount + When Admin sets the business date to "25 April 2022" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 250 EUR transaction amount + Then Loan has 250 outstanding amount + Then Loan status will be "ACTIVE" + And Customer makes "AUTOPAY" repayment on "25 April 2022" with 250 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + When Admin sets the business date to "1 May 2022" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 200 EUR transaction amount + Then Loan has 200 outstanding amount + Then Loan status will be "ACTIVE" + + @TestRailId:C2446 + Scenario: As an admin I would like to check chargeback function is working properly when chargeback happens after NSF fee was added to the loan then was repaid + When Admin sets the business date to "1 January 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 January 2022", with Principal: "750", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 January 2022" with "750" amount and expected disbursement date on "1 January 2022" + When Admin successfully disburse the loan on "1 January 2022" with "750" EUR transaction amount + When Admin sets the business date to "1 February 2022" + And Customer makes "AUTOPAY" repayment on "1 February 2022" with 250 EUR transaction amount + When Admin sets the business date to "1 March 2022" + And Customer makes "AUTOPAY" repayment on "1 March 2022" with 250 EUR transaction amount + When Admin sets the business date to "1 April 2022" + And Customer makes "AUTOPAY" repayment on "1 April 2022" with 250 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + When Customer makes a repayment undo on "1 April 2022" + Then Loan has 250 outstanding amount + Then Loan status will be "ACTIVE" + And Admin adds an NSF fee because of payment bounce with "1 April 2022" transaction date + Then Loan has 260 outstanding amount + Then Loan status will be "ACTIVE" + When Admin sets the business date to "5 April 2022" + And Customer makes "AUTOPAY" repayment on "5 April 2022" with 260 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + When Admin sets the business date to "25 April 2022" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 250 EUR transaction amount + Then Loan has 250 outstanding amount + Then Loan status will be "ACTIVE" + + @TestRailId:C2447 + Scenario: As an admin I would like to check that the loan goes to ACTIVE when the loan is OVERPAID but the chargeback amount is HIGHER than the overpaid amount + When Admin sets the business date to "1 January 2022" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2022" + And Admin successfully approves the loan on "1 January 2022" with "1000" amount and expected disbursement date on "1 January 2022" + When Admin successfully disburse the loan on "1 January 2022" with "1000" EUR transaction amount + When Admin sets the business date to "1 February 2022" + And Customer makes "AUTOPAY" repayment on "1 February 2022" with 1200 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan status will be "OVERPAID" + When Admin sets the business date to "25 February 2022" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 250 EUR transaction amount + Then Loan status will be "ACTIVE" + Then Loan has 50 outstanding amount + + @TestRailId:C2448 + Scenario: As an admin I would like to check that the loan remains OVERPAID when the loan is OVERPAID but the chargeback amount is LOWER than the overpaid amount + When Admin sets the business date to "1 January 2022" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2022" + And Admin successfully approves the loan on "1 January 2022" with "1000" amount and expected disbursement date on "1 January 2022" + When Admin successfully disburse the loan on "1 January 2022" with "1000" EUR transaction amount + When Admin sets the business date to "1 February 2022" + And Customer makes "AUTOPAY" repayment on "1 February 2022" with 1300 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan status will be "OVERPAID" + When Admin sets the business date to "25 February 2022" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 250 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 0 outstanding amount + + @TestRailId:C2449 + Scenario: As an admin I would like to check that the loan goes to CLOSED when the loan is OVERPAID but the chargeback amount is EQUALS than the overpaid amount + When Admin sets the business date to "1 January 2022" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2022" + And Admin successfully approves the loan on "1 January 2022" with "1000" amount and expected disbursement date on "1 January 2022" + When Admin successfully disburse the loan on "1 January 2022" with "1000" EUR transaction amount + When Admin sets the business date to "1 February 2022" + And Customer makes "AUTOPAY" repayment on "1 February 2022" with 1250 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan status will be "OVERPAID" + When Admin sets the business date to "25 February 2022" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 250 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + + @TestRailId:C2458 + Scenario: As an admin I would like to check that delinquency and overdue treatment of chargeback works properly + When Admin sets the business date to "1 January 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 January 2022", with Principal: "3000", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 January 2022" with "3000" amount and expected disbursement date on "1 January 2022" + When Admin successfully disburse the loan on "1 January 2022" with "3000" EUR transaction amount + When Admin sets the business date to "01 February 2022" + And Customer makes "AUTOPAY" repayment on "01 February 2022" with 1000 EUR transaction amount + When Admin sets the business date to "01 March 2022" + And Customer makes "AUTOPAY" repayment on "01 March 2022" with 1000 EUR transaction amount + When Admin sets the business date to "15 March 2022" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 1000 EUR transaction amount + When Admin sets the business date to "07 April 2022" + And Admin runs the Loan Delinquency Classification job + Then Admin checks that delinquency range is: "RANGE_3" and has delinquentDate "2022-03-18" +# //Then Loan has 2000 total overdue amount +# //TODO overdue amount will not work until New Transactions not updating the overdue calculation and loan status issue is solved + + @TestRailId:C2459 + Scenario: As an admin I would like to check that delinquency and overdue treatment of chargeback works properly when all the chargeback transactions are fully paid + When Admin sets the business date to "1 January 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 January 2022", with Principal: "3000", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 January 2022" with "3000" amount and expected disbursement date on "1 January 2022" + When Admin successfully disburse the loan on "1 January 2022" with "3000" EUR transaction amount + When Admin sets the business date to "01 February 2022" + And Customer makes "AUTOPAY" repayment on "01 February 2022" with 1000 EUR transaction amount + When Admin sets the business date to "01 March 2022" + And Customer makes "AUTOPAY" repayment on "01 March 2022" with 1000 EUR transaction amount + When Admin sets the business date to "15 March 2022" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 1000 EUR transaction amount + When Admin sets the business date to "07 April 2022" + And Admin runs the Loan Delinquency Classification job + Then Admin checks that delinquency range is: "RANGE_3" and has delinquentDate "2022-03-18" + And Customer makes "AUTOPAY" repayment on "20 March 2022" with 1000 EUR transaction amount + Then Admin checks that delinquency range is: "RANGE_1" and has delinquentDate "2022-04-04" + Then Loan has 1000 total overdue amount + + @TestRailId:C2460 + Scenario: As an admin I would like to check that delinquency and overdue treatment of chargeback works properly when all the instalments are fully paid + When Admin sets the business date to "1 January 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 January 2022", with Principal: "3000", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 January 2022" with "3000" amount and expected disbursement date on "1 January 2022" + When Admin successfully disburse the loan on "1 January 2022" with "3000" EUR transaction amount + When Admin sets the business date to "01 February 2022" + And Customer makes "AUTOPAY" repayment on "01 February 2022" with 1000 EUR transaction amount + When Admin sets the business date to "01 March 2022" + And Customer makes "AUTOPAY" repayment on "01 March 2022" with 1000 EUR transaction amount + When Admin sets the business date to "15 March 2022" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 1000 EUR transaction amount + When Admin sets the business date to "07 April 2022" + And Admin runs the Loan Delinquency Classification job + Then Admin checks that delinquency range is: "RANGE_3" and has delinquentDate "2022-03-18" + And Customer makes "AUTOPAY" repayment on "20 March 2022" with 1000 EUR transaction amount + Then Admin checks that delinquency range is: "RANGE_1" and has delinquentDate "2022-04-04" + Then Loan has 1000 total overdue amount + And Customer makes "AUTOPAY" repayment on "01 April 2022" with 1000 EUR transaction amount + Then Admin checks that delinquency range is: "NO_DELINQUENCY" and has delinquentDate "" + Then Loan has 0 total overdue amount + + @TestRailId:C2486 + Scenario: As an admin I would like to check that Goodwill credit, Payout refund, Merchant Issued refund works properly with chargeback for a fully paid loan + When Admin sets the business date to "1 January 2022" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 January 2022" + And Admin successfully approves the loan on "1 January 2022" with "1000" amount and expected disbursement date on "1 January 2022" + When Admin successfully disburse the loan on "1 January 2022" with "1000" EUR transaction amount + When Admin sets the business date to "1 February 2022" + And Customer makes "AUTOPAY" repayment on "1 February 2022" with 1000 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + When Admin sets the business date to "25 February 2022" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 1000 EUR transaction amount + Then Loan has 1000 outstanding amount + When Admin makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "15 January 2022" with 1000 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + When Admin makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "17 January 2022" with 100 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 0 outstanding amount + Then Loan has 100 overpaid amount + When Admin makes "PAYOUT_REFUND" transaction with "AUTOPAY" payment type on "18 January 2022" with 100 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 0 outstanding amount + Then Loan has 200 overpaid amount + When Admin makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "19 January 2022" with 100 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 0 outstanding amount + Then Loan has 300 overpaid amount + + @TestRailId:C2543 + Scenario: When charge backs comes in after the loan is closed, before the maturity date + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin successfully creates a new customised Loan submitted on date: "1 January 2023", with Principal: "750", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 January 2023" with "750" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "750" EUR transaction amount + When Admin sets the business date to "1 February 2023" + And Customer makes "AUTOPAY" repayment on "1 February 2023" with 250 EUR transaction amount + When Admin sets the business date to "1 March 2023" + And Customer makes "AUTOPAY" repayment on "1 March 2023" with 250 EUR transaction amount + When Admin sets the business date to "30 March 2023" + And Customer makes "AUTOPAY" repayment on "30 March 2023" with 250 EUR transaction amount + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 250 EUR transaction amount for Payment nr. 2 + Then Loan has 250 outstanding 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 2023 | | 750.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 01 February 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 28 | 01 March 2023 | 01 March 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 250.0 | 250.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 0 | 1000 | 750 | 250 | 0 | 250 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 750.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 750.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 March 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "30 March 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "30 March 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | + + + @TestRailId:C2544 + Scenario: When repayment happens again on the charge backs + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin successfully creates a new customised Loan submitted on date: "1 January 2023", with Principal: "750", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 January 2023" with "750" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "750" EUR transaction amount + When Admin sets the business date to "1 February 2023" + And Customer makes "AUTOPAY" repayment on "1 February 2023" with 250 EUR transaction amount + When Admin sets the business date to "1 March 2023" + And Customer makes "AUTOPAY" repayment on "1 March 2023" with 250 EUR transaction amount + When Admin sets the business date to "30 March 2023" + And Customer makes "AUTOPAY" repayment on "30 March 2023" with 250 EUR transaction amount + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 250 EUR transaction amount for Payment nr. 2 + Then Loan has 250 outstanding amount + When Admin sets the business date to "01 April 2023" + And Customer makes "AUTOPAY" repayment on "01 April 2023" with 250 EUR transaction amount + Then Loan has 0 outstanding 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 2023 | | 750.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 01 February 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 28 | 01 March 2023 | 01 March 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 April 2023 | 01 April 2023 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 500.0 | 250.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 0 | 1000 | 1000 | 250 | 0 | 0 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 750.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 750.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 March 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "30 March 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "30 March 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + + @TestRailId:C2545 + Scenario: When repayment 1 is reversed + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin successfully creates a new customised Loan submitted on date: "1 January 2023", with Principal: "750", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 January 2023" with "750" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "750" EUR transaction amount + When Admin sets the business date to "1 February 2023" + And Customer makes "AUTOPAY" repayment on "1 February 2023" with 250 EUR transaction amount + When Admin sets the business date to "1 March 2023" + And Customer makes "AUTOPAY" repayment on "1 March 2023" with 250 EUR transaction amount + When Admin sets the business date to "30 March 2023" + And Customer makes "AUTOPAY" repayment on "30 March 2023" with 250 EUR transaction amount + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 250 EUR transaction amount for Payment nr. 2 + Then Loan has 250 outstanding amount + When Admin sets the business date to "01 April 2023" + And Customer makes "AUTOPAY" repayment on "01 April 2023" with 250 EUR transaction amount + Then Loan has 0 outstanding amount + When Customer undo "1"th repayment on "1 February 2023" + 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 2023 | | 750.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 01 March 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | 2 | 28 | 01 March 2023 | 30 March 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 250.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 0 | 1000 | 750 | 0 | 500 | 250 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 750.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 750.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + | ASSET | 112601 | Loans Receivable | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 March 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "30 March 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "30 March 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + + @TestRailId:C2546 + Scenario: When 2 repayments are reversed (repayment 1 & 3) + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin successfully creates a new customised Loan submitted on date: "1 January 2023", with Principal: "750", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 January 2023" with "750" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "750" EUR transaction amount + When Admin sets the business date to "1 February 2023" + And Customer makes "AUTOPAY" repayment on "1 February 2023" with 250 EUR transaction amount + When Admin sets the business date to "1 March 2023" + And Customer makes "AUTOPAY" repayment on "1 March 2023" with 250 EUR transaction amount + When Admin sets the business date to "30 March 2023" + And Customer makes "AUTOPAY" repayment on "30 March 2023" with 250 EUR transaction amount + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 250 EUR transaction amount for Payment nr. 2 + Then Loan has 250 outstanding amount + When Admin sets the business date to "01 April 2023" + And Customer makes "AUTOPAY" repayment on "01 April 2023" with 250 EUR transaction amount + Then Loan has 0 outstanding amount + When Customer undo "1"th repayment on "1 February 2023" + When Customer undo "3"th repayment on "30 March 2023" + 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 2023 | | 750.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 01 March 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | 2 | 28 | 01 March 2023 | 01 April 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 0 | 1000 | 500 | 0 | 500 | 500 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 750.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 750.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + | ASSET | 112601 | Loans Receivable | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 March 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "30 March 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + | ASSET | 112601 | Loans Receivable | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "30 March 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + + # TODO check the periodic accrual creation + modify + @TestRailId:C2547 @Skip + Scenario: When chargeback happens after the charge addition on maturity date for repayment 01-03-2022 + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin successfully creates a new customised Loan submitted on date: "1 January 2023", with Principal: "750", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 January 2023" with "750" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "750" EUR transaction amount + When Admin sets the business date to "1 February 2023" + And Customer makes "AUTOPAY" repayment on "1 February 2023" with 250 EUR transaction amount + When Admin sets the business date to "1 March 2023" + And Customer makes "AUTOPAY" repayment on "1 March 2023" with 250 EUR transaction amount + When Admin sets the business date to "30 March 2023" + And Customer makes "AUTOPAY" repayment on "30 March 2023" with 250 EUR transaction amount + When Customer undo "3"th repayment on "30 March 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "30 March 2023" due date and 20 EUR transaction amount + Then Loan has 270 outstanding amount + When Admin sets the business date to "31 March 2023" + And Admin runs COB job + When Admin sets the business date to "01 April 2023" + And Customer makes "AUTOPAY" repayment on "01 April 2023" with 270 EUR transaction amount + Then Loan has 0 outstanding amount + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 250 EUR transaction amount for Payment nr. 2 + Then Loan has 250 outstanding 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 2023 | | 750.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 01 February 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 28 | 01 March 2023 | 01 March 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 500.0 | 0.0 | 20.0 | 0.0 | 520.0 | 270.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20 | 0 | 1020 | 770 | 0 | 0 | 250 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 750.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 750.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 March 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "30 March 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + | ASSET | 112601 | Loans Receivable | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | + Then Loan Transactions tab has a "ACCRUAL" transaction with date "30 March 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112603 | Interest/Fee Receivable | 20.0 | | + | INCOME | 404007 | Fee Income | | 20.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 20.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 270.0 | | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "01 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | + + + @TestRailId:C2548 + Scenario: When chargeback comes in after the loan overpayment-1 + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin successfully creates a new customised Loan submitted on date: "1 January 2023", with Principal: "750", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 January 2023" with "750" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "750" EUR transaction amount + When Admin sets the business date to "1 February 2023" + And Customer makes "AUTOPAY" repayment on "1 February 2023" with 250 EUR transaction amount + When Admin sets the business date to "1 March 2023" + And Customer makes "AUTOPAY" repayment on "1 March 2023" with 250 EUR transaction amount + When Admin sets the business date to "30 March 2023" + And Customer makes "AUTOPAY" repayment on "30 March 2023" with 500 EUR transaction amount + Then Loan has 0 outstanding amount + When Admin sets the business date to "01 April 2023" + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 250 EUR transaction amount for Payment nr. 2 + Then Loan has 0 outstanding 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 2023 | | 750.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 01 February 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 28 | 01 March 2023 | 01 March 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 April 2023 | 30 March 2023 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 750 | 0 | 0 | 0 | 750 | 750 | 250 | 0 | 0 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 750.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 750.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 March 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "30 March 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | l1 | Overpayment account | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "01 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | LIABILITY | l1 | Overpayment account | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | + + @TestRailId:C2549 + Scenario: When chargeback comes in after the loan overpayment-2 + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin successfully creates a new customised Loan submitted on date: "1 January 2023", with Principal: "750", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 January 2023" with "750" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "750" EUR transaction amount + When Admin sets the business date to "1 February 2023" + And Customer makes "AUTOPAY" repayment on "1 February 2023" with 150 EUR transaction amount + When Admin sets the business date to "1 March 2023" + And Customer makes "AUTOPAY" repayment on "1 March 2023" with 350 EUR transaction amount + When Admin sets the business date to "30 March 2023" + And Customer makes "AUTOPAY" repayment on "30 March 2023" with 500 EUR transaction amount + Then Loan has 0 outstanding amount + When Admin sets the business date to "01 April 2023" + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 150 EUR transaction amount for Payment nr. 1 + Then Loan has 0 outstanding 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 2023 | | 750.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 01 March 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 100.0 | 0.0 | + | 2 | 28 | 01 March 2023 | 01 March 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 April 2023 | 30 March 2023 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 750 | 0 | 0 | 0 | 750 | 750 | 250 | 100 | 0 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 750.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 750.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 150.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 150.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 March 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 350.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 350.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "30 March 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | l1 | Overpayment account | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "01 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | LIABILITY | l1 | Overpayment account | 150.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 150.0 | + + @TestRailId:C2550 + Scenario: When chargeback comes in after the loan overpayment-3 + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin successfully creates a new customised Loan submitted on date: "1 January 2023", with Principal: "750", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 January 2023" with "750" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "750" EUR transaction amount + When Admin sets the business date to "1 February 2023" + And Customer makes "AUTOPAY" repayment on "1 February 2023" with 150 EUR transaction amount + When Admin sets the business date to "1 March 2023" + And Customer makes "AUTOPAY" repayment on "1 March 2023" with 350 EUR transaction amount + When Admin sets the business date to "30 March 2023" + And Customer makes "AUTOPAY" repayment on "30 March 2023" with 500 EUR transaction amount + Then Loan has 0 outstanding amount + When Admin sets the business date to "01 April 2023" + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 350 EUR transaction amount for Payment nr. 2 + Then Loan has 100 outstanding 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 2023 | | 750.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 01 March 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 100.0 | 0.0 | + | 2 | 28 | 01 March 2023 | 01 March 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 600.0 | 0.0 | 0.0 | 0.0 | 600.0 | 500.0 | 250.0 | 0.0 | 100.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1100 | 0 | 0 | 0 | 1100 | 1000 | 250 | 100 | 100 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 750.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 750.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 150.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 150.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 March 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 350.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 350.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "30 March 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | l1 | Overpayment account | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "01 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 100.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 350.0 | + | LIABILITY | l1 | Overpayment account | 250.0 | | + + @TestRailId:C2551 + Scenario: When chargeback comes in after the loan overpayment-4 with reverse and replay + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin successfully creates a new customised Loan submitted on date: "1 January 2023", with Principal: "750", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 January 2023" with "750" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "750" EUR transaction amount + When Admin sets the business date to "1 February 2023" + And Customer makes "AUTOPAY" repayment on "1 February 2023" with 150 EUR transaction amount + When Admin sets the business date to "1 March 2023" + And Customer makes "AUTOPAY" repayment on "1 March 2023" with 350 EUR transaction amount + When Admin sets the business date to "30 March 2023" + And Customer makes "AUTOPAY" repayment on "30 March 2023" with 500 EUR transaction amount + Then Loan has 0 outstanding amount + When Admin sets the business date to "01 April 2023" + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 350 EUR transaction amount for Payment nr. 2 + Then Loan has 100 outstanding amount + When Customer undo "1"th repayment on "01 February 2023" + Then Loan has 250 outstanding 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 2023 | | 750.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 01 March 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | 2 | 28 | 01 March 2023 | 30 March 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 150.0 | 0.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 600.0 | 0.0 | 0.0 | 0.0 | 600.0 | 350.0 | 250.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1100 | 0 | 0 | 0 | 1100 | 850 | 250 | 400 | 250 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 750.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 750.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 150.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 150.0 | | + | ASSET | 112601 | Loans Receivable | 150.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 150.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 March 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 350.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 350.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "30 March 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 400.0 | + | LIABILITY | l1 | Overpayment account | | 100.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "01 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 350.0 | + | LIABILITY | l1 | Overpayment account | 100.0 | | + + @TestRailId:C2608 + Scenario: When charge backs comes in after the loan is closed for the repayment 01-03-2022 (after maturity) + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin successfully creates a new customised Loan submitted on date: "1 January 2023", with Principal: "750", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 January 2023" with "750" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "750" EUR transaction amount + When Admin sets the business date to "1 February 2023" + And Customer makes "AUTOPAY" repayment on "1 February 2023" with 250 EUR transaction amount + When Admin sets the business date to "1 March 2023" + And Customer makes "AUTOPAY" repayment on "1 March 2023" with 250 EUR transaction amount + When Admin sets the business date to "1 April 2023" + And Customer makes "AUTOPAY" repayment on "1 April 2023" with 250 EUR transaction amount + When Admin sets the business date to "25 April 2023" + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 250 EUR transaction amount for Payment nr. 2 + Then Loan has 250 outstanding amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 750.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 01 February 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 28 | 01 March 2023 | 01 March 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 April 2023 | 01 April 2023 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 4 | 24 | 25 April 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 0 | 1000 | 750 | 0 | 0 | 250 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 750.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 750.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 March 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "25 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | + + @TestRailId:C2609 + Scenario: When repayment happens again on the charge backs (after maturity) + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin successfully creates a new customised Loan submitted on date: "1 January 2023", with Principal: "750", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 January 2023" with "750" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "750" EUR transaction amount + When Admin sets the business date to "1 February 2023" + And Customer makes "AUTOPAY" repayment on "1 February 2023" with 250 EUR transaction amount + When Admin sets the business date to "1 March 2023" + And Customer makes "AUTOPAY" repayment on "1 March 2023" with 250 EUR transaction amount + When Admin sets the business date to "1 April 2023" + And Customer makes "AUTOPAY" repayment on "1 April 2023" with 250 EUR transaction amount + When Admin sets the business date to "25 April 2023" + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 250 EUR transaction amount for Payment nr. 2 + Then Loan has 250 outstanding amount + And Customer makes "AUTOPAY" repayment on "25 April 2023" with 250 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 750.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 01 February 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 28 | 01 March 2023 | 01 March 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 April 2023 | 01 April 2023 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 4 | 24 | 25 April 2023 | 25 April 2023 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 0 | 1000 | 1000 | 0 | 0 | 0 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 750.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 750.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 March 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "25 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "25 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + + @TestRailId:C2610 + Scenario: When repayment 1 is reversed (after maturity) + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin successfully creates a new customised Loan submitted on date: "1 January 2023", with Principal: "750", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 January 2023" with "750" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "750" EUR transaction amount + When Admin sets the business date to "1 February 2023" + And Customer makes "AUTOPAY" repayment on "1 February 2023" with 250 EUR transaction amount + When Admin sets the business date to "1 March 2023" + And Customer makes "AUTOPAY" repayment on "1 March 2023" with 250 EUR transaction amount + When Admin sets the business date to "1 April 2023" + And Customer makes "AUTOPAY" repayment on "01 April 2023" with 250 EUR transaction amount + When Admin sets the business date to "25 April 2023" + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 250 EUR transaction amount for Payment nr. 2 + Then Loan has 250 outstanding amount + And Customer makes "AUTOPAY" repayment on "25 April 2023" with 250 EUR transaction amount + Then Loan has 0 outstanding amount + When Customer undo "1"th repayment on "1 February 2023" + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 750.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 01 March 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | 2 | 28 | 01 March 2023 | 01 April 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | 3 | 31 | 01 April 2023 | 25 April 2023 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | 4 | 24 | 25 April 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 0 | 1000 | 750 | 0 | 750 | 250 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 750.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 750.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + | ASSET | 112601 | Loans Receivable | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 March 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "25 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "25 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + + @TestRailId:C2611 + Scenario: When 2 repayments are reversed (repayment 1 & 3) (after maturity) + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin successfully creates a new customised Loan submitted on date: "1 January 2023", with Principal: "750", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 January 2023" with "750" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "750" EUR transaction amount + When Admin sets the business date to "1 February 2023" + And Customer makes "AUTOPAY" repayment on "1 February 2023" with 250 EUR transaction amount + When Admin sets the business date to "1 March 2023" + And Customer makes "AUTOPAY" repayment on "1 March 2023" with 250 EUR transaction amount + When Admin sets the business date to "1 April 2023" + And Customer makes "AUTOPAY" repayment on "1 April 2023" with 250 EUR transaction amount + When Admin sets the business date to "25 April 2023" + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 250 EUR transaction amount for Payment nr. 2 + Then Loan has 250 outstanding amount + And Customer makes "AUTOPAY" repayment on "25 April 2023" with 250 EUR transaction amount + Then Loan has 0 outstanding amount + When Customer undo "1"th repayment on "1 February 2023" + When Customer undo "3"th repayment on "1 April 2023" + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 750.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 01 March 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | 2 | 28 | 01 March 2023 | 25 April 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 24 | 25 April 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 0 | 1000 | 500 | 0 | 500 | 500 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 750.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 750.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + | ASSET | 112601 | Loans Receivable | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 March 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + | ASSET | 112601 | Loans Receivable | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "25 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "25 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + + @TestRailId:C2623 + Scenario: When second charge back happens for the repayment 01-04-2022 (after maturity) + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin successfully creates a new customised Loan submitted on date: "1 January 2023", with Principal: "750", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 January 2023" with "750" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "750" EUR transaction amount + When Admin sets the business date to "1 February 2023" + And Customer makes "AUTOPAY" repayment on "1 February 2023" with 250 EUR transaction amount + When Admin sets the business date to "1 March 2023" + And Customer makes "AUTOPAY" repayment on "1 March 2023" with 250 EUR transaction amount + When Admin sets the business date to "1 April 2023" + And Customer makes "AUTOPAY" repayment on "1 April 2023" with 250 EUR transaction amount + When Admin sets the business date to "25 April 2023" + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 250 EUR transaction amount for Payment nr. 2 + Then Loan has 250 outstanding amount + And Customer makes "AUTOPAY" repayment on "25 April 2023" with 250 EUR transaction amount + Then Loan has 0 outstanding amount + When Admin sets the business date to "1 May 2023" + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 200 EUR transaction amount for Payment nr. 3 + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 750.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 01 February 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 28 | 01 March 2023 | 01 March 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 April 2023 | 01 April 2023 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 4 | 30 | 01 May 2023 | | 0.0 | 450.0 | 0.0 | 0.0 | 0.0 | 450.0 | 250.0 | 0.0 | 0.0 | 200.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1200 | 0 | 0 | 0 | 1200 | 1000 | 0 | 0 | 200 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 750.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 750.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 March 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "25 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "25 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "01 May 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 200.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 200.0 | + + @TestRailId:C2612 + Scenario: When chargeback happens after the charge addition on maturity date for repayment 01-03-2022 (after maturity) + When Admin sets the business date to "1 January 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 | + | PIN30 | 01 January 2023 | 750 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "01 January 2023" with "750" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "750" EUR transaction amount + When Admin sets the business date to "01 February 2023" + And Customer makes "AUTOPAY" repayment on "01 February 2023" with 250 EUR transaction amount + When Admin sets the business date to "01 March 2023" + And Customer makes "AUTOPAY" repayment on "01 March 2023" with 250 EUR transaction amount + When Admin sets the business date to "01 April 2023" + And Customer makes "AUTOPAY" repayment on "01 April 2023" with 250 EUR transaction amount + When Customer undo "3"th repayment on "01 April 2023" + When Admin sets the business date to "05 April 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "05 April 2023" due date and 20 EUR transaction amount + Then Loan has 270 outstanding amount + And Admin runs COB job + And Customer makes "AUTOPAY" repayment on "05 April 2023" with 270 EUR transaction amount + Then Loan has 0 outstanding amount + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 250 EUR transaction amount for Payment nr. 2 + Then Loan has 250 outstanding amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 750.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 01 February 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 28 | 01 March 2023 | 01 March 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 April 2023 | 05 April 2023 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | 4 | 4 | 05 April 2023 | | 0.0 | 250.0 | 0.0 | 20.0 | 0.0 | 270.0 | 20.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20 | 0 | 1020 | 770 | 0 | 250 | 250 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 750.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 750.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 March 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + | ASSET | 112601 | Loans Receivable | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | + Then Loan Transactions tab has a "ACCRUAL" transaction with date "05 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112603 | Interest/Fee Receivable | 20.0 | | + | INCOME | 404007 | Fee Income | | 20.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "05 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 20.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 270.0 | | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "05 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | + + @TestRailId:C2613 + Scenario: When chargeback comes in after the loan overpayment-1 (after maturity) + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin successfully creates a new customised Loan submitted on date: "1 January 2023", with Principal: "750", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 January 2023" with "750" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "750" EUR transaction amount + When Admin sets the business date to "1 February 2023" + And Customer makes "AUTOPAY" repayment on "1 February 2023" with 250 EUR transaction amount + When Admin sets the business date to "1 March 2023" + And Customer makes "AUTOPAY" repayment on "1 March 2023" with 250 EUR transaction amount + When Admin sets the business date to "1 April 2023" + And Customer makes "AUTOPAY" repayment on "1 April 2023" with 500 EUR transaction amount + Then Loan has 0 outstanding amount + When Admin sets the business date to "25 April 2023" + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 250 EUR transaction amount for Payment nr. 2 + Then Loan has 0 outstanding 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 2023 | | 750.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 01 February 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 28 | 01 March 2023 | 01 March 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 April 2023 | 01 April 2023 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 750 | 0 | 0 | 0 | 750 | 750 | 0 | 0 | 0 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 750.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 750.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 March 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | l1 | Overpayment account | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "25 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | LIABILITY | l1 | Overpayment account | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | + + @TestRailId:C2614 + Scenario: When chargeback comes in after the loan overpayment-2 (after maturity) + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin successfully creates a new customised Loan submitted on date: "1 January 2023", with Principal: "750", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 January 2023" with "750" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "750" EUR transaction amount + When Admin sets the business date to "1 February 2023" + And Customer makes "AUTOPAY" repayment on "1 February 2023" with 150 EUR transaction amount + When Admin sets the business date to "1 March 2023" + And Customer makes "AUTOPAY" repayment on "1 March 2023" with 350 EUR transaction amount + When Admin sets the business date to "1 April 2023" + And Customer makes "AUTOPAY" repayment on "1 April 2023" with 500 EUR transaction amount + Then Loan has 0 outstanding amount + When Admin sets the business date to "25 April 2023" + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 150 EUR transaction amount for Payment nr. 1 + Then Loan has 0 outstanding 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 2023 | | 750.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 01 March 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 100.0 | 0.0 | + | 2 | 28 | 01 March 2023 | 01 March 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 April 2023 | 01 April 2023 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 750 | 0 | 0 | 0 | 750 | 750 | 0 | 100 | 0 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 750.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 750.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 150.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 150.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 March 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 350.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 350.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | l1 | Overpayment account | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "25 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | LIABILITY | l1 | Overpayment account | 150.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 150.0 | + + @TestRailId:C2615 + Scenario: When chargeback comes in after the loan overpayment-3 (after maturity) + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin successfully creates a new customised Loan submitted on date: "1 January 2023", with Principal: "750", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 January 2023" with "750" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "750" EUR transaction amount + When Admin sets the business date to "1 February 2023" + And Customer makes "AUTOPAY" repayment on "1 February 2023" with 150 EUR transaction amount + When Admin sets the business date to "1 March 2023" + And Customer makes "AUTOPAY" repayment on "1 March 2023" with 350 EUR transaction amount + When Admin sets the business date to "1 April 2023" + And Customer makes "AUTOPAY" repayment on "1 April 2023" with 500 EUR transaction amount + Then Loan has 0 outstanding amount + When Admin sets the business date to "25 April 2023" + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 350 EUR transaction amount for Payment nr. 2 + Then Loan has 100 outstanding amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 750.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 01 March 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 100.0 | 0.0 | + | 2 | 28 | 01 March 2023 | 01 March 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 April 2023 | 01 April 2023 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 4 | 24 | 25 April 2023 | | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | 250.0 | 0.0 | 0.0 | 100.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1100 | 0 | 0 | 0 | 1100 | 1000 | 0 | 100 | 100 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 750.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 750.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 150.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 150.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 March 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 350.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 350.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | l1 | Overpayment account | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "25 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 100.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 350.0 | + | LIABILITY | l1 | Overpayment account | 250.0 | | + + @TestRailId:C2616 + Scenario: When chargeback comes in after the loan overpayment-4 with reverse and replay (after maturity) + When Admin sets the business date to "1 January 2023" + When Admin creates a client with random data + When Admin successfully creates a new customised Loan submitted on date: "1 January 2023", with Principal: "750", a loanTermFrequency: 3 months, and numberOfRepayments: 3 + And Admin successfully approves the loan on "1 January 2023" with "750" amount and expected disbursement date on "1 January 2023" + When Admin successfully disburse the loan on "1 January 2023" with "750" EUR transaction amount + When Admin sets the business date to "1 February 2023" + And Customer makes "AUTOPAY" repayment on "1 February 2023" with 150 EUR transaction amount + When Admin sets the business date to "1 March 2023" + And Customer makes "AUTOPAY" repayment on "1 March 2023" with 350 EUR transaction amount + When Admin sets the business date to "1 April 2023" + And Customer makes "AUTOPAY" repayment on "1 April 2023" with 500 EUR transaction amount + Then Loan has 0 outstanding amount + When Admin sets the business date to "25 April 2023" + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 350 EUR transaction amount for Payment nr. 2 + Then Loan has 100 outstanding amount + When Customer undo "1"th repayment on "01 February 2023" + Then Loan has 250 outstanding amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2023 | | 750.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 01 March 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | 2 | 28 | 01 March 2023 | 01 April 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 150.0 | 0.0 | + | 3 | 31 | 01 April 2023 | 01 April 2023 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 4 | 24 | 25 April 2023 | | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | 100.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1100 | 0 | 0 | 0 | 1100 | 850 | 0 | 400 | 250 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 750.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 750.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 150.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 150.0 | | + | ASSET | 112601 | Loans Receivable | 150.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 150.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 March 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 350.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 350.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 400.0 | + | LIABILITY | l1 | Overpayment account | | 100.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "25 April 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 250.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 350.0 | + | LIABILITY | l1 | Overpayment account | 100.0 | | + + @TestRailId:C2624 + Scenario: As an admin I would like to verify principal portion for partial chargeback for OVERPAID loan + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "01 February 2023" + And Customer makes "AUTOPAY" repayment on "01 February 2023" with 500 EUR transaction amount + Then Loan has 500 outstanding amount + Then Loan status will be "ACTIVE" + When Admin sets the business date to "01 March 2023" + And Customer makes "AUTOPAY" repayment on "01 March 2023" with 300 EUR transaction amount + Then Loan has 200 outstanding amount + Then Loan status will be "ACTIVE" + When Admin sets the business date to "01 April 2023" + And Customer makes "AUTOPAY" repayment on "01 April 2023" with 300 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan status will be "OVERPAID" + When Admin sets the business date to "04 April 2023" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 300 EUR transaction amount for Payment nr. 2 + Then Loan status will be "ACTIVE" + Then Loan has 200 outstanding amount + When Admin sets the business date to "07 April 2023" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 300 EUR transaction amount for Payment nr. 1 + Then Loan Transactions tab has a transaction with date: "07 April 2023", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Chargeback | 300.0 | 300.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan status will be "ACTIVE" + Then Loan has 500 outstanding amount + + @TestRailId:C2870 @AdvancedPaymentAllocationChargeback @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation on a closed loan in case of payment type: REPAYMENT_ADJUSTMENT_CHARGEBACK + When Admin sets the business date to "01 September 2023" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 September 2023 | 400 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "400" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "400" EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 100 EUR transaction amount + When Admin sets the business date to "01 October 2023" + And Customer makes "AUTOPAY" repayment on "01 October 2023" with 100 EUR transaction amount + When Admin sets the business date to "16 October 2023" + And Customer makes "AUTOPAY" repayment on "16 October 2023" with 100 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + When Admin sets the business date to "25 October 2023" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 100 EUR transaction amount + Then Loan has 100 outstanding amount + Then Loan status will be "ACTIVE" + Then Loan Repayment schedule has 5 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 September 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 300.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 200.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | 01 October 2023 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 16 October 2023 | 16 October 2023 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 5 | 9 | 25 October 2023 | | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 400.0 | 0.0 | 0.0 | 100.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 01 September 2023 | Down Payment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 16 September 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 200.0 | + | 01 October 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 16 October 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 25 October 2023 | Chargeback | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + + @TestRailId:C2871 @AdvancedPaymentAllocationChargeback @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation on a closed loan in case of payment type: REPAYMENT_ADJUSTMENT_REFUND + When Admin sets the business date to "01 September 2023" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 September 2023 | 400 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "400" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "400" EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 100 EUR transaction amount + When Admin sets the business date to "01 October 2023" + And Customer makes "AUTOPAY" repayment on "01 October 2023" with 100 EUR transaction amount + When Admin sets the business date to "16 October 2023" + And Customer makes "AUTOPAY" repayment on "16 October 2023" with 100 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + When Admin sets the business date to "25 October 2023" + When Admin makes "REPAYMENT_ADJUSTMENT_REFUND" chargeback with 100 EUR transaction amount + Then Loan has 100 outstanding amount + Then Loan status will be "ACTIVE" + Then Loan Repayment schedule has 5 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 September 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 300.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 200.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | 01 October 2023 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 16 October 2023 | 16 October 2023 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 5 | 9 | 25 October 2023 | | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 400.0 | 0.0 | 0.0 | 100.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 01 September 2023 | Down Payment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 16 September 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 200.0 | + | 01 October 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 16 October 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 25 October 2023 | Chargeback | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + + @TestRailId:C2872 @AdvancedPaymentAllocationChargeback @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation when full repayment happens after chargeback, on the same business date + When Admin sets the business date to "01 September 2023" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 September 2023 | 400 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "400" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "400" EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 100 EUR transaction amount + When Admin sets the business date to "01 October 2023" + And Customer makes "AUTOPAY" repayment on "01 October 2023" with 100 EUR transaction amount + When Admin sets the business date to "16 October 2023" + And Customer makes "AUTOPAY" repayment on "16 October 2023" with 100 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + When Admin sets the business date to "25 October 2023" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 100 EUR transaction amount + Then Loan has 100 outstanding amount + Then Loan status will be "ACTIVE" + And Customer makes "AUTOPAY" repayment on "25 October 2023" with 100 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 300.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 200.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | 01 October 2023 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 16 October 2023 | 16 October 2023 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 5 | 9 | 25 October 2023 | 25 October 2023 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 01 September 2023 | Down Payment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 16 September 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 200.0 | + | 01 October 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 16 October 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 25 October 2023 | Chargeback | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 25 October 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | + + @TestRailId:C2873 @AdvancedPaymentAllocationChargeback @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation when partial repayment happens after chargeback, on the same business date + When Admin sets the business date to "01 September 2023" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 September 2023 | 400 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "400" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "400" EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 100 EUR transaction amount + When Admin sets the business date to "01 October 2023" + And Customer makes "AUTOPAY" repayment on "01 October 2023" with 100 EUR transaction amount + When Admin sets the business date to "16 October 2023" + And Customer makes "AUTOPAY" repayment on "16 October 2023" with 100 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + When Admin sets the business date to "25 October 2023" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 100 EUR transaction amount + Then Loan has 100 outstanding amount + Then Loan status will be "ACTIVE" + And Customer makes "AUTOPAY" repayment on "25 October 2023" with 50 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 300.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 200.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | 01 October 2023 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 16 October 2023 | 16 October 2023 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 5 | 9 | 25 October 2023 | | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 50.0 | 0.0 | 0.0 | 50.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 450.0 | 0.0 | 0.0 | 50.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 01 September 2023 | Down Payment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 16 September 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 200.0 | + | 01 October 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 16 October 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 25 October 2023 | Chargeback | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 25 October 2023 | Repayment | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | + + @TestRailId:C2874 @AdvancedPaymentAllocationChargeback @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation when full repayment happens after chargeback, on a future business date + When Admin sets the business date to "01 September 2023" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 September 2023 | 400 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "400" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "400" EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 100 EUR transaction amount + When Admin sets the business date to "01 October 2023" + And Customer makes "AUTOPAY" repayment on "01 October 2023" with 100 EUR transaction amount + When Admin sets the business date to "16 October 2023" + And Customer makes "AUTOPAY" repayment on "16 October 2023" with 100 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + When Admin sets the business date to "25 October 2023" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 100 EUR transaction amount + Then Loan has 100 outstanding amount + Then Loan status will be "ACTIVE" + When Admin sets the business date to "30 October 2023" + And Customer makes "AUTOPAY" repayment on "30 October 2023" with 100 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 300.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 200.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | 01 October 2023 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 16 October 2023 | 16 October 2023 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 5 | 9 | 25 October 2023 | 30 October 2023 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 100.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 500.0 | 0.0 | 100.0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 01 September 2023 | Down Payment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 16 September 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 200.0 | + | 01 October 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 16 October 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 25 October 2023 | Chargeback | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 30 October 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | + + @TestRailId:C2875 @AdvancedPaymentAllocationChargeback @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation when partial repayment happens after chargeback, on a future business date + When Admin sets the business date to "01 September 2023" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 September 2023 | 400 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "400" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "400" EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 100 EUR transaction amount + When Admin sets the business date to "01 October 2023" + And Customer makes "AUTOPAY" repayment on "01 October 2023" with 100 EUR transaction amount + When Admin sets the business date to "16 October 2023" + And Customer makes "AUTOPAY" repayment on "16 October 2023" with 100 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + When Admin sets the business date to "25 October 2023" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 100 EUR transaction amount + Then Loan has 100 outstanding amount + Then Loan status will be "ACTIVE" + When Admin sets the business date to "30 October 2023" + And Customer makes "AUTOPAY" repayment on "30 October 2023" with 50 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 300.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 200.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | 01 October 2023 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 16 October 2023 | 16 October 2023 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 5 | 9 | 25 October 2023 | | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 50.0 | 0.0 | 50.0 | 50.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 450.0 | 0.0 | 50.0 | 50.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 01 September 2023 | Down Payment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 16 September 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 200.0 | + | 01 October 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 16 October 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 25 October 2023 | Chargeback | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 30 October 2023 | Repayment | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | + + @TestRailId:C2876 @AdvancedPaymentAllocationChargeback @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation when a second chargeback happens after the repayment + When Admin sets the business date to "01 September 2023" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 September 2023 | 400 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "400" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "400" EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 100 EUR transaction amount + When Admin sets the business date to "01 October 2023" + And Customer makes "AUTOPAY" repayment on "01 October 2023" with 100 EUR transaction amount + When Admin sets the business date to "16 October 2023" + And Customer makes "AUTOPAY" repayment on "16 October 2023" with 100 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + When Admin sets the business date to "25 October 2023" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 100 EUR transaction amount + Then Loan has 100 outstanding amount + Then Loan status will be "ACTIVE" + When Admin sets the business date to "30 October 2023" + And Customer makes "AUTOPAY" repayment on "30 October 2023" with 100 EUR transaction amount + When Admin sets the business date to "01 November 2023" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 100 EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 300.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 200.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | 01 October 2023 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 16 October 2023 | 16 October 2023 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 5 | 16 | 01 November 2023 | | 0.0 | 200.0 | 0.0 | 0.0 | 0.0 | 200.0 | 100.0 | 0.0 | 100.0 | 100.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 600.0 | 0 | 0.0 | 0 | 600.0 | 500.0 | 0.0 | 100.0 | 100.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 01 September 2023 | Down Payment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 16 September 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 200.0 | + | 01 October 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 16 October 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 25 October 2023 | Chargeback | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 30 October 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 01 November 2023 | Chargeback | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + + @TestRailId:C2877 @AdvancedPaymentAllocationChargeback @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation -loan goes to ACTIVE when the it is OVERPAID but the chargeback amount is HIGHER than the overpaid amount + When Admin sets the business date to "01 September 2023" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 September 2023 | 400 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "400" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "400" EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 100 EUR transaction amount + When Admin sets the business date to "01 October 2023" + And Customer makes "AUTOPAY" repayment on "01 October 2023" with 100 EUR transaction amount + When Admin sets the business date to "16 October 2023" + And Customer makes "AUTOPAY" repayment on "16 October 2023" with 150 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan status will be "OVERPAID" + When Admin sets the business date to "25 October 2023" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 100 EUR transaction amount + Then Loan has 50 outstanding amount + Then Loan status will be "ACTIVE" + Then Loan Repayment schedule has 5 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 September 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 300.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 200.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | 01 October 2023 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 16 October 2023 | 16 October 2023 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 5 | 9 | 25 October 2023 | | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 50.0 | 0.0 | 0.0 | 50.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 450.0 | 0.0 | 0.0 | 50.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 01 September 2023 | Down Payment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 16 September 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 200.0 | + | 01 October 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 16 October 2023 | Repayment | 150.0 | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 25 October 2023 | Chargeback | 100.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | + + @TestRailId:C2878 @AdvancedPaymentAllocationChargeback @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation -loan remains OVERPAID when the it is OVERPAID but the chargeback amount is LOWER than the overpaid amount + When Admin sets the business date to "01 September 2023" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 September 2023 | 400 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "400" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "400" EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 100 EUR transaction amount + When Admin sets the business date to "01 October 2023" + And Customer makes "AUTOPAY" repayment on "01 October 2023" with 100 EUR transaction amount + When Admin sets the business date to "16 October 2023" + And Customer makes "AUTOPAY" repayment on "16 October 2023" with 150 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan status will be "OVERPAID" + When Admin sets the business date to "25 October 2023" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 25 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan status will be "OVERPAID" + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 300.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 200.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | 01 October 2023 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 16 October 2023 | 16 October 2023 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 400.0 | 0 | 0.0 | 0 | 400.0 | 400.0 | 0.0 | 0.0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 01 September 2023 | Down Payment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 16 September 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 200.0 | + | 01 October 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 16 October 2023 | Repayment | 150.0 | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 25 October 2023 | Chargeback | 25.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + + @TestRailId:C2879 @AdvancedPaymentAllocationChargeback @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation -loan goes to CLOSED when the loan is OVERPAID but the chargeback amount is EQUALS than the overpaid amount + When Admin sets the business date to "01 September 2023" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 September 2023 | 400 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "400" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "400" EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 100 EUR transaction amount + When Admin sets the business date to "01 October 2023" + And Customer makes "AUTOPAY" repayment on "01 October 2023" with 100 EUR transaction amount + When Admin sets the business date to "16 October 2023" + And Customer makes "AUTOPAY" repayment on "16 October 2023" with 150 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan status will be "OVERPAID" + When Admin sets the business date to "25 October 2023" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 50 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 300.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 200.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | 01 October 2023 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 16 October 2023 | 16 October 2023 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 400.0 | 0 | 0.0 | 0 | 400.0 | 400.0 | 0.0 | 0.0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 01 September 2023 | Down Payment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 16 September 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 200.0 | + | 01 October 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 16 October 2023 | Repayment | 150.0 | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 25 October 2023 | Chargeback | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + + @TestRailId:C2880 @AdvancedPaymentAllocationChargeback @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation - chargeback after the loan is closed, before the maturity date + When Admin sets the business date to "01 September 2023" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 September 2023 | 400 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "400" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "400" EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 100 EUR transaction amount + When Admin sets the business date to "01 October 2023" + And Customer makes "AUTOPAY" repayment on "01 October 2023" with 100 EUR transaction amount + When Admin sets the business date to "10 October 2023" + And Customer makes "AUTOPAY" repayment on "10 October 2023" with 100 EUR transaction amount + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 100 EUR transaction amount for Payment nr. 2 + Then Loan has 100 outstanding amount + Then Loan status will be "ACTIVE" + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 300.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 16 September 2023 | 200.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | 01 October 2023 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 200.0 | 0.0 | 0.0 | 0.0 | 200.0 | 100.0 | 100.0 | 0.0 | 100.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 400.0 | 100.0 | 0.0 | 100.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 01 September 2023 | Down Payment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 16 September 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 200.0 | + | 01 October 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 10 October 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 10 October 2023 | Chargeback | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + + @TestRailId:C2881 @AdvancedPaymentAllocationChargeback @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation - repayment 1 is reversed + When Admin sets the business date to "01 September 2023" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 September 2023 | 400 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "400" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "400" EUR transaction amount + When Admin sets the business date to "16 September 2023" + And Customer makes "AUTOPAY" repayment on "16 September 2023" with 100 EUR transaction amount + When Admin sets the business date to "01 October 2023" + And Customer makes "AUTOPAY" repayment on "01 October 2023" with 100 EUR transaction amount + When Admin sets the business date to "16 October 2023" + And Customer makes "AUTOPAY" repayment on "16 October 2023" with 100 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + When Admin sets the business date to "25 October 2023" + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 100 EUR transaction amount for Payment nr. 2 + Then Loan has 100 outstanding amount + When Admin sets the business date to "30 October 2023" + And Customer makes "AUTOPAY" repayment on "30 October 2023" with 100 EUR transaction amount + Then Loan has 0 outstanding amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + When Customer undo "1"th transaction made on "16 September 2023" + Then On Loan Transactions tab the "Repayment" Transaction with date "16 September 2023" is reverted + Then Loan has 100 outstanding amount + Then Loan status will be "ACTIVE" + Then Loan Repayment schedule has 5 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 September 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 300.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 01 October 2023 | 200.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 100.0 | 0.0 | + | 3 | 15 | 01 October 2023 | 16 October 2023 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 100.0 | 0.0 | + | 4 | 15 | 16 October 2023 | 30 October 2023 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 100.0 | 0.0 | + | 5 | 9 | 25 October 2023 | | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0 | 0.0 | 0 | 500.0 | 400.0 | 0.0 | 300.0 | 100.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 01 September 2023 | Down Payment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 16 September 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 200.0 | + | 01 October 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 200.0 | + | 16 October 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 25 October 2023 | Chargeback | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 200.0 | + | 30 October 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + + @TestRailId:C3034 @AdvancedPaymentAllocationChargeback @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation - overpayment handling + When Admin sets the business date to "01 September 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_INSTALLMENT_LEVEL_DELINQUENCY | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" EUR transaction amount + Then Loan has 1000 outstanding amount + When Admin sets the business date to "05 September 2023" + When Customer makes "AUTOPAY" repayment on "05 September 2023" with 500 EUR transaction amount + Then Loan has 500 outstanding amount + When Admin sets the business date to "11 January 2024" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 500 EUR transaction amount + Then Loan has 1000 outstanding amount + When Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "06 September 2023" with 200 EUR transaction amount and system-generated Idempotency key + Then Loan has 800 outstanding amount + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 200 EUR transaction amount + Then Loan has 1000 outstanding amount + When Customer makes "PAYOUT_REFUND" transaction with "AUTOPAY" payment type on "07 September 2023" with 300 EUR transaction amount and system-generated Idempotency key + Then Loan has 700 outstanding amount + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 300 EUR transaction amount + Then Loan has 1000 outstanding amount + When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "08 September 2023" with 100 EUR transaction amount and system-generated Idempotency key + Then Loan has 900 outstanding amount + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 100 EUR transaction amount + Then Loan has 1000 outstanding amount + + @TestRailId:C3038 @AdvancedPaymentAllocationChargeback @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation - chargeback on downpayment + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "1000" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "1000" EUR transaction amount + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 250 EUR transaction amount for Downpayment nr. 1 + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 3 | 15 | 31 January 2024 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1250.0 | 0 | 0.0 | 0 | 1250.0 | 250.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2024 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2024 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 01 January 2024 | Chargeback | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + + @TestRailId:C3039 @AdvancedPaymentAllocationChargeback @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation - partial chargeback on downpayment + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "1000" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "1000" EUR transaction amount + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 200 EUR transaction amount for Downpayment nr. 1 + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | | 500.0 | 450.0 | 0.0 | 0.0 | 0.0 | 450.0 | 0.0 | 0.0 | 0.0 | 450.0 | + | 3 | 15 | 31 January 2024 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1200.0 | 0 | 0.0 | 0 | 1200.0 | 250.0 | 0.0 | 0.0 | 950.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2024 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2024 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 01 January 2024 | Chargeback | 200.0 | 200.0 | 0.0 | 0.0 | 0.0 | 950.0 | + +# TODO chack and finish when credit allocation is implemented + @creditAllocation @AdvancedPaymentAllocationChargeback @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation - credit allocation UC1 + When Admin sets the business date to "01 January 2024" + 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROG_SCHEDULE_HOR_INST_LVL_DELINQUENCY_CREDIT_ALLOCATION | 01 January 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "1000" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "1000" EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "16 January 2024" due date and 20 EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "16 January 2024" due date and 50 EUR transaction amount + When Customer makes "AUTOPAY" repayment on "01 January 2024" with 250 EUR transaction amount + When Admin sets the business date to "16 January 2024" + When Customer makes "AUTOPAY" repayment on "16 January 2024" with 320 EUR transaction amount + When Admin sets the business date to "17 January 2024" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 10 EUR transaction amount + + @TestRailId:C3079 @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation - full chargeback on overpaid loan + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2024 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "500" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "500" EUR transaction amount + When Admin sets the business date to "10 January 2024" + When Customer makes "PAYOUT_REFUND" transaction with "AUTOPAY" payment type on "10 January 2024" with 500 EUR transaction amount and system-generated Idempotency key + Then Loan status will be "OVERPAID" + Then Loan has 125 overpaid amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | 10 January 2024 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 125.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2024 | 10 January 2024 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 125.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2024 | 10 January 2024 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 125.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 500.0 | 375.0 | 0.0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2024 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 10 January 2024 | Payout Refund | 500.0 | 375.0 | 0.0 | 0.0 | 0.0 | 0.0 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 500.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 500.0 | + Then Loan Transactions tab has a "DOWN_PAYMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 125.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 125.0 | | + Then Loan Transactions tab has a "PAYOUT_REFUND" transaction with date "10 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 375.0 | + | LIABILITY | l1 | Overpayment account | | 125.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | +# --- Chargeback transaction added on same day --- + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 125 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | 10 January 2024 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 125.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2024 | 10 January 2024 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 125.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2024 | 10 January 2024 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 125.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 500.0 | 375.0 | 0.0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2024 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 10 January 2024 | Payout Refund | 500.0 | 375.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 10 January 2024 | Chargeback | 125.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 500.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 500.0 | + Then Loan Transactions tab has a "DOWN_PAYMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 125.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 125.0 | | + Then Loan Transactions tab has a "PAYOUT_REFUND" transaction with date "10 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 375.0 | + | LIABILITY | l1 | Overpayment account | | 125.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "10 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | LIABILITY | l1 | Overpayment account | 125.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 125.0 | + + @TestRailId:C3080 @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation - partial chargeback on overpaid loan + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2024 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "500" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "500" EUR transaction amount + When Admin sets the business date to "10 January 2024" + When Customer makes "PAYOUT_REFUND" transaction with "AUTOPAY" payment type on "10 January 2024" with 500 EUR transaction amount and system-generated Idempotency key + Then Loan status will be "OVERPAID" + Then Loan has 125 overpaid amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | 10 January 2024 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 125.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2024 | 10 January 2024 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 125.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2024 | 10 January 2024 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 125.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 500.0 | 375.0 | 0.0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2024 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 10 January 2024 | Payout Refund | 500.0 | 375.0 | 0.0 | 0.0 | 0.0 | 0.0 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 500.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 500.0 | + Then Loan Transactions tab has a "DOWN_PAYMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 125.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 125.0 | | + Then Loan Transactions tab has a "PAYOUT_REFUND" transaction with date "10 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 375.0 | + | LIABILITY | l1 | Overpayment account | | 125.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | +# --- Chargeback transaction added on same day --- + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 25 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 100 overpaid amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | 10 January 2024 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 125.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2024 | 10 January 2024 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 125.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2024 | 10 January 2024 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 125.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 500.0 | 375.0 | 0.0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2024 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 10 January 2024 | Payout Refund | 500.0 | 375.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 10 January 2024 | Chargeback | 25.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 500.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 500.0 | + Then Loan Transactions tab has a "DOWN_PAYMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 125.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 125.0 | | + Then Loan Transactions tab has a "PAYOUT_REFUND" transaction with date "10 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 375.0 | + | LIABILITY | l1 | Overpayment account | | 125.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 500.0 | | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "10 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | LIABILITY | l1 | Overpayment account | 25.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 25.0 | + + @TestRailId:C3081 @creditAllocation @AdvancedPaymentAllocationChargeback @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation - credit allocation UC1: partial, prior chargeback + When Admin sets the business date to "01 January 2024" + 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROG_SCHEDULE_HOR_INST_LVL_DELINQUENCY_CREDIT_ALLOCATION | 01 January 2024 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "500" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "500" EUR transaction amount + When Admin sets the business date to "04 January 2024" + And Customer makes "AUTOPAY" repayment on "04 January 2024" with 125 EUR transaction amount + When Admin sets the business date to "16 January 2024" + And Customer makes "AUTOPAY" repayment on "16 January 2024" with 125 EUR transaction amount + When Admin sets the business date to "20 January 2024" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 125 EUR transaction amount + When Admin sets the business date to "31 January 2024" + And Customer makes "AUTOPAY" repayment on "31 January 2024" with 250 EUR transaction amount + When Admin sets the business date to "15 February 2024" + And Customer makes "AUTOPAY" repayment on "15 February 2024" with 125 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 04 January 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 125.0 | 0.0 | + | 2 | 15 | 16 January 2024 | 16 January 2024 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2024 | 31 January 2024 | 125.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2024 | 15 February 2024 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 625.0 | 0.0 | 0.0 | 0.0 | 625.0 | 625.0 | 0.0 | 125.0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 04 January 2024 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 16 January 2024 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 20 January 2024 | Chargeback | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 31 January 2024 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 15 February 2024 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 0.0 | + + @TestRailId:C3082 @creditAllocation @AdvancedPaymentAllocationChargeback @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation - credit allocation UC2: partial, prior chargeback with penalty + When Admin sets the business date to "01 January 2024" + 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROG_SCHEDULE_HOR_INST_LVL_DELINQUENCY_CREDIT_ALLOCATION | 01 January 2024 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "500" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "500" EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "01 January 2024" due date and 3 EUR transaction amount + When Admin sets the business date to "04 January 2024" + And Customer makes "AUTOPAY" repayment on "04 January 2024" with 125 EUR transaction amount + When Admin sets the business date to "16 January 2024" + And Customer makes "AUTOPAY" repayment on "16 January 2024" with 128 EUR transaction amount + When Admin sets the business date to "20 January 2024" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 128 EUR transaction amount + When Admin sets the business date to "31 January 2024" + And Customer makes "AUTOPAY" repayment on "31 January 2024" with 253 EUR transaction amount + When Admin sets the business date to "15 February 2024" + And Customer makes "AUTOPAY" repayment on "15 February 2024" with 125 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 04 January 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 125.0 | 0.0 | + | 2 | 15 | 16 January 2024 | 16 January 2024 | 250.0 | 125.0 | 0.0 | 0.0 | 3.0 | 128.0 | 128.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2024 | 31 January 2024 | 128.0 | 250.0 | 0.0 | 0.0 | 3.0 | 253.0 | 253.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2024 | 15 February 2024 | 3.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 625.0 | 0.0 | 0.0 | 6.0 | 631.0 | 631.0 | 0.0 | 125.0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 04 January 2024 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 16 January 2024 | Repayment | 128.0 | 125.0 | 0.0 | 0.0 | 3.0 | 250.0 | + | 20 January 2024 | Chargeback | 128.0 | 125.0 | 0.0 | 0.0 | 3.0 | 375.0 | + | 31 January 2024 | Repayment | 253.0 | 250.0 | 0.0 | 0.0 | 3.0 | 125.0 | + | 15 February 2024 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 15 February 2024 | Accrual | 3.0 | 0.0 | 0.0 | 0.0 | 3.0 | 0.0 | + + @TestRailId:C3083 @creditAllocation @AdvancedPaymentAllocationChargeback @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation - credit allocation UC3: partial, prior chargeback with penalty (2) + When Admin sets the business date to "01 January 2024" + 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROG_SCHEDULE_HOR_INST_LVL_DELINQUENCY_CREDIT_ALLOCATION | 01 January 2024 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "500" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "500" EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "01 January 2024" due date and 3 EUR transaction amount + When Admin sets the business date to "04 January 2024" + And Customer makes "AUTOPAY" repayment on "04 January 2024" with 125 EUR transaction amount + When Admin sets the business date to "16 January 2024" + And Customer makes "AUTOPAY" repayment on "16 January 2024" with 128 EUR transaction amount + When Admin sets the business date to "20 January 2024" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 53 EUR transaction amount + When Admin sets the business date to "31 January 2024" + And Customer makes "AUTOPAY" repayment on "31 January 2024" with 175 EUR transaction amount + When Admin sets the business date to "15 February 2024" + And Customer makes "AUTOPAY" repayment on "15 February 2024" with 128 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 04 January 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 125.0 | 0.0 | + | 2 | 15 | 16 January 2024 | 16 January 2024 | 250.0 | 125.0 | 0.0 | 0.0 | 3.0 | 128.0 | 128.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2024 | 15 February 2024 | 128.0 | 175.0 | 0.0 | 0.0 | 3.0 | 178.0 | 178.0 | 0.0 | 3.0 | 0.0 | + | 4 | 15 | 15 February 2024 | 15 February 2024 | 3.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 550.0 | 0.0 | 0.0 | 6.0 | 556.0 | 556.0 | 0.0 | 128.0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 04 January 2024 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 16 January 2024 | Repayment | 128.0 | 125.0 | 0.0 | 0.0 | 3.0 | 250.0 | + | 20 January 2024 | Chargeback | 53.0 | 50.0 | 0.0 | 0.0 | 3.0 | 300.0 | + | 31 January 2024 | Repayment | 175.0 | 172.0 | 0.0 | 0.0 | 3.0 | 128.0 | + | 15 February 2024 | Repayment | 128.0 | 128.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 15 February 2024 | Accrual | 3.0 | 0.0 | 0.0 | 0.0 | 3.0 | 0.0 | + + @TestRailId:C3084 @creditAllocation @AdvancedPaymentAllocationChargeback @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation - credit allocation UC4: partial, prior chargeback with penalty and fee + When Admin sets the business date to "01 January 2024" + 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROG_SCHEDULE_HOR_INST_LVL_DELINQUENCY_CREDIT_ALLOCATION | 01 January 2024 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "500" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "500" EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "01 January 2024" due date and 3 EUR transaction amount + When Admin sets the business date to "02 January 2024" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "01 January 2024" due date and 4 EUR transaction amount + When Admin sets the business date to "04 January 2024" + And Customer makes "AUTOPAY" repayment on "04 January 2024" with 125 EUR transaction amount + When Admin sets the business date to "16 January 2024" + And Customer makes "AUTOPAY" repayment on "16 January 2024" with 125 EUR transaction amount + When Admin sets the business date to "20 January 2024" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 50 EUR transaction amount + When Admin sets the business date to "31 January 2024" + And Customer makes "AUTOPAY" repayment on "31 January 2024" with 125 EUR transaction amount + When Admin sets the business date to "15 February 2024" + And Customer makes "AUTOPAY" repayment on "15 February 2024" with 182 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 04 January 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 125.0 | 0.0 | + | 2 | 15 | 16 January 2024 | 31 January 2024 | 250.0 | 125.0 | 0.0 | 4.0 | 3.0 | 132.0 | 132.0 | 0.0 | 7.0 | 0.0 | + | 3 | 15 | 31 January 2024 | 15 February 2024 | 132.0 | 168.0 | 0.0 | 4.0 | 3.0 | 175.0 | 175.0 | 0.0 | 57.0 | 0.0 | + | 4 | 15 | 15 February 2024 | 15 February 2024 | 7.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 543.0 | 0.0 | 8.0 | 6.0 | 557.0 | 557.0 | 0.0 | 189.0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 04 January 2024 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 16 January 2024 | Repayment | 125.0 | 118.0 | 0.0 | 4.0 | 3.0 | 257.0 | + | 20 January 2024 | Chargeback | 50.0 | 43.0 | 0.0 | 4.0 | 3.0 | 300.0 | + | 31 January 2024 | Repayment | 125.0 | 118.0 | 0.0 | 4.0 | 3.0 | 182.0 | + | 15 February 2024 | Repayment | 182.0 | 182.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 15 February 2024 | Accrual | 7.0 | 0.0 | 0.0 | 4.0 | 3.0 | 0.0 | + + @TestRailId:C3085 @creditAllocation @AdvancedPaymentAllocationChargeback @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation - credit allocation UC5: full, prior chargeback + When Admin sets the business date to "01 January 2024" + 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROG_SCHEDULE_HOR_INST_LVL_DELINQUENCY_CREDIT_ALLOCATION | 01 January 2024 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "500" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "500" EUR transaction amount + When Admin sets the business date to "04 January 2024" + And Customer makes "AUTOPAY" repayment on "04 January 2024" with 125 EUR transaction amount + When Admin sets the business date to "16 January 2024" + And Customer makes "AUTOPAY" repayment on "16 January 2024" with 125 EUR transaction amount + When Admin sets the business date to "20 January 2024" + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 125 EUR transaction amount for Payment nr. 1 + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 125 EUR transaction amount for Payment nr. 2 + When Admin sets the business date to "31 January 2024" + And Customer makes "AUTOPAY" repayment on "31 January 2024" with 375 EUR transaction amount + When Admin sets the business date to "15 February 2024" + And Customer makes "AUTOPAY" repayment on "15 February 2024" with 125 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 04 January 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 125.0 | 0.0 | + | 2 | 15 | 16 January 2024 | 16 January 2024 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2024 | 31 January 2024 | 125.0 | 375.0 | 0.0 | 0.0 | 0.0 | 375.0 | 375.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2024 | 15 February 2024 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 750.0 | 0.0 | 0.0 | 0.0 | 750.0 | 750.0 | 0.0 | 125.0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 04 January 2024 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 16 January 2024 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 20 January 2024 | Chargeback | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 20 January 2024 | Chargeback | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 31 January 2024 | Repayment | 375.0 | 375.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 15 February 2024 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 0.0 | + + @TestRailId:C3086 @creditAllocation @AdvancedPaymentAllocationChargeback @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation - credit allocation UC6: full, after chargeback + When Admin sets the business date to "01 January 2024" + 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROG_SCHEDULE_HOR_INST_LVL_DELINQUENCY_CREDIT_ALLOCATION | 01 January 2024 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "500" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "500" EUR transaction amount + When Admin sets the business date to "04 January 2024" + And Customer makes "AUTOPAY" repayment on "04 January 2024" with 125 EUR transaction amount + When Admin sets the business date to "16 January 2024" + And Customer makes "AUTOPAY" repayment on "16 January 2024" with 125 EUR transaction amount + When Admin sets the business date to "31 January 2024" + And Customer makes "AUTOPAY" repayment on "31 January 2024" with 125 EUR transaction amount + When Admin sets the business date to "15 February 2024" + And Customer makes "AUTOPAY" repayment on "15 February 2024" with 125 EUR transaction amount + When Admin sets the business date to "20 February 2024" + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 125 EUR transaction amount for Payment nr. 1 + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 125 EUR transaction amount for Payment nr. 2 + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 125 EUR transaction amount for Payment nr. 3 + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 125 EUR transaction amount for Payment nr. 4 + When Admin sets the business date to "28 February 2024" + And Customer makes "AUTOPAY" repayment on "28 February 2024" with 500 EUR transaction amount + Then Loan Repayment schedule has 5 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 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 04 January 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 125.0 | 0.0 | + | 2 | 15 | 16 January 2024 | 16 January 2024 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2024 | 31 January 2024 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2024 | 15 February 2024 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 5 | 5 | 20 February 2024 | 28 February 2024 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 500.0 | 0.0 | 500.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 1000.0 | 0.0 | 625.0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 04 January 2024 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 16 January 2024 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 31 January 2024 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 15 February 2024 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 20 February 2024 | Chargeback | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 20 February 2024 | Chargeback | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 20 February 2024 | Chargeback | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 20 February 2024 | Chargeback | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 28 February 2024 | Repayment | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | + + @TestRailId:C3087 @creditAllocation @AdvancedPaymentAllocationChargeback @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation - credit allocation UC7: partial, after chargeback + When Admin sets the business date to "01 January 2024" + 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROG_SCHEDULE_HOR_INST_LVL_DELINQUENCY_CREDIT_ALLOCATION | 01 January 2024 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "500" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "500" EUR transaction amount + When Admin sets the business date to "04 January 2024" + And Customer makes "AUTOPAY" repayment on "04 January 2024" with 125 EUR transaction amount + When Admin sets the business date to "16 January 2024" + And Customer makes "AUTOPAY" repayment on "16 January 2024" with 125 EUR transaction amount + When Admin sets the business date to "31 January 2024" + And Customer makes "AUTOPAY" repayment on "31 January 2024" with 125 EUR transaction amount + When Admin sets the business date to "15 February 2024" + And Customer makes "AUTOPAY" repayment on "15 February 2024" with 125 EUR transaction amount + When Admin sets the business date to "20 February 2024" + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 125 EUR transaction amount for Payment nr. 2 + When Admin sets the business date to "28 February 2024" + And Customer makes "AUTOPAY" repayment on "28 February 2024" with 125 EUR transaction amount + Then Loan Repayment schedule has 5 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 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 04 January 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 125.0 | 0.0 | + | 2 | 15 | 16 January 2024 | 16 January 2024 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2024 | 31 January 2024 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2024 | 15 February 2024 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 5 | 5 | 20 February 2024 | 28 February 2024 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 125.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 625.0 | 0.0 | 0.0 | 0.0 | 625.0 | 625.0 | 0.0 | 250.0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 04 January 2024 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 16 January 2024 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 31 January 2024 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 15 February 2024 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 20 February 2024 | Chargeback | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 28 February 2024 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 0.0 | + + @TestRailId:C3088 @creditAllocation @AdvancedPaymentAllocationChargeback @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation - credit allocation UC8: multiple, prior chargebacks on same payment + When Admin sets the business date to "01 January 2024" + 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROG_SCHEDULE_HOR_INST_LVL_DELINQUENCY_CREDIT_ALLOCATION | 01 January 2024 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "500" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "500" EUR transaction amount + When Admin sets the business date to "04 January 2024" + And Customer makes "AUTOPAY" repayment on "04 January 2024" with 125 EUR transaction amount + When Admin sets the business date to "16 January 2024" + And Customer makes "AUTOPAY" repayment on "16 January 2024" with 125 EUR transaction amount + When Admin sets the business date to "20 January 2024" + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 75 EUR transaction amount for Payment nr. 1 + When Admin sets the business date to "25 January 2024" + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 50 EUR transaction amount for Payment nr. 1 + When Admin sets the business date to "31 January 2024" + And Customer makes "AUTOPAY" repayment on "31 January 2024" with 250 EUR transaction amount + When Admin sets the business date to "15 February 2024" + And Customer makes "AUTOPAY" repayment on "15 February 2024" with 125 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 04 January 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 125.0 | 0.0 | + | 2 | 15 | 16 January 2024 | 16 January 2024 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2024 | 31 January 2024 | 125.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2024 | 15 February 2024 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 625.0 | 0.0 | 0.0 | 0.0 | 625.0 | 625.0 | 0.0 | 125.0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 04 January 2024 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 16 January 2024 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 20 January 2024 | Chargeback | 75.0 | 75.0 | 0.0 | 0.0 | 0.0 | 325.0 | + | 25 January 2024 | Chargeback | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 31 January 2024 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 15 February 2024 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 0.0 | + + @TestRailId:C3094 @creditAllocation @AdvancedPaymentAllocationChargeback @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation - credit allocation accounting entries UC1: chargeback on principal + When Admin sets the business date to "01 January 2024" + 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROG_SCHEDULE_HOR_INST_LVL_DELINQUENCY_CREDIT_ALLOCATION | 01 January 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "1000" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "1000" EUR transaction amount + And Customer makes "AUTOPAY" repayment on "01 January 2024" with 250 EUR transaction amount + When Admin sets the business date to "01 February 2024" + And Customer makes "AUTOPAY" repayment on "01 February 2024" with 250 EUR transaction amount + When Admin sets the business date to "01 March 2024" + And Customer makes "AUTOPAY" repayment on "01 March 2024" with 250 EUR transaction amount + When Admin sets the business date to "01 April 2024" + And Customer makes "AUTOPAY" repayment on "01 April 2024" with 250 EUR transaction amount + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 250 EUR transaction amount for Payment nr. 3 + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 March 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 April 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "01 April 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | + | ASSET | 112601 | Loans Receivable | 250.0 | | + + @TestRailId:C3095 @creditAllocation @AdvancedPaymentAllocationChargeback @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation - credit allocation accounting entries UC2: chargeback on principal and fees + When Admin sets the business date to "01 January 2024" + 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROG_SCHEDULE_HOR_INST_LVL_DELINQUENCY_CREDIT_ALLOCATION | 01 January 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "1000" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "1000" EUR transaction amount + And Customer makes "AUTOPAY" repayment on "01 January 2024" with 250 EUR transaction amount + When Admin sets the business date to "01 February 2024" + And Customer makes "AUTOPAY" repayment on "01 February 2024" with 250 EUR transaction amount + When Admin sets the business date to "01 March 2024" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "01 March 2024" due date and 30 EUR transaction amount + And Customer makes "AUTOPAY" repayment on "01 March 2024" with 280 EUR transaction amount + When Admin sets the business date to "01 April 2024" + And Customer makes "AUTOPAY" repayment on "01 April 2024" with 250 EUR transaction amount + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 280 EUR transaction amount for Payment nr. 3 + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 March 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 30.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 280.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 April 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "ACCRUAL" transaction with date "01 April 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112603 | Interest/Fee Receivable | 30.0 | | + | INCOME | 404007 | Fee Income | | 30.0 | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "01 April 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | LIABILITY | 145023 | Suspense/Clearing account | | 280.0 | + | ASSET | 112601 | Loans Receivable | 250.0 | | + | ASSET | 112603 | Interest/Fee Receivable | 30.0 | | + + @TestRailId:C3096 @creditAllocation @AdvancedPaymentAllocationChargeback @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation - credit allocation accounting entries UC3: chargeback on principal and penalties + When Admin sets the business date to "01 January 2024" + 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROG_SCHEDULE_HOR_INST_LVL_DELINQUENCY_CREDIT_ALLOCATION | 01 January 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "1000" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "1000" EUR transaction amount + And Customer makes "AUTOPAY" repayment on "01 January 2024" with 250 EUR transaction amount + When Admin sets the business date to "01 February 2024" + And Customer makes "AUTOPAY" repayment on "01 February 2024" with 250 EUR transaction amount + When Admin sets the business date to "01 March 2024" + When Admin adds "LOAN_NSF_FEE" due date charge with "01 March 2024" due date and 30 EUR transaction amount + And Customer makes "AUTOPAY" repayment on "01 March 2024" with 280 EUR transaction amount + When Admin sets the business date to "01 April 2024" + And Customer makes "AUTOPAY" repayment on "01 April 2024" with 250 EUR transaction amount + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 280 EUR transaction amount for Payment nr. 3 + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 March 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 30.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 280.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 April 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "ACCRUAL" transaction with date "01 April 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112603 | Interest/Fee Receivable | 30.0 | | + | INCOME | 404007 | Fee Income | | 30.0 | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "01 April 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | LIABILITY | 145023 | Suspense/Clearing account | | 280.0 | + | ASSET | 112601 | Loans Receivable | 250.0 | | + | ASSET | 112603 | Interest/Fee Receivable | 30.0 | | + + @TestRailId:C3097 @creditAllocation @AdvancedPaymentAllocationChargeback @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation - credit allocation accounting entries UC4: when overpayment amount is smaller than chargeback + When Admin sets the business date to "01 January 2024" + 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROG_SCHEDULE_HOR_INST_LVL_DELINQUENCY_CREDIT_ALLOCATION | 01 January 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "1000" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "1000" EUR transaction amount + And Customer makes "AUTOPAY" repayment on "01 January 2024" with 250 EUR transaction amount + When Admin sets the business date to "01 February 2024" + And Customer makes "AUTOPAY" repayment on "01 February 2024" with 250 EUR transaction amount + When Admin sets the business date to "01 March 2024" + And Customer makes "AUTOPAY" repayment on "01 March 2024" with 250 EUR transaction amount + When Admin sets the business date to "01 April 2024" + And Customer makes "AUTOPAY" repayment on "01 April 2024" with 400 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 150 overpaid amount + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 250 EUR transaction amount for Payment nr. 3 + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 March 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 April 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | l1 | Overpayment account | | 150.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 400.0 | | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "01 April 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | + | LIABILITY | l1 | Overpayment account | 150.0 | | + | ASSET | 112601 | Loans Receivable | 100.0 | | + + @TestRailId:C3098 @creditAllocation @AdvancedPaymentAllocationChargeback @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation - credit allocation accounting entries UC5: with fees- when overpayment amount is bigger than chargeback + When Admin sets the business date to "01 January 2024" + 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROG_SCHEDULE_HOR_INST_LVL_DELINQUENCY_CREDIT_ALLOCATION | 01 January 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "1000" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "1000" EUR transaction amount + And Customer makes "AUTOPAY" repayment on "01 January 2024" with 250 EUR transaction amount + When Admin sets the business date to "01 February 2024" + And Customer makes "AUTOPAY" repayment on "01 February 2024" with 250 EUR transaction amount + When Admin sets the business date to "01 March 2024" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "01 March 2024" due date and 30 EUR transaction amount + And Customer makes "AUTOPAY" repayment on "01 March 2024" with 250 EUR transaction amount + When Admin sets the business date to "01 April 2024" + And Customer makes "AUTOPAY" repayment on "01 April 2024" with 400 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 120 overpaid amount + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 100 EUR transaction amount for Payment nr. 3 + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 March 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 220.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 30.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 April 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 280.0 | + | LIABILITY | l1 | Overpayment account | | 120.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 400.0 | | + Then Loan Transactions tab has a "ACCRUAL" transaction with date "01 April 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112603 | Interest/Fee Receivable | 30.0 | | + | INCOME | 404007 | Fee Income | | 30.0 | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "01 April 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | LIABILITY | 145023 | Suspense/Clearing account | | 100.0 | + | LIABILITY | l1 | Overpayment account | 100.0 | | + + @TestRailId:C3099 @creditAllocation @AdvancedPaymentAllocationChargeback @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation - credit allocation accounting entries UC6: when overpayment amount is bigger than chargeback + When Admin sets the business date to "01 January 2024" + 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROG_SCHEDULE_HOR_INST_LVL_DELINQUENCY_CREDIT_ALLOCATION | 01 January 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "1000" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "1000" EUR transaction amount + And Customer makes "AUTOPAY" repayment on "01 January 2024" with 250 EUR transaction amount + When Admin sets the business date to "01 February 2024" + And Customer makes "AUTOPAY" repayment on "01 February 2024" with 250 EUR transaction amount + When Admin sets the business date to "01 March 2024" + And Customer makes "AUTOPAY" repayment on "01 March 2024" with 250 EUR transaction amount + When Admin sets the business date to "01 April 2024" + And Customer makes "AUTOPAY" repayment on "01 April 2024" with 400 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 150 overpaid amount + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 100 EUR transaction amount for Payment nr. 3 + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 March 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 April 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | l1 | Overpayment account | | 150.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 400.0 | | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "01 April 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | LIABILITY | 145023 | Suspense/Clearing account | | 100.0 | + | LIABILITY | l1 | Overpayment account | 100.0 | | + + @TestRailId:C3100 @creditAllocation @AdvancedPaymentAllocationChargeback @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation - credit allocation accounting entries UC7: chargeback on charge-off loan account with principal + When Admin sets the business date to "01 January 2024" + 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROG_SCHEDULE_HOR_INST_LVL_DELINQUENCY_CREDIT_ALLOCATION | 01 January 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "1000" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "1000" EUR transaction amount + And Customer makes "AUTOPAY" repayment on "01 January 2024" with 250 EUR transaction amount + When Admin sets the business date to "01 February 2024" + And Customer makes "AUTOPAY" repayment on "01 February 2024" with 250 EUR transaction amount + When Admin sets the business date to "01 March 2024" + And Customer makes "AUTOPAY" repayment on "01 March 2024" with 250 EUR transaction amount + When Admin sets the business date to "15 March 2024" + And Admin does charge-off the loan on "15 March 2024" + When Admin sets the business date to "01 April 2024" + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 250 EUR transaction amount for Payment nr. 3 + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 March 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "15 March 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 250.0 | | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "01 April 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | LIABILITY | 145023 | Suspense/Clearing account | | 250.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 250.0 | | + + @TestRailId:C3101 @creditAllocation @AdvancedPaymentAllocationChargeback @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation - credit allocation accounting entries UC8: chargeback on charge-off loan account with principal and Fees + When Admin sets the business date to "01 January 2024" + 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROG_SCHEDULE_HOR_INST_LVL_DELINQUENCY_CREDIT_ALLOCATION | 01 January 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "1000" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "1000" EUR transaction amount + And Customer makes "AUTOPAY" repayment on "01 January 2024" with 250 EUR transaction amount + When Admin sets the business date to "01 February 2024" + And Customer makes "AUTOPAY" repayment on "01 February 2024" with 250 EUR transaction amount + When Admin sets the business date to "01 March 2024" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "01 March 2024" due date and 30 EUR transaction amount + And Customer makes "AUTOPAY" repayment on "01 March 2024" with 280 EUR transaction amount + When Admin sets the business date to "15 March 2024" + And Admin does charge-off the loan on "15 March 2024" + When Admin sets the business date to "01 April 2024" + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 280 EUR transaction amount for Payment nr. 3 + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 March 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 30.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 280.0 | | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "15 March 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 250.0 | | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "01 April 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | LIABILITY | 145023 | Suspense/Clearing account | | 280.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 250.0 | | + | INCOME | 404008 | Fee Charge Off | 30.0 | | + + @TestRailId:C3102 @creditAllocation @AdvancedPaymentAllocationChargeback @AdvancedPaymentAllocation + Scenario: Verify chargeback function for advanced payment allocation - credit allocation accounting entries UC9: chargeback on charge-off loan account with principal and Penalties + When Admin sets the business date to "01 January 2024" + 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROG_SCHEDULE_HOR_INST_LVL_DELINQUENCY_CREDIT_ALLOCATION | 01 January 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "1000" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "1000" EUR transaction amount + And Customer makes "AUTOPAY" repayment on "01 January 2024" with 250 EUR transaction amount + When Admin sets the business date to "01 February 2024" + And Customer makes "AUTOPAY" repayment on "01 February 2024" with 250 EUR transaction amount + When Admin sets the business date to "01 March 2024" + When Admin adds "LOAN_NSF_FEE" due date charge with "01 March 2024" due date and 30 EUR transaction amount + And Customer makes "AUTOPAY" repayment on "01 March 2024" with 280 EUR transaction amount + When Admin sets the business date to "15 March 2024" + And Admin does charge-off the loan on "15 March 2024" + When Admin sets the business date to "01 April 2024" + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 280 EUR transaction amount for Payment nr. 3 + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 January 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 250.0 | | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 March 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 30.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 280.0 | | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "15 March 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 250.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 250.0 | | + Then Loan Transactions tab has a "CHARGEBACK" transaction with date "01 April 2024" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | LIABILITY | 145023 | Suspense/Clearing account | | 280.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 250.0 | | + | INCOME | 404008 | Fee Charge Off | 30.0 | | diff --git a/fineract-e2e-tests-runner/src/test/resources/features/LoanDelinquency.feature b/fineract-e2e-tests-runner/src/test/resources/features/LoanDelinquency.feature new file mode 100644 index 00000000000..77893dbaea4 --- /dev/null +++ b/fineract-e2e-tests-runner/src/test/resources/features/LoanDelinquency.feature @@ -0,0 +1,1260 @@ +@LoanDelinquencyFeature +Feature: LoanDelinquency + + @TestRailId:C2963 + Scenario: Verify Loan delinquency pause API - PAUSE and RESUME by loanId + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "16 October 2023" + When Admin initiate a DELINQUENCY PAUSE with startDate: "16 October 2023" and endDate: "30 October 2023" + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 16 October 2023 | 30 October 2023 | + When Admin sets the business date to "20 October 2023" + When Admin initiate a DELINQUENCY RESUME with startDate: "20 October 2023" + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 16 October 2023 | 30 October 2023 | + | RESUME | 20 October 2023 | | + + @TestRailId:C2964 + Scenario: Verify Loan delinquency pause API - PAUSE and RESUME by loanExternalId + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "16 October 2023" + When Admin initiate a DELINQUENCY PAUSE by loanExternalId with startDate: "16 October 2023" and endDate: "30 October 2023" + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 16 October 2023 | 30 October 2023 | + When Admin sets the business date to "20 October 2023" + When Admin initiate a DELINQUENCY RESUME by loanExternalId with startDate: "20 October 2023" + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 16 October 2023 | 30 October 2023 | + | RESUME | 20 October 2023 | | + + @TestRailId:C2965 + Scenario: Verify Loan delinquency pause API - PAUSE and RESUME actions supported only + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "16 October 2023" + Then Initiating a delinquency-action other than PAUSE or RESUME in action field results an error - startDate: "16 October 2023", endDate: "30 October 2023" + When Admin initiate a DELINQUENCY PAUSE with startDate: "16 October 2023" and endDate: "30 October 2023" + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 16 October 2023 | 30 October 2023 | + When Admin sets the business date to "20 October 2023" + When Admin initiate a DELINQUENCY RESUME by loanExternalId with startDate: "20 October 2023" + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 16 October 2023 | 30 October 2023 | + | RESUME | 20 October 2023 | | + + @TestRailId:C2966 + Scenario: Verify Loan delinquency pause API - PAUSE with start date on actual business date + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "16 October 2023" + When Admin initiate a DELINQUENCY PAUSE with startDate: "16 October 2023" and endDate: "30 October 2023" + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 16 October 2023 | 30 October 2023 | + + @TestRailId:C2967 + Scenario: Verify Loan delinquency pause API - PAUSE with start date later than actual business date + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "16 October 2023" + When Admin initiate a DELINQUENCY PAUSE with startDate: "25 October 2023" and endDate: "30 October 2023" + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 25 October 2023 | 30 October 2023 | + + @TestRailId:C2968 + Scenario: Verify Loan delinquency pause API - PAUSE with start date before than actual business date is possible + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "16 October 2023" + When Admin initiate a DELINQUENCY PAUSE with startDate: "14 October 2023" and endDate: "30 October 2023" + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 14 October 2023 | 30 October 2023 | + + @TestRailId:C2969 + Scenario: Verify Loan delinquency pause API - PAUSE action on non-active loan result an error + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | +# pending approval + Then Loan status will be "SUBMITTED_AND_PENDING_APPROVAL" + Then Initiating a DELINQUENCY PAUSE on a non-active loan results an error - startDate: "16 October 2023", endDate: "30 October 2023" +# approved + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + Then Loan status will be "APPROVED" + Then Initiating a DELINQUENCY PAUSE on a non-active loan results an error - startDate: "16 October 2023", endDate: "30 October 2023" +# overpaid + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + And Customer makes "AUTOPAY" repayment on "01 October 2023" with 1000 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Initiating a DELINQUENCY PAUSE on a non-active loan results an error - startDate: "16 October 2023", endDate: "30 October 2023" +# closed + And Admin makes Credit Balance Refund transaction on "01 October 2023" with 250 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + When Admin sets the business date to "16 October 2023" + Then Initiating a DELINQUENCY PAUSE on a non-active loan results an error - startDate: "16 October 2023", endDate: "30 October 2023" + + @TestRailId:C2970 + Scenario: Verify Loan delinquency pause API - RESUME action on non-active loan result an error + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin initiate a DELINQUENCY PAUSE with startDate: "16 October 2023" and endDate: "30 October 2023" + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 16 October 2023 | 30 October 2023 | +# overpaid + When Admin sets the business date to "16 October 2023" + And Customer makes "AUTOPAY" repayment on "16 October 2023" with 1000 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Initiating a DELINQUENCY RESUME on a non-active loan results an error - startDate: "16 October 2023" +# closed + And Admin makes Credit Balance Refund transaction on "16 October 2023" with 250 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Initiating a DELINQUENCY RESUME on a non-active loan results an error - startDate: "16 October 2023" + + @TestRailId:C2971 + Scenario: Verify Loan delinquency pause API - Overlapping PAUSE periods result an error + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "16 October 2023" + When Admin initiate a DELINQUENCY PAUSE with startDate: "16 October 2023" and endDate: "30 October 2023" + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 16 October 2023 | 30 October 2023 | + When Admin sets the business date to "20 October 2023" + Then Overlapping PAUSE periods result an error - startDate: "20 October 2023", endDate: "30 October 2023" + + @TestRailId:C2972 + Scenario: Verify Loan delinquency pause API - RESUME without an active PAUSE period results an error + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + Then Initiating a DELINQUENCY RESUME without an active PAUSE period results an error - startDate: "01 October 2023" + + @TestRailId:C2973 + Scenario: Verify Loan delinquency pause API - RESUME with start date before than actual business date results an error + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "16 October 2023" + When Admin initiate a DELINQUENCY PAUSE with startDate: "16 October 2023" and endDate: "30 October 2023" + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 16 October 2023 | 30 October 2023 | + When Admin sets the business date to "20 October 2023" + Then Initiating a DELINQUENCY RESUME with start date other than actual business date results an error - startDate: "01 October 2023" + + @TestRailId:C2974 + Scenario: Verify Loan delinquency pause API - RESUME with start date later than actual business date results an error + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "16 October 2023" + When Admin initiate a DELINQUENCY PAUSE with startDate: "16 October 2023" and endDate: "30 October 2023" + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 16 October 2023 | 30 October 2023 | + When Admin sets the business date to "20 October 2023" + Then Initiating a DELINQUENCY RESUME with start date other than actual business date results an error - startDate: "21 October 2023" + + @TestRailId:C2975 + Scenario: Verify Loan delinquency pause API - RESUME with end date results an error + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "16 October 2023" + When Admin initiate a DELINQUENCY PAUSE with startDate: "16 October 2023" and endDate: "30 October 2023" + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 16 October 2023 | 30 October 2023 | + When Admin sets the business date to "20 October 2023" + Then Initiating a DELINQUENCY RESUME with an endDate results an error - startDate: "20 October 2023", endDate: "30 October 2023" + + @Skip @TestRailId:C2992 + Scenario: Verify Loan level loan delinquency - loan goes into delinquency pause then will be resumed + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_INSTALLMENT_LEVEL_DELINQUENCY | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "05 October 2023" + When Admin runs inline COB job for Loan + Then Admin checks that delinquency range is: "RANGE_1" and has delinquentDate "2023-10-04" + When Admin sets the business date to "17 November 2023" + When Admin initiate a DELINQUENCY PAUSE with startDate: "17 November 2023" and endDate: "30 December 2023" + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 17 November 2023 | 30 December 2023 | + When Admin runs inline COB job for Loan + Then Admin checks that delinquency range is: "RANGE_30" and has delinquentDate "2023-10-04" + When Admin sets the business date to "01 December 2023" + When Admin initiate a DELINQUENCY RESUME with startDate: "01 December 2023" + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 17 November 2023 | 30 December 2023 | + | RESUME | 01 December 2023 | | + When Admin runs inline COB job for Loan + Then Admin checks that delinquency range is: "RANGE_30" and has delinquentDate "2023-10-04" + + @TestRailId:C2979 + Scenario: Verify Installment level loan delinquency - loan goes into delinquency bucket + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_INSTALLMENT_LEVEL_DELINQUENCY | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "16 December 2023" + When Admin runs inline COB job for Loan + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 3 | RANGE_30 | 500.00 | + | 4 | RANGE_60 | 500.00 | + Then Installment level delinquency event has correct data + + @TestRailId:C2980 + Scenario: Verify Installment level loan delinquency - loan goes from one delinquency bucket to an other + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_INSTALLMENT_LEVEL_DELINQUENCY | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "16 November 2023" + When Admin runs inline COB job for Loan + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 1 | RANGE_1 | 250.00 | + | 2 | RANGE_3 | 250.00 | + | 3 | RANGE_30 | 500.00 | + Then Installment level delinquency event has correct data + When Admin sets the business date to "16 December 2023" + When Admin runs inline COB job for Loan + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 3 | RANGE_30 | 500.00 | + | 4 | RANGE_60 | 500.00 | + Then Installment level delinquency event has correct data + + @TestRailId:C2981 + Scenario: Verify Installment level loan delinquency - loan goes out from delinquency by late repayment + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_INSTALLMENT_LEVEL_DELINQUENCY | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "16 December 2023" + When Admin runs inline COB job for Loan + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 3 | RANGE_30 | 500.00 | + | 4 | RANGE_60 | 500.00 | + Then Installment level delinquency event has correct data + When Admin sets the business date to "17 December 2023" + And Customer makes "AUTOPAY" repayment on "17 December 2023" with 1000 EUR transaction amount + Then Installment level delinquency event has correct data + Then INSTALLMENT level delinquency is null + + @TestRailId:C2982 + Scenario: Verify Installment level loan delinquency - some of the installments go out from delinquency by late repayment + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_INSTALLMENT_LEVEL_DELINQUENCY | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "25 October 2023" + When Admin runs inline COB job for Loan + Then Installment level delinquency event has correct data + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 2 | RANGE_3 | 500.00 | + When Admin sets the business date to "26 October 2023" + And Customer makes "AUTOPAY" repayment on "26 October 2023" with 250 EUR transaction amount + Then Installment level delinquency event has correct data + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 2 | RANGE_3 | 250.00 | + + @TestRailId:C2983 + Scenario: Verify Installment level loan delinquency - loan goes out from delinquency by Goodwill credit transaction + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_INSTALLMENT_LEVEL_DELINQUENCY | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "16 December 2023" + When Admin runs inline COB job for Loan + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 3 | RANGE_30 | 500.00 | + | 4 | RANGE_60 | 500.00 | + Then Installment level delinquency event has correct data + When Admin sets the business date to "17 December 2023" + When Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "17 December 2023" with 1000 EUR transaction amount and system-generated Idempotency key + Then Installment level delinquency event has correct data + Then INSTALLMENT level delinquency is null + + @TestRailId:C2984 + Scenario: Verify Installment level loan delinquency - some of the installments go out from delinquency by Goodwill credit transaction + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_INSTALLMENT_LEVEL_DELINQUENCY | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "25 October 2023" + When Admin runs inline COB job for Loan + Then Installment level delinquency event has correct data + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 2 | RANGE_3 | 500.00 | + When Admin sets the business date to "26 October 2023" + When Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "26 October 2023" with 250 EUR transaction amount and system-generated Idempotency key + Then Installment level delinquency event has correct data + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 2 | RANGE_3 | 250.00 | + + @TestRailId:C2985 + Scenario: Verify Installment level loan delinquency - loan with charges goes into delinquency bucket + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_INSTALLMENT_LEVEL_DELINQUENCY | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "05 October 2023" due date and 20 EUR transaction amount + When Admin sets the business date to "20 October 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "20 October 2023" due date and 20 EUR transaction amount + When Admin sets the business date to "16 December 2023" + When Admin runs inline COB job for Loan + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 3 | RANGE_30 | 520.00 | + | 4 | RANGE_60 | 520.00 | + Then Installment level delinquency event has correct data + + @TestRailId:C2987 + Scenario: Verify Installment level loan delinquency - loan goes into delinquency pause + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_INSTALLMENT_LEVEL_DELINQUENCY | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "16 November 2023" + When Admin runs inline COB job for Loan + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 1 | RANGE_1 | 250.00 | + | 2 | RANGE_3 | 250.00 | + | 3 | RANGE_30 | 500.00 | + Then Installment level delinquency event has correct data + When Admin sets the business date to "17 November 2023" + When Admin initiate a DELINQUENCY PAUSE with startDate: "17 November 2023" and endDate: "30 November 2023" + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 17 November 2023 | 30 November 2023 | + When Admin runs inline COB job for Loan + Then Installment level delinquency event has correct data + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 1 | RANGE_1 | 250.00 | + | 2 | RANGE_3 | 250.00 | + | 3 | RANGE_30 | 500.00 | + When Admin sets the business date to "30 November 2023" + When Admin runs inline COB job for Loan + Then Installment level delinquency event has correct data + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 1 | RANGE_1 | 250.00 | + | 2 | RANGE_3 | 250.00 | + | 3 | RANGE_30 | 500.00 | + When Admin sets the business date to "01 January 2024" + When Admin runs inline COB job for Loan + Then Installment level delinquency event has correct data + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 3 | RANGE_30 | 500.00 | + | 4 | RANGE_60 | 500.00 | + + @TestRailId:C2988 + Scenario: Verify Installment level loan delinquency - loan goes into delinquency pause then will be resumed + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_INSTALLMENT_LEVEL_DELINQUENCY | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "16 November 2023" + When Admin runs inline COB job for Loan + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 1 | RANGE_1 | 250.00 | + | 2 | RANGE_3 | 250.00 | + | 3 | RANGE_30 | 500.00 | + Then Installment level delinquency event has correct data + When Admin sets the business date to "17 November 2023" + When Admin initiate a DELINQUENCY PAUSE with startDate: "17 November 2023" and endDate: "30 December 2023" + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 17 November 2023 | 30 December 2023 | + When Admin runs inline COB job for Loan + Then Installment level delinquency event has correct data + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 1 | RANGE_1 | 250.00 | + | 2 | RANGE_3 | 250.00 | + | 3 | RANGE_30 | 500.00 | + When Admin sets the business date to "01 December 2023" + When Admin initiate a DELINQUENCY RESUME with startDate: "01 December 2023" + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 17 November 2023 | 30 December 2023 | + | RESUME | 01 December 2023 | | + When Admin runs inline COB job for Loan + Then Installment level delinquency event has correct data + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 1 | RANGE_1 | 250.00 | + | 2 | RANGE_3 | 250.00 | + | 3 | RANGE_30 | 500.00 | + + @TestRailId:C2990 + Scenario: Verify that a non-super user with CREATE_DELINQUENCY_ACTION permission can initiate a DELINQUENCY PAUSE + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "16 October 2023" + When Admin creates new user with "CREATE_DELINQUENCY_ACTION_USER" username, "CREATE_DELINQUENCY_ACTION_ROLE" role name and given permissions: + | CREATE_DELINQUENCY_ACTION | + | REPAYMENT_LOAN | + When Created user with CREATE_DELINQUENCY_ACTION permission initiate a DELINQUENCY PAUSE with startDate: "16 October 2023" and endDate: "30 October 2023" + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 16 October 2023 | 30 October 2023 | + + @TestRailId:C2991 + Scenario: Verify that a non-super user with no CREATE_DELINQUENCY_ACTION permission gets an error when initiate a DELINQUENCY PAUSE + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "16 October 2023" + When Admin creates new user with "NO_CREATE_DELINQUENCY_ACTION_USER" username, "NO_CREATE_DELINQUENCY_ACTION_ROLE" role name and given permissions: + | REPAYMENT_LOAN | + Then Created user with no CREATE_DELINQUENCY_ACTION permission gets an error when initiate a DELINQUENCY PAUSE with startDate: "16 October 2023" and endDate: "30 October 2023" + + @TestRailId:C2999 + Scenario: Verify Loan delinquency pause E2E - full PAUSE period + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_INSTALLMENT_LEVEL_DELINQUENCY | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "02 October 2023" + When Admin runs inline COB job for Loan + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | NO_DELINQUENCY | 250.0 | 04 October 2023 | 0 | 1 | + Then INSTALLMENT level delinquency is null + When Admin sets the business date to "04 October 2023" + When Admin runs inline COB job for Loan + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | NO_DELINQUENCY | 250.0 | 04 October 2023 | 0 | 3 | + Then INSTALLMENT level delinquency is null + When Admin sets the business date to "05 October 2023" + When Admin runs inline COB job for Loan + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | RANGE_1 | 250.0 | 04 October 2023 | 1 | 4 | +# --- Grace period applied only on Loan level, not on installment level --- + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 2 | RANGE_3 | 250.00 | + When Admin sets the business date to "06 October 2023" + When Admin initiate a DELINQUENCY PAUSE with startDate: "06 October 2023" and endDate: "30 October 2023" + Then Loan Delinquency pause periods has the following data: + | active | pausePeriodStart | pausePeriodEnd | + | true | 06 October 2023 | 30 October 2023 | + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 06 October 2023 | 30 October 2023 | + When Admin runs inline COB job for Loan + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | RANGE_1 | 250.0 | 04 October 2023 | 2 | 5 | +# --- Grace period applied only on Loan level, not on installment level --- + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 2 | RANGE_3 | 250.00 | + When Admin sets the business date to "30 October 2023" + When Admin runs inline COB job for Loan + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | RANGE_1 | 500.0 | 04 October 2023 | 2 | 29 | + Then Loan Delinquency pause periods has the following data: + | active | pausePeriodStart | pausePeriodEnd | + | true | 06 October 2023 | 30 October 2023 | +# --- Grace period applied only on Loan level, not on installment level --- + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 2 | RANGE_3 | 250.00 | + When Admin sets the business date to "31 October 2023" + When Admin runs inline COB job for Loan + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | RANGE_1 | 500.0 | 04 October 2023 | 3 | 30 | + Then Loan Delinquency pause periods has the following data: + | active | pausePeriodStart | pausePeriodEnd | + | false | 06 October 2023 | 30 October 2023 | +# --- Grace period applied only on Loan level, not on installment level --- + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 2 | RANGE_3 | 250.00 | + + @TestRailId:C3000 + Scenario: Verify Loan delinquency pause E2E - PAUSE period with RESUME + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_INSTALLMENT_LEVEL_DELINQUENCY | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount +# --- Delinquency pause --- + When Admin sets the business date to "15 October 2023" + When Admin initiate a DELINQUENCY PAUSE with startDate: "15 October 2023" and endDate: "30 October 2023" + When Admin runs inline COB job for Loan + Then Loan Delinquency pause periods has the following data: + | active | pausePeriodStart | pausePeriodEnd | + | true | 15 October 2023 | 30 October 2023 | + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 15 October 2023 | 30 October 2023 | + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | RANGE_3 | 250.0 | 04 October 2023 | 11 | 14 | + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 2 | RANGE_3 | 250.00 | + Then Installment level delinquency event has correct data +# --- Delinquency resume --- + When Admin sets the business date to "25 October 2023" + When Admin initiate a DELINQUENCY RESUME with startDate: "25 October 2023" + When Admin runs inline COB job for Loan + Then Loan Delinquency pause periods has the following data: + | active | pausePeriodStart | pausePeriodEnd | + | true | 15 October 2023 | 25 October 2023 | + When Admin sets the business date to "26 October 2023" + Then Loan Delinquency pause periods has the following data: + | active | pausePeriodStart | pausePeriodEnd | + | false | 15 October 2023 | 25 October 2023 | + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 15 October 2023 | 30 October 2023 | + | RESUME | 25 October 2023 | | + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | RANGE_3 | 500.0 | 04 October 2023 | 12 | 25 | + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 2 | RANGE_3 | 250.00 | + Then Installment level delinquency event has correct data + + @TestRailId:C3001 + Scenario: Verify Loan delinquency pause E2E - PAUSE period with RESUME and second PAUSE + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_INSTALLMENT_LEVEL_DELINQUENCY | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount +# --- Delinquency pause --- + When Admin sets the business date to "15 October 2023" + When Admin initiate a DELINQUENCY PAUSE with startDate: "15 October 2023" and endDate: "30 October 2023" + When Admin runs inline COB job for Loan + Then Loan Delinquency pause periods has the following data: + | active | pausePeriodStart | pausePeriodEnd | + | true | 15 October 2023 | 30 October 2023 | + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 15 October 2023 | 30 October 2023 | + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | RANGE_3 | 250.0 | 04 October 2023 | 11 | 14 | + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 2 | RANGE_3 | 250.00 | + Then Installment level delinquency event has correct data +# --- Delinquency resume --- + When Admin sets the business date to "25 October 2023" + When Admin initiate a DELINQUENCY RESUME with startDate: "25 October 2023" + When Admin runs inline COB job for Loan + Then Loan Delinquency pause periods has the following data: + | active | pausePeriodStart | pausePeriodEnd | + | true | 15 October 2023 | 25 October 2023 | + When Admin sets the business date to "26 October 2023" + Then Loan Delinquency pause periods has the following data: + | active | pausePeriodStart | pausePeriodEnd | + | false | 15 October 2023 | 25 October 2023 | + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 15 October 2023 | 30 October 2023 | + | RESUME | 25 October 2023 | | + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | RANGE_3 | 500.0 | 04 October 2023 | 12 | 25 | + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 2 | RANGE_3 | 250.00 | + Then Installment level delinquency event has correct data +# --- Delinquency runs --- + When Admin sets the business date to "13 November 2023" + When Admin runs inline COB job for Loan + Then Loan Delinquency pause periods has the following data: + | active | pausePeriodStart | pausePeriodEnd | + | false | 15 October 2023 | 25 October 2023 | + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 15 October 2023 | 30 October 2023 | + | RESUME | 25 October 2023 | | + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | RANGE_3 | 750.0 | 04 October 2023 | 30 | 43 | + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 1 | RANGE_1 | 250.00 | + | 2 | RANGE_3 | 250.00 | + | 3 | RANGE_30 | 250.00 | +# --- Second delinquency pause --- + When Admin sets the business date to "14 November 2023" + When Admin initiate a DELINQUENCY PAUSE with startDate: "14 November 2023" and endDate: "30 November 2023" + When Admin runs inline COB job for Loan + Then Loan Delinquency pause periods has the following data: + | active | pausePeriodStart | pausePeriodEnd | + | false | 15 October 2023 | 25 October 2023 | + | true | 14 November 2023 | 30 November 2023 | + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 15 October 2023 | 30 October 2023 | + | RESUME | 25 October 2023 | | + | PAUSE | 14 November 2023 | 30 November 2023 | + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | RANGE_3 | 750.0 | 04 October 2023 | 31 | 44 | + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 1 | RANGE_1 | 250.00 | + | 2 | RANGE_3 | 250.00 | + | 3 | RANGE_30 | 250.00 | + Then Installment level delinquency event has correct data +# --- Second delinquency ends --- + When Admin sets the business date to "30 November 2023" + When Admin runs inline COB job for Loan + Then Loan Delinquency pause periods has the following data: + | active | pausePeriodStart | pausePeriodEnd | + | false | 15 October 2023 | 25 October 2023 | + | true | 14 November 2023 | 30 November 2023 | + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 15 October 2023 | 30 October 2023 | + | RESUME | 25 October 2023 | | + | PAUSE | 14 November 2023 | 30 November 2023 | + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | RANGE_30 | 1000.0 | 04 October 2023 | 31 | 60 | + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 2 | RANGE_3 | 500.00 | + | 3 | RANGE_30 | 250.00 | +# --- Delinquency runs again --- + When Admin sets the business date to "01 December 2023" + When Admin runs inline COB job for Loan + Then Loan Delinquency pause periods has the following data: + | active | pausePeriodStart | pausePeriodEnd | + | false | 15 October 2023 | 25 October 2023 | + | false | 14 November 2023 | 30 November 2023 | + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 15 October 2023 | 30 October 2023 | + | RESUME | 25 October 2023 | | + | PAUSE | 14 November 2023 | 30 November 2023 | + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | RANGE_30 | 1000.0 | 04 October 2023 | 32 | 61 | + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 2 | RANGE_3 | 500.00 | + | 3 | RANGE_30 | 250.00 | + Then Installment level delinquency event has correct data + + @TestRailId:C3002 + Scenario: Verify Loan delinquency pause E2E - full repayment (late/due date) during PAUSE period + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_INSTALLMENT_LEVEL_DELINQUENCY | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount +# --- Delinquency pause --- + When Admin sets the business date to "06 October 2023" + When Admin initiate a DELINQUENCY PAUSE with startDate: "06 October 2023" and endDate: "30 October 2023" + When Admin runs inline COB job for Loan + Then Loan Delinquency pause periods has the following data: + | active | pausePeriodStart | pausePeriodEnd | + | true | 06 October 2023 | 30 October 2023 | + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 06 October 2023 | 30 October 2023 | + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | RANGE_1 | 250.0 | 04 October 2023 | 2 | 5 | +# --- Grace period applied only on Loan level, not on installment level --- + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 2 | RANGE_3 | 250.00 | + Then Installment level delinquency event has correct data +# --- Full repayment for late/due date installments --- + When Admin sets the business date to "16 October 2023" + Then Loan Delinquency pause periods has the following data: + | active | pausePeriodStart | pausePeriodEnd | + | true | 06 October 2023 | 30 October 2023 | + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 06 October 2023 | 30 October 2023 | + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | RANGE_1 | 250.0 | 04 October 2023 | 2 | 15 | +# --- Grace period applied only on Loan level, not on installment level --- + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 2 | RANGE_3 | 250.00 | + And Customer makes "AUTOPAY" repayment on "16 October 2023" with 500 EUR transaction amount + When Admin runs inline COB job for Loan + Then Loan Delinquency pause periods has the following data: + | active | pausePeriodStart | pausePeriodEnd | + | true | 06 October 2023 | 30 October 2023 | + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 06 October 2023 | 30 October 2023 | + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | NO_DELINQUENCY | 0.0 | null | 0 | 0 | + Then INSTALLMENT level delinquency is null + + @TestRailId:C3003 + Scenario: Verify Loan delinquency pause E2E - partial repayment during PAUSE period + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_INSTALLMENT_LEVEL_DELINQUENCY | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount +# --- Delinquency pause --- + When Admin sets the business date to "06 October 2023" + When Admin initiate a DELINQUENCY PAUSE with startDate: "06 October 2023" and endDate: "30 October 2023" + When Admin runs inline COB job for Loan + Then Loan Delinquency pause periods has the following data: + | active | pausePeriodStart | pausePeriodEnd | + | true | 06 October 2023 | 30 October 2023 | + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 06 October 2023 | 30 October 2023 | + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | RANGE_1 | 250.0 | 04 October 2023 | 2 | 5 | +# --- Grace period applied only on Loan level, not on installment level --- + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 2 | RANGE_3 | 250.00 | + Then Installment level delinquency event has correct data +# --- Full repayment for late/due date installments --- + When Admin sets the business date to "16 October 2023" + Then Loan Delinquency pause periods has the following data: + | active | pausePeriodStart | pausePeriodEnd | + | true | 06 October 2023 | 30 October 2023 | + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 06 October 2023 | 30 October 2023 | + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | RANGE_1 | 250.0 | 04 October 2023 | 2 | 15 | +# --- Grace period applied only on Loan level, not on installment level --- + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 2 | RANGE_3 | 250.00 | + And Customer makes "AUTOPAY" repayment on "16 October 2023" with 150 EUR transaction amount + When Admin runs inline COB job for Loan + Then Loan Delinquency pause periods has the following data: + | active | pausePeriodStart | pausePeriodEnd | + | true | 06 October 2023 | 30 October 2023 | + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 06 October 2023 | 30 October 2023 | + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | RANGE_1 | 100.0 | 04 October 2023 | 2 | 15 | +# --- Grace period applied only on Loan level, not on installment level --- + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 2 | RANGE_3 | 100.00 | + + @TestRailId:C3004 + Scenario: Verify Loan delinquency pause E2E - full repayment (only late) during PAUSE period then RESUME + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_INSTALLMENT_LEVEL_DELINQUENCY | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount +# --- Delinquency pause --- + When Admin sets the business date to "06 October 2023" + When Admin initiate a DELINQUENCY PAUSE with startDate: "06 October 2023" and endDate: "30 October 2023" + When Admin runs inline COB job for Loan + Then Loan Delinquency pause periods has the following data: + | active | pausePeriodStart | pausePeriodEnd | + | true | 06 October 2023 | 30 October 2023 | + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 06 October 2023 | 30 October 2023 | + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | RANGE_1 | 250.0 | 04 October 2023 | 2 | 5 | +# --- Grace period applied only on Loan level, not on installment level --- + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 2 | RANGE_3 | 250.00 | + Then Installment level delinquency event has correct data +# --- Full repayment for late/due date installments --- + When Admin sets the business date to "16 October 2023" + Then Loan Delinquency pause periods has the following data: + | active | pausePeriodStart | pausePeriodEnd | + | true | 06 October 2023 | 30 October 2023 | + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 06 October 2023 | 30 October 2023 | + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | RANGE_1 | 250.0 | 04 October 2023 | 2 | 15 | +# --- Grace period applied only on Loan level, not on installment level --- + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 2 | RANGE_3 | 250.00 | + And Customer makes "AUTOPAY" repayment on "16 October 2023" with 250 EUR transaction amount + When Admin runs inline COB job for Loan + Then Loan Delinquency pause periods has the following data: + | active | pausePeriodStart | pausePeriodEnd | + | true | 06 October 2023 | 30 October 2023 | + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 06 October 2023 | 30 October 2023 | + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | NO_DELINQUENCY | 0.0 | null | 0 | 0 | + Then INSTALLMENT level delinquency is null +# --- Delinquency resume --- + When Admin sets the business date to "25 October 2023" + When Admin initiate a DELINQUENCY RESUME with startDate: "25 October 2023" + When Admin runs inline COB job for Loan + Then Loan Delinquency pause periods has the following data: + | active | pausePeriodStart | pausePeriodEnd | + | true | 06 October 2023 | 25 October 2023 | + When Admin sets the business date to "26 October 2023" + Then Loan Delinquency pause periods has the following data: + | active | pausePeriodStart | pausePeriodEnd | + | false | 06 October 2023 | 25 October 2023 | + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 06 October 2023 | 30 October 2023 | + | RESUME | 25 October 2023 | | + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | NO_DELINQUENCY | 250.0 | 19 October 2023 | 0 | 10 | + Then INSTALLMENT level delinquency is null +# --- Delinquency runs --- + When Admin sets the business date to "15 November 2023" + When Admin runs inline COB job for Loan + Then Loan Delinquency pause periods has the following data: + | active | pausePeriodStart | pausePeriodEnd | + | false | 06 October 2023 | 25 October 2023 | + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 06 October 2023 | 30 October 2023 | + | RESUME | 25 October 2023 | | + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | RANGE_3 | 500.0 | 19 October 2023 | 8 | 30 | +# --- Grace period applied only on Loan level, not on installment level --- + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 2 | RANGE_3 | 250.00 | + Then Installment level delinquency event has correct data + + @TestRailId:C3013 + Scenario: Verify that in case of resume on end/start date of continous pause periods first period ends automatically, second period ended by resume + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_INSTALLMENT_LEVEL_DELINQUENCY | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "25 October 2023" + When Admin initiate a DELINQUENCY PAUSE with startDate: "25 October 2023" and endDate: "30 October 2023" + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 25 October 2023 | 30 October 2023 | + Then Loan Delinquency pause periods has the following data: + | active | pausePeriodStart | pausePeriodEnd | + | true | 25 October 2023 | 30 October 2023 | + When Admin sets the business date to "30 October 2023" + When Admin initiate a DELINQUENCY PAUSE with startDate: "30 October 2023" and endDate: "15 November 2023" + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 25 October 2023 | 30 October 2023 | + | PAUSE | 30 October 2023 | 15 November 2023 | + Then Loan Delinquency pause periods has the following data: + | active | pausePeriodStart | pausePeriodEnd | + | true | 25 October 2023 | 30 October 2023 | + | true | 30 October 2023 | 15 November 2023 | + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | NO_DELINQUENCY | 500.0 | 04 October 2023 | 21 | 29 | + Then INSTALLMENT level delinquency is null + When Admin initiate a DELINQUENCY RESUME with startDate: "30 October 2023" + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | NO_DELINQUENCY | 500.0 | 04 October 2023 | 21 | 29 | + Then INSTALLMENT level delinquency is null + When Admin runs inline COB job for Loan + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 25 October 2023 | 30 October 2023 | + | PAUSE | 30 October 2023 | 15 November 2023 | + | RESUME | 30 October 2023 | | + Then Loan Delinquency pause periods has the following data: + | active | pausePeriodStart | pausePeriodEnd | + | true | 25 October 2023 | 30 October 2023 | + | true | 30 October 2023 | 30 October 2023 | + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | RANGE_3 | 500.0 | 04 October 2023 | 21 | 29 | + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 2 | RANGE_3 | 500.00 | + When Admin sets the business date to "31 October 2023" + Then Loan Delinquency pause periods has the following data: + | active | pausePeriodStart | pausePeriodEnd | + | false | 25 October 2023 | 30 October 2023 | + | false | 30 October 2023 | 30 October 2023 | + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | RANGE_3 | 500.0 | 04 October 2023 | 22 | 30 | + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 2 | RANGE_3 | 500.00 | + + @TestRailId:C3014 + Scenario: Verify that creating a loan with Advanced payment allocation with product no Advanced payment allocation set results an error + When Admin sets the business date to "01 October 2023" + When Admin creates a client with random data + When Admin creates a fully customized loan with Advanced payment allocation and with product no Advanced payment allocation set results an error: + | 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 | + | PIN30 | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + + @TestRailId:C3015 + Scenario: Verify Backdated Pause Delinquency - Event Trigger: LoanDelinquencyRangeChangeBusinessEvent, LoanAccountDelinquencyPauseChangedBusinessEvent check + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_INSTALLMENT_LEVEL_DELINQUENCY | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "25 October 2023" + When Admin runs inline COB job for Loan + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | RANGE_3 | 500.0 | 04 October 2023 | 21 | 24 | + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 2 | RANGE_3 | 500.00 | + When Admin sets the business date to "27 October 2023" +# event checks included in next steps + When Admin initiate a DELINQUENCY PAUSE with startDate: "25 October 2023" and endDate: "15 November 2023" + Then Admin checks that delinquency range is: "RANGE_3" and has delinquentDate "2023-10-04" + Then Installment level delinquency event has correct data + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 25 October 2023 | 15 November 2023 | + Then Loan Delinquency pause periods has the following data: + | active | pausePeriodStart | pausePeriodEnd | + | true | 25 October 2023 | 15 November 2023 | + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | RANGE_3 | 500.0 | 04 October 2023 | 21 | 26 | + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 2 | RANGE_3 | 500.00 | + + @TestRailId:C3016 + Scenario: Verify that for pause period calculations business date is being used instead of COB date + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_INSTALLMENT_LEVEL_DELINQUENCY | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + And Customer makes "AUTOPAY" repayment on "01 October 2023" with 250 EUR transaction amount +# --- Delinquency pause --- + When Admin sets the business date to "05 October 2023" + When Admin initiate a DELINQUENCY PAUSE with startDate: "16 October 2023" and endDate: "25 October 2023" + When Admin runs inline COB job for Loan + When Admin sets the business date to "25 October 2023" + When Admin runs inline COB job for Loan +# --- Because of grace period 3 days delinguency won't start --- + When Admin sets the business date to "26 October 2023" + When Admin runs inline COB job for Loan + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | NO_DELINQUENCY | 250.0 | 19 October 2023 | 0 | 10 | + Then INSTALLMENT level delinquency is null +# ----------- + When Admin sets the business date to "27 October 2023" + When Admin runs inline COB job for Loan + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | NO_DELINQUENCY | 250.0 | 19 October 2023 | 0 | 11 | + Then INSTALLMENT level delinquency is null +# ----------- + When Admin sets the business date to "28 October 2023" + When Admin runs inline COB job for Loan + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | NO_DELINQUENCY | 250.0 | 19 October 2023 | 0 | 12 | + Then INSTALLMENT level delinquency is null +# --- After grace period ends delinquency starts --- + When Admin sets the business date to "29 October 2023" + When Admin runs inline COB job for Loan + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | RANGE_1 | 250.0 | 19 October 2023 | 1 | 13 | +# --- Grace period applied only on Loan level, not on installment level --- + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 2 | RANGE_3 | 250.00 | + Then Installment level delinquency event has correct data + Then Loan Delinquency pause periods has the following data: + | active | pausePeriodStart | pausePeriodEnd | + | false | 16 October 2023 | 25 October 2023 | + Then Delinquency-actions have the following data: + | action | startDate | endDate | + | PAUSE | 16 October 2023 | 25 October 2023 | + + @TestRailId:C3018 + Scenario: Verify that if Global configuration: next-payment-due-date is set to: earliest-unpaid-date then in Loan details delinquent.nextPaymentDueDate will be the first unpaid installment date + When Global config "next-payment-due-date" value set to "earliest-unpaid-date" + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_INSTALLMENT_LEVEL_DELINQUENCY | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "11 October 2023" + Then Loan details delinquent.nextPaymentDueDate will be "01 October 2023" + When Admin sets the business date to "21 October 2023" + Then Loan details delinquent.nextPaymentDueDate will be "01 October 2023" + When Global config "next-payment-due-date" value set to "earliest-unpaid-date" + + @TestRailId:C3019 + Scenario: Verify that if Global configuration: next-payment-due-date is set to: next-unpaid-due-date then in Loan details delinquent.nextPaymentDueDate will be the next unpaid installment date regardless of the status of previous installments + When Global config "next-payment-due-date" value set to "next-unpaid-due-date" + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_INSTALLMENT_LEVEL_DELINQUENCY | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "11 October 2023" + Then Loan details delinquent.nextPaymentDueDate will be "16 October 2023" + When Admin sets the business date to "21 October 2023" + Then Loan details delinquent.nextPaymentDueDate will be "31 October 2023" + When Global config "next-payment-due-date" value set to "earliest-unpaid-date" + + @TestRailId:C3032 + Scenario: Verify that delinquencyRange field in LoanAccountDelinquencyRangeDataV1 is not null in case of delinquent Loan + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_INSTALLMENT_LEVEL_DELINQUENCY | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "01 December 2023" + When Admin runs inline COB job for Loan + Then LoanAccountDelinquencyRangeDataV1 has delinquencyRange field with value "RANGE_30" + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | RANGE_30 | 1000.0 | 04 October 2023 | 58 | 61 | + + @TestRailId:C3035 + Scenario: Verify that delinquency is NOT applied after loan submitted and approved + When Admin sets the business date to "30 October 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_INSTALLMENT_LEVEL_DELINQUENCY | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | NO_DELINQUENCY | 0.0 | null | 0 | 0 | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | NO_DELINQUENCY | 0.0 | null | 0 | 0 | + + @TestRailId:C3047 + Scenario: Verify that delinquent.lastRepaymentAmount is calculated correctly in case of auto downpayment + When Admin sets the business date to "01 February 2024" + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 February 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 February 2024" with "1000" amount and expected disbursement date on "01 February 2024" + When Admin successfully disburse the loan on "01 February 2024" with "1000" EUR transaction amount + When Admin sets the business date to "01 April 2024" + Then In Loan details delinquent.lastRepaymentAmount is 250 EUR with lastRepaymentDate "01 February 2024" + + @TestRailId:C3066 @AdvancedPaymentAllocation + Scenario: Verify that on Loans in SUBMITTED_AND_PENDING_APPROVAL or APPROVED status delinquency is not applied + When Admin sets the business date to "01 February 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 February 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + When Admin sets the business date to "01 March 2024" + When Admin runs inline COB job for Loan + Then Admin checks that delinquency range is: "NO_DELINQUENCY" and has delinquentDate "" + And Admin successfully approves the loan on "01 March 2024" with "1000" amount and expected disbursement date on "01 March 2024" + Then Admin checks that delinquency range is: "NO_DELINQUENCY" and has delinquentDate "" + +# TODO remove skip when LoanDelinquencyRangeChangeBusinessEvent has wrong values compared to LoanDetails is done and scenario below here does not fail + @Skip @TestRailId:C3093 + Scenario: Verify that LoanDelinquencyRangeChangeBusinessEvent has the correct Delinquency range, date and amount on both loan- and installment-level + When Admin sets the business date to "01 January 2024" + 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL_INSTALLMENT_LEVEL_DELINQUENCY | 01 January 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 90 | DAYS | 30 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "1000" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "1000" EUR transaction amount + When Admin sets the business date to "05 March 2024" + When Admin runs inline COB job for Loan + Then Loan has the following LOAN level delinquency data: + | classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays | + | RANGE_60 | 750.0 | 04 January 2024 | 61 | 64 | + Then Loan has the following INSTALLMENT level delinquency data: + | rangeId | Range | Amount | + | 2 | RANGE_3 | 250.00 | + | 3 | RANGE_30 | 250.00 | + | 4 | RANGE_60 | 250.00 | + Then LoanDelinquencyRangeChangeBusinessEvent has the same Delinquency range, date and amount as in LoanDetails on both loan- and installment-level diff --git a/fineract-e2e-tests-runner/src/test/resources/features/LoanDownPayment.feature b/fineract-e2e-tests-runner/src/test/resources/features/LoanDownPayment.feature new file mode 100644 index 00000000000..35ec81fe8c8 --- /dev/null +++ b/fineract-e2e-tests-runner/src/test/resources/features/LoanDownPayment.feature @@ -0,0 +1,2577 @@ +@LoanDownPaymentFeature +Feature: Loan DownPayment + + @TestRailId:C2812 + Scenario: Single disbursement normal flow - auto enabled + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 January 2022 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 250.0 | 0 | 0 | 750 | + When Admin sets the business date to "01 February 2022" + And Customer makes "AUTOPAY" repayment on "01 February 2022" with 250 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | 01 February 2022 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 500.0 | 0 | 0 | 500 | + When Admin sets the business date to "15 February 2023" + And Customer makes "AUTOPAY" repayment on "15 February 2022" with 400 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | 01 February 2022 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 28 | 01 March 2022 | 15 February 2022 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 150.0 | 150.0 | 0.0 | 100.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 900.0 | 400 | 0 | 100 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 01 February 2022 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 15 February 2022 | Repayment | 400.0 | 400.0 | 0.0 | 0.0 | 0.0 | 100.0 | + + @TestRailId:C2813 + Scenario: Single disbursement normal flow - auto disabled + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT | 01 January 2022 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 0.0 | 0 | 0 | 1000 | + And Customer makes "DOWN_PAYMENT" repayment on "01 January 2022" with 250 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 250.0 | 0 | 0 | 750 | + When Admin sets the business date to "01 February 2022" + And Customer makes "AUTOPAY" repayment on "01 February 2022" with 250 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | 01 February 2022 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 500.0 | 0 | 0 | 500 | + When Admin sets the business date to "15 February 2023" + And Customer makes "AUTOPAY" repayment on "15 February 2022" with 400 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | 01 February 2022 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 28 | 01 March 2022 | 15 February 2022 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 150.0 | 150.0 | 0.0 | 100.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 900.0 | 400 | 0 | 100 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 01 February 2022 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 15 February 2022 | Repayment | 400.0 | 400.0 | 0.0 | 0.0 | 0.0 | 100.0 | + + @TestRailId:C2814 + Scenario: Single disbursement charge flow - auto enabled + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 January 2022 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "01 January 2022" due date and 50 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 50.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 50 | 1050.0 | 250.0 | 0 | 0 | 800 | + When Admin sets the business date to "01 February 2022" + And Customer makes "AUTOPAY" repayment on "01 February 2022" with 300 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | 01 February 2022 | 500.0 | 250.0 | 0.0 | 0.0 | 50.0 | 300.0 | 300.0 | 0.0 | 0.0 | 0.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 50 | 1050.0 | 550.0 | 0 | 0 | 500 | + When Admin sets the business date to "15 February 2023" + And Customer makes "AUTOPAY" repayment on "15 February 2022" with 400 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | 01 February 2022 | 500.0 | 250.0 | 0.0 | 0.0 | 50.0 | 300.0 | 300.0 | 0.0 | 0.0 | 0.0 | + | 3 | 28 | 01 March 2022 | 15 February 2022 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 150.0 | 150.0 | 0.0 | 100.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 50 | 1050.0 | 950.0 | 400 | 0 | 100 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 01 February 2022 | Repayment | 300.0 | 250.0 | 0.0 | 0.0 | 50.0 | 500.0 | + | 15 February 2022 | Repayment | 400.0 | 400.0 | 0.0 | 0.0 | 0.0 | 100.0 | + + @TestRailId:C2815 + Scenario: Single disbursement charge flow - auto disabled + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT | 01 January 2022 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "01 January 2022" due date and 50 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 50.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 50 | 1050.0 | 0.0 | 0 | 0 | 1050 | + And Customer makes "DOWN_PAYMENT" repayment on "01 January 2022" with 250 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 50.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 50 | 1050.0 | 250.0 | 0 | 0 | 800 | + When Admin sets the business date to "01 February 2022" + And Customer makes "AUTOPAY" repayment on "01 February 2022" with 300 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | 01 February 2022 | 500.0 | 250.0 | 0.0 | 0.0 | 50.0 | 300.0 | 300.0 | 0.0 | 0.0 | 0.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 50 | 1050.0 | 550.0 | 0 | 0 | 500 | + When Admin sets the business date to "15 February 2023" + And Customer makes "AUTOPAY" repayment on "15 February 2022" with 400 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | 01 February 2022 | 500.0 | 250.0 | 0.0 | 0.0 | 50.0 | 300.0 | 300.0 | 0.0 | 0.0 | 0.0 | + | 3 | 28 | 01 March 2022 | 15 February 2022 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 150.0 | 150.0 | 0.0 | 100.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 50 | 1050.0 | 950.0 | 400 | 0 | 100 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 01 February 2022 | Repayment | 300.0 | 250.0 | 0.0 | 0.0 | 50.0 | 500.0 | + | 15 February 2022 | Repayment | 400.0 | 400.0 | 0.0 | 0.0 | 0.0 | 100.0 | + + @TestRailId:C2816 + Scenario: Double disbursement different day - auto enabled + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 January 2022 | 2000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "2000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "01 January 2022" due date and 50 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 50.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 50 | 1050.0 | 250.0 | 0 | 0 | 800 | + When Admin sets the business date to "10 January 2022" + When Admin successfully disburse the loan on "10 January 2022" with "400" EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 10 January 2022 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 10 January 2022 | 10 January 2022 | 1050.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 February 2022 | | 700.0 | 350.0 | 0.0 | 0.0 | 50.0 | 400.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 4 | 28 | 01 March 2022 | | 350.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1400.0 | 0 | 0 | 50 | 1450.0 | 350.0 | 0 | 0 | 1100 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 10 January 2022 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1150.0 | + | 10 January 2022 | Down Payment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 1050.0 | + + @TestRailId:C2817 + Scenario: Double disbursement different day - auto disabled + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT | 01 January 2022 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "01 January 2022" due date and 50 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 50.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 50 | 1050.0 | 0.0 | 0 | 0 | 1050 | + And Customer makes "DOWN_PAYMENT" repayment on "01 January 2022" with 250 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 50.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 50 | 1050.0 | 250.0 | 0 | 0 | 800 | + When Admin sets the business date to "10 January 2022" + When Admin successfully disburse the loan on "10 January 2022" with "400" EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 10 January 2022 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 10 January 2022 | | 1050.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 3 | 31 | 01 February 2022 | | 700.0 | 350.0 | 0.0 | 0.0 | 50.0 | 400.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 4 | 28 | 01 March 2022 | | 350.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1400.0 | 0 | 0 | 50 | 1450.0 | 250.0 | 0 | 0 | 1200 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 10 January 2022 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1150.0 | + + + @TestRailId:C2818 + Scenario: Double disbursement on installment day - auto enabled + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 January 2022 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "01 January 2022" due date and 50 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 50.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 50 | 1050.0 | 250.0 | 0 | 0 | 800 | + When Admin sets the business date to "01 February 2022" + When Admin successfully disburse the loan on "01 February 2022" with "400" EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 01 February 2022 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 01 February 2022 | 01 February 2022 | 1050.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 February 2022 | | 700.0 | 350.0 | 0.0 | 0.0 | 50.0 | 400.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 4 | 28 | 01 March 2022 | | 350.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1400.0 | 0 | 0 | 50 | 1450.0 | 350.0 | 0 | 0 | 1100 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 01 February 2022 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1150.0 | + | 01 February 2022 | Down Payment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 1050.0 | + + + @TestRailId:C2819 + Scenario: Double disbursement on installment day - auto disabled + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT | 01 January 2022 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "01 January 2022" due date and 50 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 50.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 50 | 1050.0 | 0.0 | 0 | 0 | 1050 | + And Customer makes "DOWN_PAYMENT" repayment on "01 January 2022" with 250 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 50.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 50 | 1050.0 | 250.0 | 0 | 0 | 800 | + When Admin sets the business date to "01 February 2022" + When Admin successfully disburse the loan on "01 February 2022" with "400" EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 01 February 2022 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 01 February 2022 | | 1050.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 3 | 31 | 01 February 2022 | | 700.0 | 350.0 | 0.0 | 0.0 | 50.0 | 400.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 4 | 28 | 01 March 2022 | | 350.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1400.0 | 0 | 0 | 50 | 1450.0 | 250.0 | 0 | 0 | 1200 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 01 February 2022 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1150.0 | + + @TestRailId:C2820 + Scenario: Downpayment with loan adjustment - auto enabled + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 January 2022 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "01 January 2022" due date and 50 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 50.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 50 | 1050.0 | 250.0 | 0 | 0 | 800 | + When Admin sets the business date to "10 January 2022" + When Admin creates and approves Loan reschedule with the following data: + | rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate | + | 01 February 2022 | 10 January 2022 | 01 April 2022 | 0 | 0 | 0 | 0 | + When Admin sets the business date to "01 April 2022" + When Admin successfully disburse the loan on "01 April 2022" with "400" EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 01 April 2022 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 01 April 2022 | 01 April 2022 | 1050.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 3 | 90 | 01 April 2022 | | 700.0 | 350.0 | 0.0 | 0.0 | 50.0 | 400.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 4 | 30 | 01 May 2022 | | 350.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | + | 5 | 31 | 01 June 2022 | | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1400.0 | 0 | 0 | 50 | 1450.0 | 350.0 | 0 | 0 | 1100 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 01 April 2022 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1150.0 | + | 01 April 2022 | Down Payment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 1050.0 | + + @TestRailId:C2821 + Scenario: Downpayment with loan adjustment - auto disabled + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT | 01 January 2022 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "01 January 2022" due date and 50 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 50.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 50 | 1050.0 | 0.0 | 0 | 0 | 1050 | + And Customer makes "DOWN_PAYMENT" repayment on "01 January 2022" with 250 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 50.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 50 | 1050.0 | 250.0 | 0 | 0 | 800 | + When Admin sets the business date to "10 January 2022" + When Admin creates and approves Loan reschedule with the following data: + | rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate | + | 01 February 2022 | 10 January 2022 | 01 April 2022 | 0 | 0 | 0 | 0 | + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 90 | 01 April 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 50.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 3 | 30 | 01 May 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 June 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 50 | 1050.0 | 250.0 | 0 | 0 | 800 | + When Admin sets the business date to "01 April 2022" + When Admin successfully disburse the loan on "01 April 2022" with "400" EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 01 April 2022 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 01 April 2022 | | 1050.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 3 | 90 | 01 April 2022 | | 700.0 | 350.0 | 0.0 | 0.0 | 50.0 | 400.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 4 | 30 | 01 May 2022 | | 350.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | + | 5 | 31 | 01 June 2022 | | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1400.0 | 0 | 0 | 50 | 1450.0 | 250.0 | 0 | 0 | 1200 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 01 April 2022 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1150.0 | + + @TestRailId:C2822 + Scenario: Downpayment creation date - auto enabled + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 January 2022 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "1000" amount and expected disbursement date on "10 January 2023" + When Admin sets the business date to "10 January 2022" + When Admin successfully disburse the loan on "10 January 2022" with "1000" EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "10 January 2022" due date and 50 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 10 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 10 January 2022 | 10 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 10 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 50.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 3 | 28 | 10 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 10 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 50 | 1050.0 | 250.0 | 0 | 0 | 800 | + When Admin creates and approves Loan reschedule with the following data: + | rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate | + | 10 February 2022 | 10 January 2022 | 10 April 2022 | 0 | 0 | 0 | 0 | + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 10 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 10 January 2022 | 10 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 90 | 10 April 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 50.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 3 | 30 | 10 May 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 10 June 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 50 | 1050.0 | 250.0 | 0 | 0 | 800 | + When Admin sets the business date to "01 April 2022" + When Admin successfully disburse the loan on "01 April 2022" with "400" EUR transaction amount + Then Loan Repayment schedule has 5 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 | + | | | 10 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 10 January 2022 | 10 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 01 April 2022 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 01 April 2022 | 01 April 2022 | 1050.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 3 | 90 | 10 April 2022 | | 700.0 | 350.0 | 0.0 | 0.0 | 50.0 | 400.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 4 | 30 | 10 May 2022 | | 350.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | + | 5 | 31 | 10 June 2022 | | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1400.0 | 0 | 0 | 50 | 1450.0 | 350.0 | 0 | 0 | 1100 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 10 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 January 2022 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 01 April 2022 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1150.0 | + | 01 April 2022 | Down Payment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 1050.0 | + + @TestRailId:C2823 + Scenario: Downpayment creation date - auto disabled + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT | 01 January 2022 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "1000" amount and expected disbursement date on "10 January 2023" + When Admin sets the business date to "10 January 2022" + When Admin successfully disburse the loan on "10 January 2022" with "1000" EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "10 January 2022" due date and 50 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 10 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 10 January 2022 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 31 | 10 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 50.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 3 | 28 | 10 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 10 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 50 | 1050.0 | 0.0 | 0 | 0 | 1050 | + And Customer makes "DOWN_PAYMENT" repayment on "10 January 2022" with 250 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 10 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 10 January 2022 | 10 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 10 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 50.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 3 | 28 | 10 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 10 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 50 | 1050.0 | 250.0 | 0 | 0 | 800 | + When Admin creates and approves Loan reschedule with the following data: + | rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate | + | 10 February 2022 | 10 January 2022 | 10 April 2022 | 0 | 0 | 0 | 0 | + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 10 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 10 January 2022 | 10 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 90 | 10 April 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 50.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 3 | 30 | 10 May 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 10 June 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 50 | 1050.0 | 250.0 | 0 | 0 | 800 | + When Admin sets the business date to "01 April 2022" + When Admin successfully disburse the loan on "01 April 2022" with "400" EUR transaction amount + Then Loan Repayment schedule has 5 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 | + | | | 10 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 10 January 2022 | 10 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 01 April 2022 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 01 April 2022 | | 1050.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 3 | 90 | 10 April 2022 | | 700.0 | 350.0 | 0.0 | 0.0 | 50.0 | 400.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 4 | 30 | 10 May 2022 | | 350.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | + | 5 | 31 | 10 June 2022 | | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1400.0 | 0 | 0 | 50 | 1450.0 | 250.0 | 0 | 0 | 1200 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 10 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 January 2022 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 01 April 2022 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1150.0 | + + @TestRailId:C2824 + Scenario: Double disbursement normal flow - auto enabled + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 January 2022 | 2000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "2000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 250.0 | 0 | 0 | 750 | + When Admin sets the business date to "15 January 2022" + When Admin successfully disburse the loan on "15 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 15 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 15 January 2022 | 15 January 2022 | 1500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 February 2022 | | 1000.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 4 | 28 | 01 March 2022 | | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 2000.0 | 0 | 0 | 0 | 2000.0 | 500.0 | 0 | 0 | 1500 | + When Admin sets the business date to "01 February 2022" + And Customer makes "AUTOPAY" repayment on "01 February 2022" with 500 EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 15 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 15 January 2022 | 15 January 2022 | 1500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 February 2022 | 01 February 2022 | 1000.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | + | 4 | 28 | 01 March 2022 | | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 2000.0 | 0 | 0 | 0 | 2000.0 | 1000.0 | 0 | 0 | 1000 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 15 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1750.0 | + | 15 January 2022 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 1500.0 | + | 01 February 2022 | Repayment | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + + @TestRailId:C2825 + Scenario: Double disbursement normal flow - auto disabled + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT | 01 January 2022 | 2000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "2000" amount and expected disbursement date on "01 January 2022" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 0.0 | 0 | 0 | 1000 | + And Customer makes "AUTOPAY" repayment on "01 January 2022" with 250 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 250.0 | 0 | 0 | 750 | + When Admin sets the business date to "15 January 2022" + When Admin successfully disburse the loan on "15 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 15 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 15 January 2022 | | 1500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 31 | 01 February 2022 | | 1000.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 4 | 28 | 01 March 2022 | | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 2000.0 | 0 | 0 | 0 | 2000.0 | 250.0 | 0 | 0 | 1750 | + When Admin sets the business date to "01 February 2022" + And Customer makes "AUTOPAY" repayment on "01 February 2022" with 500 EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 15 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 15 January 2022 | 01 February 2022 | 1500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | 3 | 31 | 01 February 2022 | | 1000.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 250.0 | 0.0 | 0.0 | 250.0 | + | 4 | 28 | 01 March 2022 | | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 2000.0 | 0 | 0 | 0 | 2000.0 | 750.0 | 0 | 250 | 1250 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 15 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1750.0 | + | 01 February 2022 | Repayment | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 1250.0 | + + @TestRailId:C2826 + Scenario: Double disbursement same day - auto enabled + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 January 2022 | 2000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "2000" amount and expected disbursement date on "01 January 2022" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 250.0 | 0 | 0 | 750 | + When Admin sets the business date to "15 January 2022" + When Admin successfully disburse the loan on "15 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 15 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 15 January 2022 | 15 January 2022 | 1500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 February 2022 | | 1000.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 4 | 28 | 01 March 2022 | | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 2000.0 | 0 | 0 | 0 | 2000.0 | 500.0 | 0 | 0 | 1500 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 15 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1750.0 | + | 15 January 2022 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 1500.0 | + + @TestRailId:C2827 + Scenario: Double disbursement same day - auto disabled + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT | 01 January 2022 | 2000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "2000" amount and expected disbursement date on "01 January 2022" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 0 | 0 | 0 | 1000 | + And Customer makes "AUTOPAY" repayment on "01 January 2022" with 250 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 250.0 | 0 | 0 | 750 | + When Admin sets the business date to "15 January 2022" + When Admin successfully disburse the loan on "15 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 15 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 15 January 2022 | | 1500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 31 | 01 February 2022 | | 1000.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 4 | 28 | 01 March 2022 | | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 2000.0 | 0 | 0 | 0 | 2000.0 | 250.0 | 0 | 0 | 1750 | + And Customer makes "AUTOPAY" repayment on "15 January 2022" with 250 EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 15 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 15 January 2022 | 15 January 2022 | 1500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 February 2022 | | 1000.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 4 | 28 | 01 March 2022 | | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 2000.0 | 0 | 0 | 0 | 2000.0 | 500.0 | 0 | 0 | 1500 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 15 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1750.0 | + | 15 January 2022 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 1500.0 | + + @TestRailId:C2828 + Scenario: Double disbursement partial overpayment - auto enabled + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 January 2022 | 2000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "2000" amount and expected disbursement date on "01 January 2022" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 250.0 | 0 | 0 | 750 | + When Admin sets the business date to "15 January 2022" + When Admin successfully disburse the loan on "15 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 15 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 15 January 2022 | 15 January 2022 | 1500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 February 2022 | | 1000.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 4 | 28 | 01 March 2022 | | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 2000.0 | 0 | 0 | 0 | 2000.0 | 500.0 | 0 | 0 | 1500 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 15 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1750.0 | + | 15 January 2022 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 1500.0 | + + @TestRailId:C2829 + Scenario: Double disbursement partial overpayment - auto disabled + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT | 01 January 2022 | 2000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "2000" amount and expected disbursement date on "01 January 2022" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 0 | 0 | 0 | 1000 | + And Customer makes "AUTOPAY" repayment on "01 January 2022" with 400 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 150.0 | 150.0 | 0.0 | 100.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 400.0 | 150 | 0 | 600 | + When Admin sets the business date to "15 January 2022" + When Admin successfully disburse the loan on "15 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 15 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 15 January 2022 | | 1500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 150.0 | 150.0 | 0.0 | 100.0 | + | 3 | 31 | 01 February 2022 | | 1000.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 4 | 28 | 01 March 2022 | | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 2000.0 | 0 | 0 | 0 | 2000.0 | 400.0 | 150 | 0 | 1600 | + And Customer makes "AUTOPAY" repayment on "15 January 2022" with 250 EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 15 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 15 January 2022 | 15 January 2022 | 1500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 150.0 | 0.0 | 0.0 | + | 3 | 31 | 01 February 2022 | | 1000.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 150.0 | 150.0 | 0.0 | 350.0 | + | 4 | 28 | 01 March 2022 | | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 2000.0 | 0 | 0 | 0 | 2000.0 | 650.0 | 300 | 0 | 1350 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Repayment | 400.0 | 400.0 | 0.0 | 0.0 | 0.0 | 600.0 | + | 15 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1600.0 | + | 15 January 2022 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 1350.0 | + + @TestRailId:C2830 + Scenario: Double disbursement full overpayment - auto enabled + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 January 2022 | 2000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "2000" amount and expected disbursement date on "01 January 2022" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 250.0 | 0 | 0 | 750 | + And Customer makes "AUTOPAY" repayment on "01 January 2022" with 250 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | 01 January 2022 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 500.0 | 250 | 0 | 500 | + When Admin sets the business date to "15 January 2022" + When Admin successfully disburse the loan on "15 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 15 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 15 January 2022 | 01 January 2022 | 1500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 3 | 31 | 01 February 2022 | | 1000.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 250.0 | 250.0 | 0.0 | 250.0 | + | 4 | 28 | 01 March 2022 | | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 2000.0 | 0 | 0 | 0 | 2000.0 | 750.0 | 500 | 0 | 1250 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 01 January 2022 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 15 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1500.0 | + | 15 January 2022 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 1250.0 | + + @TestRailId:C2831 + Scenario: Double disbursement full overpayment - auto disabled + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT | 01 January 2022 | 2000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "2000" amount and expected disbursement date on "01 January 2022" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 0 | 0 | 0 | 1000 | + And Customer makes "AUTOPAY" repayment on "01 January 2022" with 500 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | 01 January 2022 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 500.0 | 250 | 0 | 500 | + When Admin sets the business date to "15 January 2022" + When Admin successfully disburse the loan on "15 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 15 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 15 January 2022 | 01 January 2022 | 1500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 3 | 31 | 01 February 2022 | | 1000.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 4 | 28 | 01 March 2022 | | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 2000.0 | 0 | 0 | 0 | 2000.0 | 500.0 | 250 | 0 | 1500 | + And Customer makes "AUTOPAY" repayment on "15 January 2022" with 250 EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 15 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 15 January 2022 | 01 January 2022 | 1500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 3 | 31 | 01 February 2022 | | 1000.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 250.0 | 250.0 | 0.0 | 250.0 | + | 4 | 28 | 01 March 2022 | | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 2000.0 | 0 | 0 | 0 | 2000.0 | 750.0 | 500 | 0 | 1250 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Repayment | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 15 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1500.0 | + | 15 January 2022 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 1250.0 | + + @TestRailId:C2832 + Scenario: Double disbursement after installment overdue - auto enabled + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 January 2022 | 2000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "2000" amount and expected disbursement date on "01 January 2022" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 250.0 | 0 | 0 | 750 | + When Admin sets the business date to "15 February 2022" + When Admin successfully disburse the loan on "15 February 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | 15 February 2022 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | | | 15 February 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 3 | 0 | 15 February 2022 | | 1250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 28 | 01 March 2022 | | 750.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 750.0 | 0.0 | 0.0 | 0.0 | 750.0 | 0.0 | 0.0 | 0.0 | 750.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 2000.0 | 0 | 0 | 0 | 2000.0 | 500.0 | 0 | 250 | 1500 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 15 February 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1750.0 | + | 15 February 2022 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 1500.0 | + + @TestRailId:C2833 + Scenario: Double disbursement after installment overdue - auto disabled + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT | 01 January 2022 | 2000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "2000" amount and expected disbursement date on "01 January 2022" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 0 | 0 | 0 | 1000 | + And Customer makes "AUTOPAY" repayment on "01 January 2022" with 250 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 250.0 | 0 | 0 | 750 | + When Admin sets the business date to "15 February 2022" + When Admin successfully disburse the loan on "15 February 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | | | 15 February 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 3 | 0 | 15 February 2022 | | 1250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 28 | 01 March 2022 | | 750.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 750.0 | 0.0 | 0.0 | 0.0 | 750.0 | 0.0 | 0.0 | 0.0 | 750.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 2000.0 | 0 | 0 | 0 | 2000.0 | 250.0 | 0 | 0 | 1750 | + And Customer makes "AUTOPAY" repayment on "15 February 2022" with 250 EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | 15 February 2022 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | | | 15 February 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 3 | 0 | 15 February 2022 | | 1250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 28 | 01 March 2022 | | 750.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 750.0 | 0.0 | 0.0 | 0.0 | 750.0 | 0.0 | 0.0 | 0.0 | 750.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 2000.0 | 0 | 0 | 0 | 2000.0 | 500.0 | 0 | 250 | 1500 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 15 February 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1750.0 | + | 15 February 2022 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 1500.0 | + + @TestRailId:C2834 + Scenario: Double disbursement after installment 2 - auto enabled + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 January 2022 | 2000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "2000" amount and expected disbursement date on "01 January 2022" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 250.0 | 0 | 0 | 750 | + When Admin sets the business date to "01 February 2022" + And Customer makes "AUTOPAY" repayment on "01 February 2022" with 250 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | 01 February 2022 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 500.0 | 0 | 0 | 500 | + When Admin sets the business date to "15 February 2022" + When Admin successfully disburse the loan on "15 February 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | 01 February 2022 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 15 February 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 3 | 0 | 15 February 2022 | 15 February 2022 | 1250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 4 | 28 | 01 March 2022 | | 750.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 750.0 | 0.0 | 0.0 | 0.0 | 750.0 | 0.0 | 0.0 | 0.0 | 750.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 2000.0 | 0 | 0 | 0 | 2000.0 | 750.0 | 0 | 0 | 1250 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 01 February 2022 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 15 February 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1500.0 | + | 15 February 2022 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 1250.0 | + + @TestRailId:C2835 + Scenario: Double disbursement after installment 2 - auto disabled + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT | 01 January 2022 | 2000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "2000" amount and expected disbursement date on "01 January 2022" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 0 | 0 | 0 | 1000 | + And Customer makes "AUTOPAY" repayment on "01 January 2022" with 250 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 250.0 | 0 | 0 | 750 | + When Admin sets the business date to "01 February 2022" + And Customer makes "AUTOPAY" repayment on "01 February 2022" with 250 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | 01 February 2022 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 500.0 | 0 | 0 | 500 | + When Admin sets the business date to "15 February 2022" + When Admin successfully disburse the loan on "15 February 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | 01 February 2022 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 15 February 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 3 | 0 | 15 February 2022 | | 1250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 28 | 01 March 2022 | | 750.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 750.0 | 0.0 | 0.0 | 0.0 | 750.0 | 0.0 | 0.0 | 0.0 | 750.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 2000.0 | 0 | 0 | 0 | 2000.0 | 500.0 | 0 | 0 | 1500 | + And Customer makes "AUTOPAY" repayment on "15 February 2022" with 250 EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | 01 February 2022 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 15 February 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 3 | 0 | 15 February 2022 | 15 February 2022 | 1250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 4 | 28 | 01 March 2022 | | 750.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 750.0 | 0.0 | 0.0 | 0.0 | 750.0 | 0.0 | 0.0 | 0.0 | 750.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 2000.0 | 0 | 0 | 0 | 2000.0 | 750.0 | 0 | 0 | 1250 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 01 February 2022 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 15 February 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1500.0 | + | 15 February 2022 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 1250.0 | + + @TestRailId:C2836 + Scenario: Double disbursement normal overdue - auto enabled + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 January 2022 | 2000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "2000" amount and expected disbursement date on "01 January 2022" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 250 | 0 | 0 | 750 | + When Admin sets the business date to "15 January 2022" + When Admin successfully disburse the loan on "15 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 15 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 15 January 2022 | 15 January 2022 | 1500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 February 2022 | | 1000.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 4 | 28 | 01 March 2022 | | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 2000.0 | 0 | 0 | 0 | 2000.0 | 500 | 0 | 0 | 1500 | + And Customer makes "AUTOPAY" repayment on "15 January 2022" with 250 EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 15 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 15 January 2022 | 15 January 2022 | 1500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 February 2022 | | 1000.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 250.0 | 250.0 | 0.0 | 250.0 | + | 4 | 28 | 01 March 2022 | | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 2000.0 | 0 | 0 | 0 | 2000.0 | 750 | 250 | 0 | 1250 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 15 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1750.0 | + | 15 January 2022 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 1500.0 | + | 15 January 2022 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 1250.0 | + + @TestRailId:C2837 + Scenario: Double disbursement normal overdue - auto disabled + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT | 01 January 2022 | 2000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "2000" amount and expected disbursement date on "01 January 2022" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 0 | 0 | 0 | 1000 | + When Admin sets the business date to "15 January 2022" + When Admin successfully disburse the loan on "15 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | | | 15 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 15 January 2022 | | 1500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 31 | 01 February 2022 | | 1000.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 4 | 28 | 01 March 2022 | | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 2000.0 | 0 | 0 | 0 | 2000.0 | 0 | 0 | 0 | 2000 | + And Customer makes "AUTOPAY" repayment on "15 January 2022" with 250 EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 15 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | | | 15 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 15 January 2022 | | 1500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 31 | 01 February 2022 | | 1000.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 4 | 28 | 01 March 2022 | | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 2000.0 | 0 | 0 | 0 | 2000.0 | 250 | 0 | 250 | 1750 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 15 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 2000.0 | + | 15 January 2022 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 1750.0 | + + @TestRailId:C2838 + Scenario: Double disbursement on Duedate - auto enabled + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 January 2022 | 2000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "2000" amount and expected disbursement date on "01 January 2022" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 250.0 | 0 | 0 | 750 | + When Admin sets the business date to "01 February 2022" + When Admin successfully disburse the loan on "01 February 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 01 February 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 01 February 2022 | 01 February 2022 | 1500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 February 2022 | | 1000.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 4 | 28 | 01 March 2022 | | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 2000.0 | 0 | 0 | 0 | 2000.0 | 500 | 0 | 0 | 1500 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 01 February 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1750.0 | + | 01 February 2022 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 1500.0 | + + @TestRailId:C2839 + Scenario: Double disbursement on Duedate - auto disabled + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT | 01 January 2022 | 2000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "2000" amount and expected disbursement date on "01 January 2022" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 0 | 0 | 0 | 1000 | + And Customer makes "AUTOPAY" repayment on "01 January 2022" with 250 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 250.0 | 0 | 0 | 750 | + When Admin sets the business date to "01 February 2022" + When Admin successfully disburse the loan on "01 February 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 01 February 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 01 February 2022 | | 1500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 31 | 01 February 2022 | | 1000.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 4 | 28 | 01 March 2022 | | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 2000.0 | 0 | 0 | 0 | 2000.0 | 250 | 0 | 0 | 1750 | + And Customer makes "AUTOPAY" repayment on "01 February 2022" with 250 EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 01 February 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 01 February 2022 | 01 February 2022 | 1500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 February 2022 | | 1000.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 4 | 28 | 01 March 2022 | | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 2000.0 | 0 | 0 | 0 | 2000.0 | 500 | 0 | 0 | 1500 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 01 February 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1750.0 | + | 01 February 2022 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 1500.0 | + + # To recheck after verifying that loan product details are correct + @Skip @TestRailId:C2852 + Scenario: Single disbursement with interest - auto disabled + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT_INTEREST | 01 January 2022 | 1000 | 12 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 10.0 | 0.0 | 0.0 | 260.0 | 0.0 | 0.0 | 0.0 | 260.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 10.0 | 0.0 | 0.0 | 260.0 | 0.0 | 0.0 | 0.0 | 260.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 10.0 | 0.0 | 0.0 | 260.0 | 0.0 | 0.0 | 0.0 | 260.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 30 | 0 | 0 | 1030.0 | 0.0 | 0 | 0 | 1030 | + + # To recheck after verifying that loan product details are correct + @Skip @TestRailId:C2853 + Scenario: Single disbursement delinquency - auto disabled + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT_INTEREST | 01 January 2022 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 0.0 | 0 | 0 | 1000 | + When Admin sets the business date to "5 January 2022" + When Admin runs COB job + Then Admin checks that delinquency range is: "RANGE_1" and has delinquentDate "2022-01-04" + + @TestRailId:C2854 + Scenario: Single disbursement with undo disbursement when auto downpayment is enabled without manual transaction after last downpayment + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 January 2022 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 250.0 | 0 | 0 | 750 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + When Admin successfully undo disbursal + Then Loan status has changed to "Approved" + + @TestRailId:C2855 + Scenario: Single disbursement with undo disbursement when auto downpayment is disabled without manual transaction after last downpayment + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT | 01 January 2022 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 0.0 | 0 | 0 | 1000 | + And Customer makes "DOWN_PAYMENT" repayment on "01 January 2022" with 250 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 250.0 | 0 | 0 | 750 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + When Admin successfully undo disbursal + Then Loan status has changed to "Approved" + + @TestRailId:C2856 + Scenario: Single disbursement with undo disbursement when auto downpayment is disabled with manual transaction after last downpayment + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT | 01 January 2022 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 0.0 | 0 | 0 | 1000 | + And Customer makes "DOWN_PAYMENT" repayment on "01 January 2022" with 250 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 250.0 | 0 | 0 | 750 | + When Admin sets the business date to "01 February 2022" + And Customer makes "AUTOPAY" repayment on "01 February 2022" with 250 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | 01 February 2022 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 500.0 | 0 | 0 | 500 | + When Admin sets the business date to "15 February 2023" + And Customer makes "AUTOPAY" repayment on "15 February 2022" with 400 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | 01 February 2022 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 28 | 01 March 2022 | 15 February 2022 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 150.0 | 150.0 | 0.0 | 100.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 900.0 | 400 | 0 | 100 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 01 February 2022 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 15 February 2022 | Repayment | 400.0 | 400.0 | 0.0 | 0.0 | 0.0 | 100.0 | + When Admin successfully undo disbursal + Then Loan status has changed to "Approved" + + @TestRailId:C2857 + Scenario: Single disbursement with undo disbursement when auto downpayment is enabled with manual transaction after last downpayment + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 January 2022 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 250.0 | 0 | 0 | 750 | + When Admin sets the business date to "01 February 2022" + And Customer makes "AUTOPAY" repayment on "01 February 2022" with 250 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | 01 February 2022 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 500.0 | 0 | 0 | 500 | + When Admin sets the business date to "15 February 2023" + And Customer makes "AUTOPAY" repayment on "15 February 2022" with 400 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | 01 February 2022 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 28 | 01 March 2022 | 15 February 2022 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 150.0 | 150.0 | 0.0 | 100.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 900.0 | 400 | 0 | 100 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 01 February 2022 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 15 February 2022 | Repayment | 400.0 | 400.0 | 0.0 | 0.0 | 0.0 | 100.0 | + When Admin successfully undo disbursal + Then Loan status has changed to "Approved" + + + @TestRailId:C2858 + Scenario: Multi disbursement with undo last disbursement when auto downpayment is enabled without manual transaction after last downpayment + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 January 2022 | 2000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "2000" amount and expected disbursement date on "01 January 2022" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 250 | 0 | 0 | 750 | + When Admin sets the business date to "15 January 2022" + When Admin successfully disburse the loan on "15 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 15 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 15 January 2022 | 15 January 2022 | 1500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 February 2022 | | 1000.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 4 | 28 | 01 March 2022 | | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 2000.0 | 0 | 0 | 0 | 2000.0 | 500 | 0 | 0 | 1500 | + When Admin successfully undo last disbursal + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 250 | 0 | 0 | 750 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + + + @TestRailId:C2859 + Scenario: Multi disbursement with undo last disbursement when auto downpayment is disabled without manual transaction after last downpayment + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT | 01 January 2022 | 2000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "2000" amount and expected disbursement date on "01 January 2022" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 0.0 | 0 | 0 | 1000 | + And Customer makes "AUTOPAY" repayment on "01 January 2022" with 250 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 250.0 | 0 | 0 | 750 | + When Admin sets the business date to "15 January 2022" + When Admin successfully disburse the loan on "15 January 2022" with "1000" EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 15 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 15 January 2022 | | 1500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 31 | 01 February 2022 | | 1000.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 4 | 28 | 01 March 2022 | | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 2000.0 | 0 | 0 | 0 | 2000.0 | 250.0 | 0 | 0 | 1750 | + And Customer makes "AUTOPAY" repayment on "15 January 2022" with 250 EUR transaction amount + When Admin successfully undo last disbursal + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 250.0 | 0 | 0 | 750 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + + + @TestRailId:C2866 + Scenario: Verify backdated disbursement - after down payment, before first installment due date, installment start date calculated by loan disbursement date + When Admin sets the business date to "01 January 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 | + | PIN4_DOWNPAYMENT | 01 January 2023 | 2000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2023" with "2000" amount and expected disbursement date on "01 January 2023" + When Admin sets the business date to "05 January 2023" + When Admin successfully disburse the loan on "05 January 2023" with "1000" EUR transaction amount + And Customer makes "AUTOPAY" repayment on "05 January 2023" with 250 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 05 January 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 05 January 2023 | 05 January 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 05 February 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 05 March 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 05 April 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 250.0 | 0 | 0 | 750 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 05 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 05 January 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + When Admin sets the business date to "08 January 2023" + When Admin successfully disburse the loan on "02 January 2023" with "1000" EUR transaction amount + Then Loan Repayment schedule has 5 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 | + | | | 02 January 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 02 January 2023 | 05 January 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | | | 05 January 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 05 January 2023 | | 1500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 31 | 02 February 2023 | | 1000.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 4 | 28 | 02 March 2023 | | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 5 | 31 | 02 April 2023 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 2000.0 | 0 | 0 | 0 | 2000.0 | 250.0 | 0 | 250 | 1750 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 02 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 05 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 2000.0 | + | 05 January 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 1750.0 | + + @TestRailId:C2867 + Scenario: Verify backdated disbursement - second disbursement placed on after down payment, after first installment paid on due date, and takes place before first installment due date + When Admin sets the business date to "01 January 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 | + | PIN4_DOWNPAYMENT | 01 January 2023 | 2000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2023" with "2000" amount and expected disbursement date on "01 January 2023" + When Admin sets the business date to "05 January 2023" + When Admin successfully disburse the loan on "05 January 2023" with "1000" EUR transaction amount + And Customer makes "AUTOPAY" repayment on "05 January 2023" with 250 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 05 January 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 05 January 2023 | 05 January 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 05 February 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 05 March 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 05 April 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 250.0 | 0 | 0 | 750 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 05 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 05 January 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + When Admin sets the business date to "05 February 2023" + And Customer makes "AUTOPAY" repayment on "05 February 2023" with 250 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 05 January 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 05 January 2023 | 05 January 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 05 February 2023 | 05 February 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 3 | 28 | 05 March 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 05 April 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 500.0 | 0 | 0 | 500 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 05 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 05 January 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 05 February 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 500.0 | + When Admin sets the business date to "10 February 2023" + When Admin successfully disburse the loan on "01 February 2023" with "1000" EUR transaction amount + Then Loan Repayment schedule has 5 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 | + | | | 05 January 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 05 January 2023 | 05 January 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 01 February 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 01 February 2023 | 05 February 2023 | 1500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | 3 | 31 | 05 February 2023 | | 1000.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 4 | 28 | 05 March 2023 | | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 5 | 31 | 05 April 2023 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 2000.0 | 0 | 0 | 0 | 2000.0 | 500.0 | 0 | 250 | 1500 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 05 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 05 January 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 01 February 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1750.0 | + | 05 February 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 1500.0 | + + @TestRailId:C2868 + Scenario: Verify backdated disbursement - after down payment, before first installment due date, installment start date calculated by loan submitted on date + When Admin sets repaymentStartDateType for "PIN4_DOWNPAYMENT" loan product to "SUBMITTED_ON_DATE" + When Admin sets the business date to "01 January 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 | + | PIN4_DOWNPAYMENT | 01 January 2023 | 2000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2023" with "2000" amount and expected disbursement date on "01 January 2023" + When Admin sets the business date to "05 January 2023" + When Admin successfully disburse the loan on "05 January 2023" with "1000" EUR transaction amount + And Customer makes "AUTOPAY" repayment on "05 January 2023" with 250 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 05 January 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 05 January 2023 | 05 January 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 28 | 01 March 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 250.0 | 0 | 0 | 750 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 05 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 05 January 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + When Admin sets the business date to "08 January 2023" + When Admin successfully disburse the loan on "02 January 2023" with "1000" EUR transaction amount + Then Loan Repayment schedule has 5 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 | + | | | 02 January 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 02 January 2023 | 05 January 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | | | 05 January 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 05 January 2023 | | 1500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 31 | 01 February 2023 | | 1000.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 4 | 28 | 01 March 2023 | | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 5 | 31 | 01 April 2023 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 2000.0 | 0 | 0 | 0 | 2000.0 | 250.0 | 0 | 250 | 1750 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 02 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 05 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 2000.0 | + | 05 January 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 1750.0 | + When Admin sets repaymentStartDateType for "PIN4_DOWNPAYMENT" loan product to "DISBURSEMENT_DATE" + + @TestRailId:C2869 + Scenario: Verify correct Loan Repayment EMI Amount is calculated and is rounded off if loan product installmentAmountInMultiplesOf is set + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT | 01 January 2022 | 1250 | 0 | DECLINING_BALANCE | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "1250" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2022" with "1250" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1250.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | | 937.0 | 313.0 | 0.0 | 0.0 | 0.0 | 313.0 | 0.0 | 0.0 | 0.0 | 313.0 | + | 2 | 31 | 01 February 2022 | | 625.0 | 312.0 | 0.0 | 0.0 | 0.0 | 312.0 | 0.0 | 0.0 | 0.0 | 312.0 | + | 3 | 28 | 01 March 2022 | | 313.0 | 312.0 | 0.0 | 0.0 | 0.0 | 312.0 | 0.0 | 0.0 | 0.0 | 312.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 313.0 | 0.0 | 0.0 | 0.0 | 313.0 | 0.0 | 0.0 | 0.0 | 313.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1250.0 | 0 | 0 | 0 | 1250.0 | 0.0 | 0 | 0 | 1250 | + + @TestRailId:C2882 + Scenario: Verify Loan Repayment Due and Overdue events for downpayment + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT | 01 January 2022 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + When Admin runs inline COB job for Loan + Then Loan Repayment Due Business Event is created + When Admin sets the business date to "04 January 2022" + When Admin runs inline COB job for Loan + Then Loan Repayment Overdue Business Event is created + + @TestRailId:C2883 + Scenario: Verify that with multiple disbursement when last disbursement is reverted, downpayment will be reverted too - autopayment disabled + When Admin sets the business date to "01 September 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 | + | PIN4_DOWNPAYMENT | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" EUR transaction amount + When Admin sets the business date to "05 September 2023" + And Customer makes "AUTOPAY" repayment on "05 September 2023" with 500 EUR transaction amount + When Admin sets the business date to "11 September 2023" + When Admin successfully disburse the loan on "11 September 2023" with "500" EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 05 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | | | 11 September 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 11 September 2023 | 05 September 2023 | 1125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 125.0 | 0.0 | 0.0 | + | 3 | 15 | 16 September 2023 | | 750.0 | 375.0 | 0.0 | 0.0 | 0.0 | 375.0 | 125.0 | 125.0 | 0.0 | 250.0 | + | 4 | 15 | 01 October 2023 | | 375.0 | 375.0 | 0.0 | 0.0 | 0.0 | 375.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 5 | 15 | 16 October 2023 | | 0.0 | 375.0 | 0.0 | 0.0 | 0.0 | 375.0 | 0.0 | 0.0 | 0.0 | 375.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1500.0 | 0 | 0.0 | 0 | 1500.0 | 500.0 | 250.0 | 250.0 | 1000.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 05 September 2023 | Repayment | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 11 September 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + When Admin successfully undo last disbursal + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 05 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 05 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0.0 | 0 | 1000.0 | 500.0 | 250.0 | 250.0 | 500.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 05 September 2023 | Repayment | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + + @TestRailId:C2884 + Scenario: Verify that with multiple disbursement when last disbursement is reverted, downpayment will be reverted too - autopayment enabled + When Admin sets the business date to "01 September 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 September 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 September 2023" with "1000" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1000" EUR transaction amount + When Admin sets the business date to "05 September 2023" + And Customer makes "AUTOPAY" repayment on "05 September 2023" with 500 EUR transaction amount + When Admin sets the business date to "11 September 2023" + When Admin successfully disburse the loan on "11 September 2023" with "500" EUR transaction amount + Then Loan Repayment schedule has 5 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 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 11 September 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 11 September 2023 | 05 September 2023 | 1125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 125.0 | 0.0 | 0.0 | + | 3 | 15 | 16 September 2023 | 05 September 2023 | 750.0 | 375.0 | 0.0 | 0.0 | 0.0 | 375.0 | 375.0 | 375.0 | 0.0 | 0.0 | + | 4 | 15 | 01 October 2023 | | 375.0 | 375.0 | 0.0 | 0.0 | 0.0 | 375.0 | 125.0 | 125.0 | 0.0 | 250.0 | + | 5 | 15 | 16 October 2023 | | 0.0 | 375.0 | 0.0 | 0.0 | 0.0 | 375.0 | 0.0 | 0.0 | 0.0 | 375.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1500.0 | 0 | 0.0 | 0 | 1500.0 | 875.0 | 625.0 | 0.0 | 625.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 05 September 2023 | Repayment | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 11 September 2023 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 11 September 2023 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 625.0 | + When Admin successfully undo last disbursal + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 September 2023 | 01 September 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 September 2023 | 05 September 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 3 | 15 | 01 October 2023 | 05 September 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0.0 | 0 | 1000.0 | 750.0 | 500.0 | 0.0 | 250.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 September 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 September 2023 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 05 September 2023 | Repayment | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 250.0 | + + @TestRailId:C2913 + @AdvancedPaymentAllocation + Scenario: Verify that down-payment Installments are available in the repayment schedule for CREATED, APPROVED and DISBURSED states of the loan account + When Admin sets the business date to "01 September 2023" + And Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 September 2023 | 400 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 400.0 | | | 0.0 | | 0.0 | | | | 0.0 | + | 1 | 0 | 01 September 2023 | | 300.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 2 | 15 | 16 September 2023 | | 200.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 3 | 15 | 01 October 2023 | | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 4 | 15 | 16 October 2023 | | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 400.0 | 0 | 0.0 | 0 | 400.0 | 0.0 | 0.0 | 0.0 | 400.0 | + When Admin sets the business date to "02 September 2023" + And Admin successfully approves the loan on "02 September 2023" with "400" amount and expected disbursement date on "02 September 2023" + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 02 September 2023 | | 400.0 | | | 0.0 | | 0.0 | | | | 0.0 | + | 1 | 0 | 02 September 2023 | | 300.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 2 | 15 | 17 September 2023 | | 200.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 3 | 15 | 02 October 2023 | | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 4 | 15 | 17 October 2023 | | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 400.0 | 0 | 0.0 | 0 | 400.0 | 0.0 | 0.0 | 0.0 | 400.0 | + When Admin sets the business date to "03 September 2023" + And Admin successfully disburse the loan on "03 September 2023" with "400" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 03 September 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 03 September 2023 | 03 September 2023 | 300.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 18 September 2023 | | 200.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 3 | 15 | 03 October 2023 | | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 4 | 15 | 18 October 2023 | | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 400.0 | 0 | 0.0 | 0 | 400.0 | 100.0 | 0.0 | 0.0 | 300.0 | + When Admin sets the business date to "04 September 2023" + And Admin successfully disburse the loan on "04 September 2023" with "200" EUR transaction amount + Then Loan Repayment schedule has 5 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 | + | | | 03 September 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 03 September 2023 | 03 September 2023 | 300.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | | | 04 September 2023 | | 200.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 04 September 2023 | 04 September 2023 | 450.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 18 September 2023 | | 300.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | + | 4 | 15 | 03 October 2023 | | 150.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | + | 5 | 15 | 18 October 2023 | | 0.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 600.0 | 0 | 0.0 | 0 | 600.0 | 150.0 | 0.0 | 0.0 | 450.0 | + + @TestRailId:C2938 + Scenario: Multiple disbursements on same day - auto enabled + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 January 2022 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "01 January 2022" due date and 50 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 50.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 50 | 1050.0 | 250.0 | 0 | 0 | 800 | + When Admin sets the business date to "01 February 2022" + When Admin successfully disburse the loan on "01 February 2022" with "200" EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 01 February 2022 | | 200.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 01 February 2022 | 01 February 2022 | 900.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 February 2022 | | 600.0 | 300.0 | 0.0 | 0.0 | 50.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | + | 4 | 28 | 01 March 2022 | | 300.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1200.0 | 0 | 0 | 50 | 1250.0 | 300.0 | 0 | 0 | 950 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 01 February 2022 | Disbursement | 200.0 | 0.0 | 0.0 | 0.0 | 0.0 | 950.0 | + | 01 February 2022 | Down Payment | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 900.0 | + When Admin successfully disburse the loan on "01 February 2022" with "200" 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 | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 01 February 2022 | | 200.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | | | 01 February 2022 | | 200.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 01 February 2022 | 01 February 2022 | 1100.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | + | 3 | 0 | 01 February 2022 | 01 February 2022 | 1050.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | + | 4 | 31 | 01 February 2022 | | 700.0 | 350.0 | 0.0 | 0.0 | 50.0 | 400.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 5 | 28 | 01 March 2022 | | 350.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | + | 6 | 31 | 01 April 2022 | | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1400.0 | 0 | 0 | 50 | 1450.0 | 350.0 | 0 | 0 | 1100 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 01 February 2022 | Disbursement | 200.0 | 0.0 | 0.0 | 0.0 | 0.0 | 950.0 | + | 01 February 2022 | Down Payment | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 900.0 | + | 01 February 2022 | Disbursement | 200.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1100.0 | + | 01 February 2022 | Down Payment | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 1050.0 | + + + @TestRailId:C2939 + Scenario: Multiple disbursements on same day - auto disabled + When Admin sets the business date to "01 January 2022" + 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 | + | PIN4_DOWNPAYMENT | 01 January 2022 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2022" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2022" with "1000" EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "01 January 2022" due date and 50 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 50.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 50 | 1050.0 | 0.0 | 0 | 0 | 1050 | + And Customer makes "DOWN_PAYMENT" repayment on "01 January 2022" with 250 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 February 2022 | | 500.0 | 250.0 | 0.0 | 0.0 | 50.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 3 | 28 | 01 March 2022 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 31 | 01 April 2022 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 50 | 1050.0 | 250.0 | 0 | 0 | 800 | + When Admin sets the business date to "01 February 2022" + When Admin successfully disburse the loan on "01 February 2022" with "200" EUR transaction amount + Then Loan Repayment schedule has 5 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 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 01 February 2022 | | 200.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 01 February 2022 | | 900.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | + | 3 | 31 | 01 February 2022 | | 600.0 | 300.0 | 0.0 | 0.0 | 50.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | + | 4 | 28 | 01 March 2022 | | 300.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 5 | 31 | 01 April 2022 | | 0.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1200.0 | 0 | 0 | 50 | 1250.0 | 250.0 | 0 | 0 | 1000 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 01 February 2022 | Disbursement | 200.0 | 0.0 | 0.0 | 0.0 | 0.0 | 950.0 | + When Admin successfully disburse the loan on "01 February 2022" with "200" 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 | + | | | 01 January 2022 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2022 | 01 January 2022 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 01 February 2022 | | 200.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | | | 01 February 2022 | | 200.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 01 February 2022 | | 1100.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | + | 3 | 0 | 01 February 2022 | | 1050.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | + | 4 | 31 | 01 February 2022 | | 700.0 | 350.0 | 0.0 | 0.0 | 50.0 | 400.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 5 | 28 | 01 March 2022 | | 350.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | + | 6 | 31 | 01 April 2022 | | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1400.0 | 0 | 0 | 50 | 1450.0 | 250.0 | 0 | 0 | 1200 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2022 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 January 2022 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | + | 01 February 2022 | Disbursement | 200.0 | 0.0 | 0.0 | 0.0 | 0.0 | 950.0 | + | 01 February 2022 | Disbursement | 200.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1150.0 | + + @TestRailId:C3017 + Scenario: Verify that repayment schedule is managed properly in case of PIN4 product with two disbursement on the same day + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "100" EUR transaction amount + When Admin successfully disburse the loan on "01 October 2023" with "900" EUR transaction amount + Then Loan Repayment schedule has 5 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 October 2023 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | | | 01 October 2023 | | 900.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 975.0 | 25.0 | 0.0 | 0.0 | 0.0 | 25.0 | 25.0 | 0.0 | 0.0 | 0.0 | + | 2 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 225.0 | 0.0 | 0.0 | 0.0 | 225.0 | 225.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 16 October 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 31 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 15 | 15 November 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 250.0 | 0.0 | 0.0 | 750.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 October 2023 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 01 October 2023 | Down Payment | 25.0 | 25.0 | 0.0 | 0.0 | 0.0 | 75.0 | + | 01 October 2023 | Disbursement | 900.0 | 0.0 | 0.0 | 0.0 | 0.0 | 975.0 | + | 01 October 2023 | Down Payment | 225.0 | 225.0 | 0.0 | 0.0 | 0.0 | 750.0 | + + @TestRailId:C3031 + Scenario: Verify that in case of auto downpayment Loan details / summary.totalRepaymentTransaction has the downpayment amount + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + Then Loan details has the downpayment amount "250" in summary.totalRepaymentTransaction + + @TestRailId:C3061 @AdvancedPaymentAllocation + Scenario: Verify enhanced auto downpayment for overpaid loans - UC1: overpaid amount > second disbursement amount AND overpaid amount > related downpayment amount + When Admin sets the business date to "01 February 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 February 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 February 2024" with "1000" amount and expected disbursement date on "01 February 2024" + When Admin successfully disburse the loan on "01 February 2024" with "500" EUR transaction amount + When Admin sets the business date to "16 February 2024" + And Customer makes "AUTOPAY" repayment on "16 February 2024" with 1000 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 625 overpaid amount + When Admin sets the business date to "20 February 2024" + When Admin successfully disburse the loan on "20 February 2024" with "400" EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 225 overpaid amount + Then Loan Repayment schedule has 5 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 February 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 February 2024 | 01 February 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 February 2024 | 16 February 2024 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | | | 20 February 2024 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 3 | 0 | 20 February 2024 | 20 February 2024 | 550.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 02 March 2024 | 20 February 2024 | 275.0 | 275.0 | 0.0 | 0.0 | 0.0 | 275.0 | 275.0 | 275.0 | 0.0 | 0.0 | + | 5 | 15 | 17 March 2024 | 20 February 2024 | 0.0 | 275.0 | 0.0 | 0.0 | 0.0 | 275.0 | 275.0 | 275.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 900.0 | 0.0 | 0.0 | 0.0 | 900.0 | 900.0 | 550.0 | 0.0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 February 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 February 2024 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 16 February 2024 | Repayment | 1000.0 | 375.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 20 February 2024 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + + @TestRailId:C3062 @AdvancedPaymentAllocation + Scenario: Verify enhanced auto downpayment for overpaid loans - UC2: overpaid amount = second disbursement amount AND overpaid amount > related downpayment amount + When Admin sets the business date to "01 February 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 February 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 February 2024" with "1000" amount and expected disbursement date on "01 February 2024" + When Admin successfully disburse the loan on "01 February 2024" with "500" EUR transaction amount + When Admin sets the business date to "16 February 2024" + And Customer makes "AUTOPAY" repayment on "16 February 2024" with 1000 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 625 overpaid amount + When Admin sets the business date to "20 February 2024" + When Admin successfully disburse the loan on "20 February 2024" with "625" EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan Repayment schedule has 5 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 February 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 February 2024 | 01 February 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 February 2024 | 16 February 2024 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | | | 20 February 2024 | | 625.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 3 | 0 | 20 February 2024 | 20 February 2024 | 719.0 | 156.0 | 0.0 | 0.0 | 0.0 | 156.0 | 156.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 02 March 2024 | 20 February 2024 | 359.0 | 360.0 | 0.0 | 0.0 | 0.0 | 360.0 | 360.0 | 360.0 | 0.0 | 0.0 | + | 5 | 15 | 17 March 2024 | 20 February 2024 | 0.0 | 359.0 | 0.0 | 0.0 | 0.0 | 359.0 | 359.0 | 359.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1125.0 | 0.0 | 0.0 | 0.0 | 1125.0 | 1125.0 | 719.0 | 0.0 | 0.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 February 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 February 2024 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 16 February 2024 | Repayment | 1000.0 | 375.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 20 February 2024 | Disbursement | 625.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + + @TestRailId:C3063 @AdvancedPaymentAllocation + Scenario: Verify enhanced auto downpayment for overpaid loans - UC3: overpaid amount < second disbursement amount BUT overpaid amount > related downpayment amount + When Admin sets the business date to "01 February 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 February 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 February 2024" with "1000" amount and expected disbursement date on "01 February 2024" + When Admin successfully disburse the loan on "01 February 2024" with "500" EUR transaction amount + When Admin sets the business date to "16 February 2024" + And Customer makes "AUTOPAY" repayment on "16 February 2024" with 575 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 200 overpaid amount + When Admin sets the business date to "20 February 2024" + When Admin successfully disburse the loan on "20 February 2024" with "400" EUR transaction amount + Then Loan status will be "ACTIVE" + Then Loan has 200 outstanding amount + Then Loan Repayment schedule has 5 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 February 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 February 2024 | 01 February 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 February 2024 | 16 February 2024 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | | | 20 February 2024 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 3 | 0 | 20 February 2024 | 20 February 2024 | 550.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 02 March 2024 | | 275.0 | 275.0 | 0.0 | 0.0 | 0.0 | 275.0 | 225.0 | 225.0 | 0.0 | 50.0 | + | 5 | 15 | 17 March 2024 | | 0.0 | 275.0 | 0.0 | 0.0 | 0.0 | 275.0 | 125.0 | 125.0 | 0.0 | 150.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 900.0 | 0.0 | 0.0 | 0.0 | 900.0 | 700.0 | 350.0 | 0.0 | 200.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 February 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 February 2024 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 16 February 2024 | Repayment | 575.0 | 375.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 20 February 2024 | Disbursement | 400.0 | 0.0 | 0.0 | 0.0 | 0.0 | 200.0 | + + @TestRailId:C3064 @AdvancedPaymentAllocation + Scenario: Verify enhanced auto downpayment for overpaid loans - UC4: overpaid amount < second disbursement amount AND overpaid amount < related downpayment amount + When Admin sets the business date to "01 February 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 February 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 February 2024" with "1000" amount and expected disbursement date on "01 February 2024" + When Admin successfully disburse the loan on "01 February 2024" with "500" EUR transaction amount + When Admin sets the business date to "16 February 2024" + And Customer makes "AUTOPAY" repayment on "16 February 2024" with 475 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 100 overpaid amount + When Admin sets the business date to "20 February 2024" + When Admin successfully disburse the loan on "20 February 2024" with "600" EUR transaction amount + Then Loan status will be "ACTIVE" + Then Loan has 450 outstanding amount + Then Loan Repayment schedule has 5 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 February 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 February 2024 | 01 February 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 February 2024 | 16 February 2024 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | | | 20 February 2024 | | 600.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 3 | 0 | 20 February 2024 | 20 February 2024 | 700.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | 150.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 02 March 2024 | | 350.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | 125.0 | 125.0 | 0.0 | 225.0 | + | 5 | 15 | 17 March 2024 | | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | 125.0 | 125.0 | 0.0 | 225.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1100.0 | 0.0 | 0.0 | 0.0 | 1100.0 | 650.0 | 250.0 | 0.0 | 450.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 February 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 February 2024 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 16 February 2024 | Repayment | 475.0 | 375.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 20 February 2024 | Disbursement | 600.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 20 February 2024 | Down Payment | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 450.0 | + + @TestRailId:C3065 @AdvancedPaymentAllocation + Scenario: Verify enhanced auto downpayment for overpaid loans - UC5: repayment reverted + When Admin sets the business date to "01 February 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 February 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 February 2024" with "1000" amount and expected disbursement date on "01 February 2024" + When Admin successfully disburse the loan on "01 February 2024" with "500" EUR transaction amount + When Admin sets the business date to "10 February 2024" + And Customer makes "AUTOPAY" repayment on "10 February 2024" with 100 EUR transaction amount + Then Loan has 275 outstanding amount + When Admin sets the business date to "16 February 2024" + And Customer makes "AUTOPAY" repayment on "16 February 2024" with 375 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 100 overpaid amount + When Admin sets the business date to "20 February 2024" + When Admin successfully disburse the loan on "20 February 2024" with "600" EUR transaction amount + Then Loan status will be "ACTIVE" + Then Loan has 450 outstanding amount + When Customer undo "1"th "Repayment" transaction made on "16 February 2024" + Then Loan Repayment schedule has 5 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 February 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 February 2024 | 01 February 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 February 2024 | 20 February 2024 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 100.0 | 25.0 | 0.0 | + | | | 20 February 2024 | | 600.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 3 | 0 | 20 February 2024 | | 700.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | 25.0 | 0.0 | 0.0 | 125.0 | + | 4 | 15 | 02 March 2024 | | 350.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | + | 5 | 15 | 17 March 2024 | | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1100.0 | 0.0 | 0.0 | 0.0 | 1100.0 | 275.0 | 100.0 | 25.0 | 825.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 February 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | false | + | 01 February 2024 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | false | + | 10 February 2024 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 275.0 | false | + | 16 February 2024 | Repayment | 375.0 | 275.0 | 0.0 | 0.0 | 0.0 | 0.0 | true | + | 20 February 2024 | Disbursement | 600.0 | 0.0 | 0.0 | 0.0 | 0.0 | 875.0 | false | + | 20 February 2024 | Down Payment | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 825.0 | false | diff --git a/fineract-e2e-tests-runner/src/test/resources/features/LoanProduct.feature b/fineract-e2e-tests-runner/src/test/resources/features/LoanProduct.feature new file mode 100644 index 00000000000..271f7947176 --- /dev/null +++ b/fineract-e2e-tests-runner/src/test/resources/features/LoanProduct.feature @@ -0,0 +1,183 @@ +@Product +Feature: LoanProduct + + @Scenario1 @TestRailId:C52 + Scenario: As a user I would like to fully repay the loan in time + When Admin sets the business date to "12 December 2021" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "12 December 2021", with Principal: "1000", a loanTermFrequency: 1 months, and numberOfRepayments: 1 + And Admin successfully approves the loan on "12 December 2021" with "1000" amount and expected disbursement date on "1 July 2022" + And Admin successfully disburse the loan on "12 December 2021" with "1000" EUR transaction amount + Then Loan has 1000 outstanding amount + When Admin sets the business date to "30 December 2021" + And Customer makes "AUTOPAY" repayment on "30 December 2021" with 1000 EUR transaction amount + Then Repayment transaction is created with 1000 amount and "AUTOPAY" type + Then Loan has 0 outstanding amount + + @Scenario2 @TestRailId:C53 + Scenario: As a user I would like to fully repay a loan which was disbursed 2 times + When Admin sets the business date to "1 June 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 June 2022", with Principal: "1000", a loanTermFrequency: 1 months, and numberOfRepayments: 1 + And Admin successfully approves the loan on "1 June 2022" with "1000" amount and expected disbursement date on "1 July 2022" + And Admin successfully disburse the loan on "1 June 2022" with "1000" EUR transaction amount + Then Loan has 1000 outstanding amount + When Admin sets the business date to "5 June 2022" + And Admin successfully disburse the loan on "5 June 2022" with "500" EUR transaction amount + Then Loan has 1500 outstanding amount + When Admin sets the business date to "1 July 2022" + And Customer makes "AUTOPAY" repayment on "1 July 2022" with 1500 EUR transaction amount + Then Repayment transaction is created with 1500 amount and "AUTOPAY" type + Then Loan has 0 outstanding amount + + @Scenario3 @TestRailId:C54 + Scenario: As a user I would like to fully repay a multi disbursed loan with 2 repayments + When Admin sets the business date to "1 June 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 June 2022", with Principal: "1000", a loanTermFrequency: 1 months, and numberOfRepayments: 1 + And Admin successfully approves the loan on "1 June 2022" with "1000" amount and expected disbursement date on "1 July 2022" + And Admin successfully disburse the loan on "1 June 2022" with "1000" EUR transaction amount + Then Loan has 1000 outstanding amount + When Admin sets the business date to "15 June 2022" + And Customer makes "AUTOPAY" repayment on "15 June 2022" with 500 EUR transaction amount + Then Repayment transaction is created with 500 amount and "AUTOPAY" type + Then Loan has 500 outstanding amount + When Admin runs the Increase Business Date by 1 day job + And Admin successfully disburse the loan on "16 June 2022" with "500" EUR transaction amount + Then Loan has 1000 outstanding amount + When Admin sets the business date to "15 July 2022" + And Customer makes "AUTOPAY" repayment on "15 July 2022" with 1000 EUR transaction amount + Then Loan has 0 outstanding amount + + @Scenario4 @TestRailId:C55 + Scenario: As a user I would like to multi disburse a loan which was previously fully paid + When Admin sets the business date to "1 June 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 June 2022", with Principal: "1000", a loanTermFrequency: 1 months, and numberOfRepayments: 1 + And Admin successfully approves the loan on "1 June 2022" with "1000" amount and expected disbursement date on "1 July 2022" + And Admin successfully disburse the loan on "1 June 2022" with "1000" EUR transaction amount + Then Loan has 1000 outstanding amount + When Admin sets the business date to "15 June 2022" + And Customer makes "AUTOPAY" repayment on "15 June 2022" with 1000 EUR transaction amount + Then Repayment transaction is created with 1000 amount and "AUTOPAY" type + Then Loan has 0 outstanding amount + When Admin runs the Increase Business Date by 1 day job + And Admin successfully disburse the loan on "16 June 2022" with "500" EUR transaction amount + Then Loan has 500 outstanding amount + When Admin sets the business date to "15 July 2022" + And Customer makes "AUTOPAY" repayment on "15 July 2022" with 500 EUR transaction amount + Then Loan has 0 outstanding amount + + @Scenario5 @TestRailId:C57 + Scenario: As a user I would like to fully repay a loan and check a repayment reversal with NSF fee + When Admin sets the business date to "1 June 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 June 2022", with Principal: "1000", a loanTermFrequency: 1 months, and numberOfRepayments: 1 + And Admin successfully approves the loan on "1 June 2022" with "1000" amount and expected disbursement date on "1 July 2022" + And Admin successfully disburse the loan on "1 June 2022" with "1000" EUR transaction amount + Then Loan has 1000 outstanding amount + When Admin sets the business date to "15 June 2022" + And Customer makes "AUTOPAY" repayment on "15 June 2022" with 1000 EUR transaction amount + Then Repayment transaction is created with 1000 amount and "AUTOPAY" type + Then Loan has 0 outstanding amount + When Customer makes a repayment undo on "15 June 2022" + Then Loan has 1000 outstanding amount + When Admin sets the business date to "18 June 2022" + And Admin adds an NSF fee because of payment bounce with "18 June 2022" transaction date + Then Loan has 1010 outstanding amount + And Customer makes "AUTOPAY" repayment on "18 June 2022" with 1010 EUR transaction amount + Then Loan has 0 outstanding amount + + @Scenario6 @TestRailId:C58 + Scenario: As a user I would like to repay the half amount of the loan and check a repayment reversal with NSF fee + When Admin sets the business date to "1 June 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 June 2022", with Principal: "1000", a loanTermFrequency: 1 months, and numberOfRepayments: 1 + And Admin successfully approves the loan on "1 June 2022" with "1000" amount and expected disbursement date on "1 July 2022" + And Admin successfully disburse the loan on "1 June 2022" with "1000" EUR transaction amount + Then Loan has 1000 outstanding amount + When Admin sets the business date to "15 June 2022" + And Customer makes "AUTOPAY" repayment on "15 June 2022" with 500 EUR transaction amount + Then Repayment transaction is created with 500 amount and "AUTOPAY" type + Then Loan has 500 outstanding amount + When Customer makes a repayment undo on "15 June 2022" + Then Loan has 1000 outstanding amount + When Admin sets the business date to "18 June 2022" + And Admin adds an NSF fee because of payment bounce with "18 June 2022" transaction date + Then Loan has 1010 outstanding amount + And Customer makes "AUTOPAY" repayment on "18 June 2022" with 1010 EUR transaction amount + Then Loan has 0 outstanding amount + + @Scenario7 @TestRailId:C59 + Scenario: As a user I would like to fully repay a loan then reverse the repayment + add an NSF fee after the 1 month period + When Admin sets the business date to "1 June 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 June 2022", with Principal: "1000", a loanTermFrequency: 1 months, and numberOfRepayments: 1 + And Admin successfully approves the loan on "1 June 2022" with "1000" amount and expected disbursement date on "1 July 2022" + And Admin successfully disburse the loan on "1 June 2022" with "1000" EUR transaction amount + Then Loan has 1000 outstanding amount + When Admin sets the business date to "1 July 2022" + And Customer makes "AUTOPAY" repayment on "1 July 2022" with 1000 EUR transaction amount + Then Repayment transaction is created with 1000 amount and "AUTOPAY" type + Then Loan has 0 outstanding amount + When Customer makes a repayment undo on "1 July 2022" + Then Loan has 1000 outstanding amount + When Admin sets the business date to "5 July 2022" + And Admin adds an NSF fee because of payment bounce with "5 July 2022" transaction date + Then Loan has 1010 outstanding amount + And Customer makes "AUTOPAY" repayment on "5 July 2022" with 1010 EUR transaction amount + Then Loan has 0 outstanding amount + + @Scenario8 @TestRailId:C60 + Scenario: As a user I would like to repay the half amount of the loan and do a refund + When Admin sets the business date to "1 June 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 June 2022", with Principal: "1000", a loanTermFrequency: 1 months, and numberOfRepayments: 1 + And Admin successfully approves the loan on "1 June 2022" with "1000" amount and expected disbursement date on "1 July 2022" + And Admin successfully disburse the loan on "1 June 2022" with "1000" EUR transaction amount + Then Loan has 1000 outstanding amount + When Admin sets the business date to "25 June 2022" + And Customer makes "AUTOPAY" repayment on "25 June 2022" with 500 EUR transaction amount + Then Repayment transaction is created with 500 amount and "AUTOPAY" type + Then Loan has 500 outstanding amount + When Admin sets the business date to "1 July 2022" + When Refund happens on "1 July 2022" with 500 EUR transaction amount + Then Loan has 0 outstanding amount + + @Scenario9 @TestRailId:C61 + Scenario: As a user I would like to repay the half amount of the loan and do a refund + repayment reversal on the repayment + When Admin sets the business date to "1 June 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 June 2022", with Principal: "1000", a loanTermFrequency: 1 months, and numberOfRepayments: 1 + And Admin successfully approves the loan on "1 June 2022" with "1000" amount and expected disbursement date on "1 July 2022" + And Admin successfully disburse the loan on "1 June 2022" with "1000" EUR transaction amount + Then Loan has 1000 outstanding amount + And Admin sets the business date to "25 June 2022" + And Customer makes "AUTOPAY" repayment on "25 June 2022" with 500 EUR transaction amount + Then Repayment transaction is created with 500 amount and "AUTOPAY" type + Then Loan has 500 outstanding amount + When Admin sets the business date to "1 July 2022" + When Refund happens on "1 July 2022" with 500 EUR transaction amount + Then Loan has 0 outstanding amount + When Customer makes a repayment undo on "25 June 2022" + Then Loan has 500 outstanding amount + + @Scenario10 @TestRailId:C62 + Scenario: As a user I would like to repay the half amount of the loan and do a refund + repayment reversal + refund reversal + When Admin sets the business date to "1 June 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 June 2022", with Principal: "1000", a loanTermFrequency: 1 months, and numberOfRepayments: 1 + And Admin successfully approves the loan on "1 June 2022" with "1000" amount and expected disbursement date on "1 July 2022" + And Admin successfully disburse the loan on "1 June 2022" with "1000" EUR transaction amount + Then Loan has 1000 outstanding amount + When Admin sets the business date to "25 June 2022" + And Customer makes "AUTOPAY" repayment on "25 June 2022" with 500 EUR transaction amount + Then Repayment transaction is created with 500 amount and "AUTOPAY" type + Then Loan has 500 outstanding amount + When Admin sets the business date to "1 July 2022" + When Refund happens on "1 July 2022" with 500 EUR transaction amount + Then Loan has 0 outstanding amount + When Customer makes a repayment undo on "25 June 2022" + Then Loan has 500 outstanding amount + When Refund undo happens on "1 July 2022" + Then Loan has 1000 outstanding amount diff --git a/fineract-e2e-tests-runner/src/test/resources/features/LoanReAging.feature b/fineract-e2e-tests-runner/src/test/resources/features/LoanReAging.feature new file mode 100644 index 00000000000..7a7c73a7b0a --- /dev/null +++ b/fineract-e2e-tests-runner/src/test/resources/features/LoanReAging.feature @@ -0,0 +1,572 @@ +@LoanReAgingFeature +Feature: LoanReAging + + @TestRailId:C3050 @AdvancedPaymentAllocation + Scenario: Verify that Loan re-aging transaction happy path works properly + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "1000" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 31 January 2024 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + When Admin sets the business date to "20 February 2024" + When Admin runs inline COB job for Loan + Then Admin checks that delinquency range is: "RANGE_30" and has delinquentDate "2024-01-19" + When Admin creates a Loan re-aging transaction with the following data: + | frequencyNumber | frequencyType | startDate | numberOfInstallments | + | 1 | MONTHS | 01 March 2024 | 6 | + Then Loan Repayment schedule has 10 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | 20 February 2024| 750.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2024 | 20 February 2024| 750.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2024 | 20 February 2024| 750.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 5 | 15 | 01 March 2024 | | 625.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 6 | 31 | 01 April 2024 | | 500.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 7 | 30 | 01 May 2024 | | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 8 | 31 | 01 June 2024 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 9 | 30 | 01 July 2024 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 10 | 31 | 01 August 2024 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 250.0| 0.0 | 0.0 | 750.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2024 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | + | 01 January 2024 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | false | + | 20 February 2024 | Re-age | 750.0 | 750.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | + Then Admin checks that delinquency range is: "NO_DELINQUENCY" and has delinquentDate "" + + @TestRailId:C3051 @AdvancedPaymentAllocation + Scenario: Verify that Loan re-aging transaction made by Loan external ID happy path works properly + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "1000" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 31 January 2024 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + When Admin sets the business date to "20 February 2024" + When Admin creates a Loan re-aging transaction by Loan external ID with the following data: + | frequencyNumber | frequencyType | startDate | numberOfInstallments | + | 30 | DAYS | 10 March 2024 | 2 | + 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 | + | | | 01 January 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | 20 February 2024| 750.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2024 | 20 February 2024| 750.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2024 | 20 February 2024| 750.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 5 | 24 | 10 March 2024 | | 375.0 | 375.0 | 0.0 | 0.0 | 0.0 | 375.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 6 | 30 | 09 April 2024 | | 0.0 | 375.0 | 0.0 | 0.0 | 0.0 | 375.0 | 0.0 | 0.0 | 0.0 | 375.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2024 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | + | 01 January 2024 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | false | + | 20 February 2024 | Re-age | 750.0 | 750.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | + + @TestRailId:C3052 @AdvancedPaymentAllocation + Scenario: Verify that Loan re-aging transaction undo works properly + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "1000" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 31 January 2024 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + When Admin sets the business date to "20 February 2024" + When Admin runs inline COB job for Loan + Then Admin checks that delinquency range is: "RANGE_30" and has delinquentDate "2024-01-19" + When Admin creates a Loan re-aging transaction by Loan external ID with the following data: + | frequencyNumber | frequencyType | startDate | numberOfInstallments | + | 1 | DAYS | 10 March 2024 | 1 | + When Admin sets the business date to "25 February 2024" + Then Loan Repayment schedule has 5 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | 20 February 2024| 750.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2024 | 20 February 2024| 750.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2024 | 20 February 2024| 750.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 5 | 24 | 10 March 2024 | | 0.0 | 750.0 | 0.0 | 0.0 | 0.0 | 750.0 | 0.0 | 0.0 | 0.0 | 750.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2024 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | + | 01 January 2024 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | false | + | 20 February 2024 | Re-age | 750.0 | 750.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | + Then Admin checks that delinquency range is: "NO_DELINQUENCY" and has delinquentDate "" + When Admin successfully undo Loan re-aging transaction + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 31 January 2024 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2024 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | + | 01 January 2024 | Down Payment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | false | + | 20 February 2024 | Re-age | 750.0 | 750.0 | 0.0 | 0.0 | 0.0 | 0.0 | true | + Then Admin checks that delinquency range is: "RANGE_30" and has delinquentDate "2024-01-19" + + + @TestRailId:C3053 @AdvancedPaymentAllocation + Scenario: Verify that Loan re-aging transaction works properly when chargeback happens after re-aging + When Admin sets the business date to "01 January 2024" + 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 January 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "1000" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 January 2024 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 31 January 2024 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + When Admin sets the business date to "20 February 2024" + When Admin runs inline COB job for Loan + Then Admin checks that delinquency range is: "RANGE_30" and has delinquentDate "2024-01-04" + And Customer makes "AUTOPAY" repayment on "01 January 2024" with 250 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 31 January 2024 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2024 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | + | 01 January 2024 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | false | + When Admin sets the business date to "21 February 2024" + When Admin creates a Loan re-aging transaction by Loan external ID with the following data: + | frequencyNumber | frequencyType | startDate | numberOfInstallments | + | 2 | MONTHS | 10 March 2024 | 3 | + Then Loan Repayment schedule has 7 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | 21 February 2024| 750.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2024 | 21 February 2024| 750.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2024 | 21 February 2024| 750.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 5 | 24 | 10 March 2024 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 6 | 61 | 10 May 2024 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 7 | 61 | 10 July 2024 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2024 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | + | 01 January 2024 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | false | + | 21 February 2024 | Re-age | 750.0 | 750.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | + When Admin sets the business date to "25 February 2024" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 250 EUR transaction amount + Then Loan Repayment schedule has 7 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | 21 February 2024| 750.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2024 | 21 February 2024| 750.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2024 | 21 February 2024| 750.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 5 | 24 | 10 March 2024 | | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 6 | 61 | 10 May 2024 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 7 | 61 | 10 July 2024 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1250.0 | 0.0 | 0.0 | 0.0 | 1250.0 | 250.0| 0.0 | 0.0 | 1000.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2024 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | + | 01 January 2024 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | false | + | 21 February 2024 | Re-age | 750.0 | 750.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | + | 25 February 2024 | Chargeback | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | + + @Skip @TestRailId:C3054 @AdvancedPaymentAllocation + Scenario: Verify Loan re-aging transaction - reverse-replay scenario 1 + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2024 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "500" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "500" EUR transaction amount + When Admin sets the business date to "27 February 2024" + When Admin creates a Loan re-aging transaction with the following data: + | frequencyType | startDate | numberOfInstallments | + | MONTHS | 01 March 2024 | 6 | + And Customer makes "AUTOPAY" repayment on "01 February 2024" with 125 EUR transaction amount + When Admin successfully undo Loan re-aging transaction +# TODO fill with proper expected data +# Then Loan Repayment schedule has 10 periods, with the following data for periods: +# | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | +# | | | 01 January 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | +# | 1 | 0 | 01 January 2024 | 01 January 2024 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | +# | 2 | 15 | 16 January 2024 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | +# | 3 | 15 | 31 January 2024 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | +# | 4 | 15 | 15 February 2024 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | +# | 5 | 15 | 01 March 2024 | | 750.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | +# | 6 | 15 | 01 April 2024 | | 625.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | +# | 7 | 15 | 01 May 2024 | | 500.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | +# | 8 | 15 | 01 June 2024 | | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | +# | 9 | 15 | 01 July 2024 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | +# | 10 | 15 | 01 August 2024 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | +# Then Loan Repayment schedule has the following data in Total row: +# | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | +# | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 0.0 | 0.0 | 0.0 | 1020.0 | +# Then Loan Transactions tab has the following data: +# | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | +# | 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | false | +# | 01 January 2024 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | false | +# | 01 February 2024 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 250.0 | false | +# | 27 February 2024 | Re-age | 375.0 | 375.0 | 0.0 | 0.0 | 0.0 | 125.0 | true | +# Then Admin checks that delinquency range is: "RANGE_30" and has delinquentDate "2024-01-19" + + @Skip @TestRailId:C3055 @AdvancedPaymentAllocation + Scenario: Verify Loan re-aging transaction - reverse-replay scenario 2 + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2024 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "500" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "500" EUR transaction amount + When Admin sets the business date to "27 February 2024" + When Admin creates a Loan re-aging transaction with the following data: + | frequencyType | startDate | numberOfInstallments | + | MONTHS | 01 March 2024 | 6 | + When Customer undo "1"th "Down Payment" transaction made on "01 January 2024" + When Admin successfully undo Loan re-aging transaction + # TODO fill with proper expected data and checks + + @TestRailId:C3056 @AdvancedPaymentAllocation + Scenario: Verify that Loan re-aging transaction - chargeback before maturity and prior to re-aging + When Admin sets the business date to "01 January 2024" + 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 January 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "1000" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 January 2024 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 31 January 2024 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + When Admin sets the business date to "01 January 2024" + And Customer makes "AUTOPAY" repayment on "01 January 2024" with 250 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 31 January 2024 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2024 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | + | 01 January 2024 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | false | + When Admin sets the business date to "02 February 2024" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 125 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 31 January 2024 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 375.0 | 0.0 | 0.0 | 0.0 | 375.0 | 0.0 | 0.0 | 0.0 | 375.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2024 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | + | 01 January 2024 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | false | + | 02 February 2024 | Chargeback | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 875.0 | false | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1125.0 | 0.0 | 0.0 | 0.0 | 1125.0 | 250.0| 0.0 | 0.0 | 875.0 | + When Admin sets the business date to "21 February 2024" + When Admin creates a Loan re-aging transaction by Loan external ID with the following data: + | frequencyNumber | frequencyType | startDate | numberOfInstallments | + | 2 | MONTHS | 10 March 2024 | 3 | + Then Loan Repayment schedule has 7 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | 21 February 2024| 750.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2024 | 21 February 2024| 750.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2024 | 21 February 2024| 875.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 5 | 24 | 10 March 2024 | | 583.33 | 291.67 | 0.0 | 0.0 | 0.0 | 291.67| 0.0 | 0.0 | 0.0 | 291.67 | + | 6 | 61 | 10 May 2024 | | 291.66 | 291.67 | 0.0 | 0.0 | 0.0 | 291.67| 0.0 | 0.0 | 0.0 | 291.67 | + | 7 | 61 | 10 July 2024 | | 0.0 | 291.66 | 0.0 | 0.0 | 0.0 | 291.66| 0.0 | 0.0 | 0.0 | 291.66 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2024 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | + | 01 January 2024 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | false | + | 02 February 2024 | Chargeback | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 875.0 | false | + | 21 February 2024 | Re-age | 875.0 | 875.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | + + @TestRailId:C3057 @AdvancedPaymentAllocation + Scenario: Verify that Loan re-aging transaction - chargeback after maturity date and prior to re-aging + When Admin sets the business date to "01 January 2024" + 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 January 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "1000" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 January 2024 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 31 January 2024 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + When Admin sets the business date to "01 January 2024" + And Customer makes "AUTOPAY" repayment on "01 January 2024" with 250 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 31 January 2024 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2024 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | + | 01 January 2024 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | false | + When Admin sets the business date to "20 February 2024" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 125 EUR transaction amount + Then Loan Repayment schedule has 5 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 31 January 2024 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 5 | 20 February 2024 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2024 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | + | 01 January 2024 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | false | + | 20 February 2024 | Chargeback | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 875.0 | false | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1125.0 | 0.0 | 0.0 | 0.0 | 1125.0 | 250.0| 0.0 | 0.0 | 875.0 | + When Admin sets the business date to "21 February 2024" + When Admin creates a Loan re-aging transaction by Loan external ID with the following data: + | frequencyNumber | frequencyType | startDate | numberOfInstallments | + | 2 | MONTHS | 10 March 2024 | 3 | + Then Loan Repayment schedule has 8 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | 21 February 2024| 750.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2024 | 21 February 2024| 750.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2024 | 21 February 2024| 750.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 5 | 5 | 20 February 2024 | 21 February 2024| 875.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 6 | 19 | 10 March 2024 | | 583.33 | 291.67 | 0.0 | 0.0 | 0.0 | 291.67| 0.0 | 0.0 | 0.0 | 291.67 | + | 7 | 61 | 10 May 2024 | | 291.66 | 291.67 | 0.0 | 0.0 | 0.0 | 291.67| 0.0 | 0.0 | 0.0 | 291.67 | + | 8 | 61 | 10 July 2024 | | 0.0 | 291.66 | 0.0 | 0.0 | 0.0 | 291.66| 0.0 | 0.0 | 0.0 | 291.66 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2024 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | + | 01 January 2024 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | false | + | 20 February 2024 | Chargeback | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 875.0 | false | + | 21 February 2024 | Re-age | 875.0 | 875.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | + + @TestRailId:C3058 @AdvancedPaymentAllocation + Scenario: Verify that Loan re-aging transaction - chargeback after maturity date and prior to re-aging with charge N+1 installment + When Admin sets the business date to "01 January 2024" + 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 | + | PIN4_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 January 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "1000" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "1000" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 January 2024 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 31 January 2024 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + When Admin sets the business date to "01 January 2024" + And Customer makes "AUTOPAY" repayment on "01 January 2024" with 250 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 31 January 2024 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2024 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | + | 01 January 2024 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | false | + When Admin sets the business date to "26 February 2024" + When Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 125 EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "26 February 2024" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 31 January 2024 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 11 | 26 February 2024 | | 0.0 | 125.0 | 0.0 | 0.0 | 20.0 | 145.0 | 0.0 | 0.0 | 0.0 | 145.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2024 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | + | 01 January 2024 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | false | + | 26 February 2024 | Chargeback | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 875.0 | false | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1125.0 | 0.0 | 0.0 | 20.0 | 1145.0 | 250.0| 0.0 | 0.0 | 895.0 | + When Admin sets the business date to "27 February 2024" + When Admin makes a charge adjustment for the last "LOAN_NSF_FEE" type charge which is due on "26 February 2024" with 20 EUR transaction amount and externalId "" + When Admin creates a Loan re-aging transaction by Loan external ID with the following data: + | frequencyNumber | frequencyType | startDate | numberOfInstallments | + | 2 | MONTHS | 10 March 2024 | 3 | + Then Loan Repayment schedule has 8 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | 27 February 2024| 730.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 20.0 | 0.0 | + | 3 | 15 | 31 January 2024 | 27 February 2024| 730.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2024 | 27 February 2024| 730.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 5 | 11 | 26 February 2024 | | 855.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + | 6 | 13 | 10 March 2024 | | 570.0 | 285.0 | 0.0 | 0.0 | 0.0 | 285.0 | 0.0 | 0.0 | 0.0 | 285.0 | + | 7 | 61 | 10 May 2024 | | 285.0 | 285.0 | 0.0 | 0.0 | 0.0 | 285.0 | 0.0 | 0.0 | 0.0 | 285.0 | + | 8 | 61 | 10 July 2024 | | 0.0 | 285.0 | 0.0 | 0.0 | 0.0 | 285.0 | 0.0 | 0.0 | 0.0 | 285.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2024 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | + | 01 January 2024 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | false | + | 26 February 2024 | Chargeback | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 875.0 | false | + | 27 February 2024 | Charge Adjustment| 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 855.0 | false | + | 27 February 2024 | Re-age | 855.0 | 855.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1125.0 | 0.0 | 0.0 | 20.0 | 1145.0 | 270.0| 0.0 | 20.0 | 875.0 | + + @TestRailId:C3059 @AdvancedPaymentAllocation + Scenario: Verify Loan re-aging transaction - partial principal payment scenario + undo re-ageing + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2024 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "500" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "500" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 3 | 15 | 31 January 2024 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + When Admin sets the business date to "16 January 2024" + And Customer makes "AUTOPAY" repayment on "16 January 2024" with 50 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 50.0 | 0.0 | 0.0 | 75.0 | + | 3 | 15 | 31 January 2024 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | false | + | 01 January 2024 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | false | + | 16 January 2024 | Repayment | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 325.0 | false | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 175.0 | 0.0 | 0.0 | 325.0 | + When Admin sets the business date to "27 February 2024" + When Admin creates a Loan re-aging transaction with the following data: + | frequencyNumber | frequencyType | startDate | numberOfInstallments | + | 1 | MONTHS | 01 March 2024 | 6 | + Then Loan Repayment schedule has 10 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 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | 27 February 2024| 325.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2024 | 27 February 2024| 325.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2024 | 27 February 2024| 325.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 5 | 15 | 01 March 2024 | | 271.0 | 54.0 | 0.0 | 0.0 | 0.0 | 54.0 | 0.0 | 0.0 | 0.0 | 54.0 | + | 6 | 31 | 01 April 2024 | | 217.0 | 54.0 | 0.0 | 0.0 | 0.0 | 54.0 | 0.0 | 0.0 | 0.0 | 54.0 | + | 7 | 30 | 01 May 2024 | | 163.0 | 54.0 | 0.0 | 0.0 | 0.0 | 54.0 | 0.0 | 0.0 | 0.0 | 54.0 | + | 8 | 31 | 01 June 2024 | | 109.0 | 54.0 | 0.0 | 0.0 | 0.0 | 54.0 | 0.0 | 0.0 | 0.0 | 54.0 | + | 9 | 30 | 01 July 2024 | | 55.0 | 54.0 | 0.0 | 0.0 | 0.0 | 54.0 | 0.0 | 0.0 | 0.0 | 54.0 | + | 10 | 31 | 01 August 2024 | | 0.0 | 55.0 | 0.0 | 0.0 | 0.0 | 55.0 | 0.0 | 0.0 | 0.0 | 55.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | false | + | 01 January 2024 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | false | + | 16 January 2024 | Repayment | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 325.0 | false | + | 27 February 2024 | Re-age | 325.0 | 325.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | + When Admin sets the business date to "29 February 2024" + When Admin successfully undo Loan re-aging transaction + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 50.0 | 0.0 | 0.0 | 75.0 | + | 3 | 15 | 31 January 2024 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | false | + | 01 January 2024 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | false | + | 16 January 2024 | Repayment | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 325.0 | false | + | 27 February 2024 | Re-age | 325.0 | 325.0 | 0.0 | 0.0 | 0.0 | 0.0 | true | + + @TestRailId:C3091 @AdvancedPaymentAllocation + Scenario: Verify Loan re-age transaction - Event check + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2024 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "500" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "500" EUR transaction amount + When Admin sets the business date to "27 February 2024" + When Admin runs inline COB job for Loan + Then LoanDelinquencyRangeChangeBusinessEvent is created + When Admin creates a Loan re-aging transaction with the following data: + | frequencyNumber | frequencyType | startDate | numberOfInstallments | + | 1 | MONTHS | 01 March 2024 | 6 | + Then LoanDelinquencyRangeChangeBusinessEvent is created + Then LoanReAgeBusinessEvent is created diff --git a/fineract-e2e-tests-runner/src/test/resources/features/LoanReAmortization.feature b/fineract-e2e-tests-runner/src/test/resources/features/LoanReAmortization.feature new file mode 100644 index 00000000000..2f2c5019101 --- /dev/null +++ b/fineract-e2e-tests-runner/src/test/resources/features/LoanReAmortization.feature @@ -0,0 +1,377 @@ +@LoanReAmortizationFeature +Feature: LoanReAmortization + + @TestRailId:C3069 @AdvancedPaymentAllocation + Scenario: Verify Loan re-amortization transaction - re-amortization happy path + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2024 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "500" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "500" EUR transaction amount + When Admin sets the business date to "25 January 2024" + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 3 | 15 | 31 January 2024 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 125.0 | 0.0 | 0.0 | 375.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2024 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + When When Admin creates a Loan re-amortization transaction on current business date + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | 25 January 2024 | 375.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2024 | | 187.0 | 188.0 | 0.0 | 0.0 | 0.0 | 188.0 | 0.0 | 0.0 | 0.0 | 188.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 187.0 | 0.0 | 0.0 | 0.0 | 187.0 | 0.0 | 0.0 | 0.0 | 187.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 125.0 | 0.0 | 0.0 | 375.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2024 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 25 January 2024 | Re-amortize | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 0.0 | + + @TestRailId:C3070 @AdvancedPaymentAllocation + Scenario: Verify Loan re-amortization transaction - re-amortization happy path with loan externalId + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2024 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "500" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "500" EUR transaction amount + When Admin sets the business date to "25 January 2024" + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 3 | 15 | 31 January 2024 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 125.0 | 0.0 | 0.0 | 375.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2024 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + When When Admin creates a Loan re-amortization transaction on current business date by loan external ID + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | 25 January 2024 | 375.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2024 | | 187.0 | 188.0 | 0.0 | 0.0 | 0.0 | 188.0 | 0.0 | 0.0 | 0.0 | 188.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 187.0 | 0.0 | 0.0 | 0.0 | 187.0 | 0.0 | 0.0 | 0.0 | 187.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 125.0 | 0.0 | 0.0 | 375.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2024 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 25 January 2024 | Re-amortize | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 0.0 | + + @TestRailId:C3071 @AdvancedPaymentAllocation + Scenario: Verify Loan re-amortization transaction - re-amortization undo happy path + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2024 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "500" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "500" EUR transaction amount + When Admin sets the business date to "25 January 2024" + When When Admin creates a Loan re-amortization transaction on current business date + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | 25 January 2024 | 375.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2024 | | 187.0 | 188.0 | 0.0 | 0.0 | 0.0 | 188.0 | 0.0 | 0.0 | 0.0 | 188.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 187.0 | 0.0 | 0.0 | 0.0 | 187.0 | 0.0 | 0.0 | 0.0 | 187.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 125.0 | 0.0 | 0.0 | 375.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | false | + | 01 January 2024 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | false | + | 25 January 2024 | Re-amortize | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | + When Admin sets the business date to "26 January 2024" + When When Admin undo Loan re-amortization transaction on current business date + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 3 | 15 | 31 January 2024 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 125.0 | 0.0 | 0.0 | 375.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | false | + | 01 January 2024 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | false | + | 25 January 2024 | Re-amortize | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 0.0 | true | + Then Admin checks that delinquency range is: "RANGE_3" and has delinquentDate "2024-01-19" + + @TestRailId:C3072 @AdvancedPaymentAllocation + Scenario: Verify Loan re-amortization transaction - delinquency calculation triggered upon re-amortization transaction + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2024 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "500" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "500" EUR transaction amount + When Admin sets the business date to "24 January 2024" + When Admin runs inline COB job for Loan + Then Admin checks that delinquency range is: "RANGE_3" and has delinquentDate "2024-01-19" + When Admin sets the business date to "25 January 2024" + When When Admin creates a Loan re-amortization transaction on current business date + Then Admin checks that delinquency range is: "NO_DELINQUENCY" and has delinquentDate "" + + @TestRailId:C3073 @AdvancedPaymentAllocation + Scenario: Verify Loan re-amortization transaction - UC1: re-amortization after charge applied on loan + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2024 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "500" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "500" EUR transaction amount + When Admin sets the business date to "16 January 2024" + When Admin adds "LOAN_NSF_FEE" due date charge with "16 January 2024" due date and 10 EUR transaction amount + When Admin sets the business date to "25 January 2024" + When When Admin creates a Loan re-amortization transaction on current business date + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | | 375.0 | 0.0 | 0.0 | 0.0 | 10.0 | 10.0 | 0.0 | 0.0 | 0.0 | 10.0 | + | 3 | 15 | 31 January 2024 | | 187.0 | 188.0 | 0.0 | 0.0 | 0.0 | 188.0 | 0.0 | 0.0 | 0.0 | 188.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 187.0 | 0.0 | 0.0 | 0.0 | 187.0 | 0.0 | 0.0 | 0.0 | 187.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0.0 | 0.0 | 10.0 | 510.0 | 125.0 | 0.0 | 0.0 | 385.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2024 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 25 January 2024 | Re-amortize | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 0.0 | + + @TestRailId:C3074 @AdvancedPaymentAllocation + Scenario: Verify Loan re-amortization transaction - UC2: complete past due principal amount reamortization scenario + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2024 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "500" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "500" EUR transaction amount + When Admin sets the business date to "01 February 2024" + When When Admin creates a Loan re-amortization transaction on current business date + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | 01 February 2024 | 375.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2024 | 01 February 2024 | 375.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 375.0 | 0.0 | 0.0 | 0.0 | 375.0 | 0.0 | 0.0 | 0.0 | 375.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 125.0 | 0.0 | 0.0 | 375.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2024 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 01 February 2024 | Re-amortize | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 0.0 | + + @TestRailId:C3075 @AdvancedPaymentAllocation + Scenario: Verify Loan re-amortization transaction - UC3: reverse replay scenario + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2024 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "500" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "500" EUR transaction amount + When Admin sets the business date to "01 February 2024" + When When Admin creates a Loan re-amortization transaction on current business date + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | 01 February 2024 | 375.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2024 | 01 February 2024 | 375.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 375.0 | 0.0 | 0.0 | 0.0 | 375.0 | 0.0 | 0.0 | 0.0 | 375.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 125.0 | 0.0 | 0.0 | 375.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2024 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 01 February 2024 | Re-amortize | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 0.0 | + When Admin sets the business date to "02 February 2024" + And Customer makes "AUTOPAY" repayment on "15 January 2024" with 125 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | 15 January 2024 | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 125.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2024 | 01 February 2024 | 250.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 250.0 | 125.0 | 0.0 | 250.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2024 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 15 January 2024 | Repayment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 01 February 2024 | Re-amortize | 375.0 | 375.0 | 0.0 | 0.0 | 0.0 | 0.0 | + + @TestRailId:C3076 @AdvancedPaymentAllocation + Scenario: Verify Loan re-amortization transaction - UC4: N+1 Installment scenario + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2024 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "500" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "500" EUR transaction amount + When Admin sets the business date to "01 February 2024" + When Admin adds "LOAN_NSF_FEE" due date charge with "27 February 2024" due date and 10 EUR transaction amount + When When Admin creates a Loan re-amortization transaction on current business date + Then Loan Repayment schedule has 5 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 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | 01 February 2024 | 375.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 31 January 2024 | 01 February 2024 | 375.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 375.0 | 0.0 | 0.0 | 0.0 | 375.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 5 | 12 | 27 February 2024 | | 0.0 | 0.0 | 0.0 | 0.0 | 10.0 | 10.0 | 0.0 | 0.0 | 0.0 | 10.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0.0 | 0.0 | 10.0 | 510.0 | 125.0 | 0.0 | 0.0 | 385.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2024 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 01 February 2024 | Re-amortize | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 0.0 | + + @TestRailId:C3077 @AdvancedPaymentAllocation + Scenario: Verify Loan re-amortization transaction - UC5: re-amortization on same day of installment + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2024 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "500" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "500" EUR transaction amount + When Admin sets the business date to "16 January 2024" + When Admin adds "LOAN_NSF_FEE" due date charge with "16 January 2024" due date and 10 EUR transaction amount + When Admin sets the business date to "31 January 2024" + When When Admin creates a Loan re-amortization transaction on current business date + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | | 375.0 | 0.0 | 0.0 | 0.0 | 10.0 | 10.0 | 0.0 | 0.0 | 0.0 | 10.0 | + | 3 | 15 | 31 January 2024 | 31 January 2024 | 375.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 375.0 | 0.0 | 0.0 | 0.0 | 375.0 | 0.0 | 0.0 | 0.0 | 375.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0.0 | 0.0 | 10.0 | 510.0 | 125.0 | 0.0 | 0.0 | 385.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2024 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 31 January 2024 | Re-amortize | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 0.0 | + + @TestRailId:C3078 @AdvancedPaymentAllocation + Scenario: Verify Loan re-amortization transaction - UC6: Parital Paid Scenario + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2024 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "500" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "500" EUR transaction amount + When Admin sets the business date to "17 January 2024" + And Customer makes "AUTOPAY" repayment on "17 January 2024" with 50 EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | | 250.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 50.0 | 0.0 | 50.0 | 75.0 | + | 3 | 15 | 31 January 2024 | | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 175.0 | 0.0 | 50.0 | 325.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2024 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 17 January 2024 | Repayment | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 325.0 | + When Admin sets the business date to "30 January 2024" + When When Admin creates a Loan re-amortization transaction on current business date by loan external ID + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 January 2024 | 01 January 2024 | 375.0 | 125.0 | 0.0 | 0.0 | 0.0 | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 January 2024 | 30 January 2024 | 325.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 50.0 | 0.0 | 50.0 | 0.0 | + | 3 | 15 | 31 January 2024 | | 162.0 | 163.0 | 0.0 | 0.0 | 0.0 | 163.0 | 0.0 | 0.0 | 0.0 | 163.0 | + | 4 | 15 | 15 February 2024 | | 0.0 | 162.0 | 0.0 | 0.0 | 0.0 | 162.0 | 0.0 | 0.0 | 0.0 | 162.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 175.0 | 0.0 | 50.0 | 325.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 January 2024 | Down Payment | 125.0 | 125.0 | 0.0 | 0.0 | 0.0 | 375.0 | + | 17 January 2024 | Repayment | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 325.0 | + | 30 January 2024 | Re-amortize | 75.0 | 75.0 | 0.0 | 0.0 | 0.0 | 0.0 | + + @TestRailId:C3089 @AdvancedPaymentAllocation + Scenario: Verify Loan re-amortization transaction - Event check + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2024 | 500 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "500" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "500" EUR transaction amount + When Admin sets the business date to "31 January 2024" + When Admin runs inline COB job for Loan + Then LoanDelinquencyRangeChangeBusinessEvent is created + When Admin sets the business date to "01 February 2024" + When When Admin creates a Loan re-amortization transaction on current business date + Then LoanDelinquencyRangeChangeBusinessEvent is created + Then LoanReAmortizeBusinessEvent is created diff --git a/fineract-e2e-tests-runner/src/test/resources/features/LoanRepayment.feature b/fineract-e2e-tests-runner/src/test/resources/features/LoanRepayment.feature new file mode 100644 index 00000000000..46c1d9b747d --- /dev/null +++ b/fineract-e2e-tests-runner/src/test/resources/features/LoanRepayment.feature @@ -0,0 +1,3168 @@ +@Repayment +Feature: LoanRepayment + + @TestRailId:C49 + Scenario Outline: Loan repayment functionality with business date setup + When Admin sets the business date to + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 July 2022", with Principal: "5000", a loanTermFrequency: 24 months, and numberOfRepayments: 24 + And Admin successfully approves the loan on with "5000" amount and expected disbursement date on + And Admin successfully disburse the loan on with "5000" EUR transaction amount + And Customer makes "AUTOPAY" repayment on with EUR transaction amount + Then Repayment transaction is created with 200 amount and "AUTOPAY" type + Examples: + | businessDate | approveDate | expectedDisbursementDate | disbursementDate | repaymentDate | transactionAmount | + | "1 July 2022" | "1 July 2022" | "1 July 2022" | "1 July 2022" | "1 July 2022" | 200 | + + @TestRailId:C32 + Scenario: As a user I would like to check that the repayment transaction is failed when the repayment date is after the business date + When Admin sets the business date to "1 July 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 July 2022", with Principal: "5000", a loanTermFrequency: 24 months, and numberOfRepayments: 24 + And Admin successfully approves the loan on "1 July 2022" with "5000" amount and expected disbursement date on "1 July 2022" + And Admin successfully disburse the loan on "1 July 2022" with "5000" EUR transaction amount + And Customer makes "AUTOPAY" repayment on "2 July 2022" with 200 EUR transaction amount (and transaction fails because of wrong date) + Then Repayment failed because the repayment date is after the business date + + @TestRailId:C44 + Scenario: As a user I would like to check that the repayment is successful if the repayment date is equal to the business date + When Admin sets the business date to "1 July 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 July 2022", with Principal: "5000", a loanTermFrequency: 24 months, and numberOfRepayments: 24 + And Admin successfully approves the loan on "1 July 2022" with "5000" amount and expected disbursement date on "1 July 2022" + And Admin successfully disburse the loan on "1 July 2022" with "5000" EUR transaction amount + And Customer makes "AUTOPAY" repayment on "1 July 2022" with 200 EUR transaction amount + Then Repayment transaction is created with 200 amount and "AUTOPAY" type + + @TestRailId:C45 + Scenario: As a user I would like to increase the business day by the scheduled job and want to create a repayment transaction on that day + When Admin sets the business date to "1 July 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 July 2022", with Principal: "5000", a loanTermFrequency: 24 months, and numberOfRepayments: 24 + And Admin successfully approves the loan on "1 July 2022" with "5000" amount and expected disbursement date on "1 July 2022" + And Admin successfully disburse the loan on "1 July 2022" with "5000" EUR transaction amount + And Admin runs the Increase Business Date by 1 day job + And Customer makes "AUTOPAY" repayment on "2 July 2022" with 200 EUR transaction amount + Then Repayment transaction is created with 200 amount and "AUTOPAY" type + + @TestRailId:C2430 + Scenario: Verify that as a user I am able to make a repayment with AutoPay type + When Admin sets the business date to "1 July 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 July 2022", with Principal: "5000", a loanTermFrequency: 24 months, and numberOfRepayments: 24 + And Admin successfully approves the loan on "1 July 2022" with "5000" amount and expected disbursement date on "1 July 2022" + And Admin successfully disburse the loan on "1 July 2022" with "5000" EUR transaction amount + And Admin runs the Increase Business Date by 1 day job + And Customer makes "AUTOPAY" repayment on "2 July 2022" with 200 EUR transaction amount + Then Repayment transaction is created with 200 amount and "AUTOPAY" type + + @TestRailId:C2431 + Scenario: Verify that as a user I am able to make a repayment with Down payment type + When Admin sets the business date to "1 July 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 July 2022", with Principal: "5000", a loanTermFrequency: 24 months, and numberOfRepayments: 24 + And Admin successfully approves the loan on "1 July 2022" with "5000" amount and expected disbursement date on "1 July 2022" + And Admin successfully disburse the loan on "1 July 2022" with "5000" EUR transaction amount + And Admin runs the Increase Business Date by 1 day job + And Customer makes "DOWN_PAYMENT" repayment on "2 July 2022" with 200 EUR transaction amount + Then Repayment transaction is created with 200 amount and "DOWN_PAYMENT" type + + @TestRailId:C2432 + Scenario: Verify that as a user I am able to make a repayment with Real time type + When Admin sets the business date to "1 July 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 July 2022", with Principal: "5000", a loanTermFrequency: 24 months, and numberOfRepayments: 24 + And Admin successfully approves the loan on "1 July 2022" with "5000" amount and expected disbursement date on "1 July 2022" + And Admin successfully disburse the loan on "1 July 2022" with "5000" EUR transaction amount + And Admin runs the Increase Business Date by 1 day job + And Customer makes "REAL_TIME" repayment on "2 July 2022" with 200 EUR transaction amount + Then Repayment transaction is created with 200 amount and "REAL_TIME" type + + @TestRailId:C2433 + Scenario: Verify that as a user I am able to make a repayment with Scheduled type + When Admin sets the business date to "1 July 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 July 2022", with Principal: "5000", a loanTermFrequency: 24 months, and numberOfRepayments: 24 + And Admin successfully approves the loan on "1 July 2022" with "5000" amount and expected disbursement date on "1 July 2022" + And Admin successfully disburse the loan on "1 July 2022" with "5000" EUR transaction amount + And Admin runs the Increase Business Date by 1 day job + And Customer makes "SCHEDULED" repayment on "2 July 2022" with 200 EUR transaction amount + Then Repayment transaction is created with 200 amount and "SCHEDULED" type + + @TestRailId:C2434 + Scenario: Verify that as a user I am able to make a repayment with Check payment type + When Admin sets the business date to "1 July 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 July 2022", with Principal: "5000", a loanTermFrequency: 24 months, and numberOfRepayments: 24 + And Admin successfully approves the loan on "1 July 2022" with "5000" amount and expected disbursement date on "1 July 2022" + And Admin successfully disburse the loan on "1 July 2022" with "5000" EUR transaction amount + And Admin runs the Increase Business Date by 1 day job + And Customer makes "CHECK_PAYMENT" repayment on "2 July 2022" with 200 EUR transaction amount + Then Repayment transaction is created with 200 amount and "CHECK_PAYMENT" type + + @TestRailId:C2435 + Scenario: Verify that as a user I am able to make a repayment with Oca payment type + When Admin sets the business date to "1 July 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 July 2022", with Principal: "5000", a loanTermFrequency: 24 months, and numberOfRepayments: 24 + And Admin successfully approves the loan on "1 July 2022" with "5000" amount and expected disbursement date on "1 July 2022" + And Admin successfully disburse the loan on "1 July 2022" with "5000" EUR transaction amount + And Admin runs the Increase Business Date by 1 day job + And Customer makes "OCA_PAYMENT" repayment on "2 July 2022" with 200 EUR transaction amount + Then Repayment transaction is created with 200 amount and "OCA_PAYMENT" type + + @TestRailId:C2436 + Scenario: Verify that as a user I am able to make a repayment with Adjustment chargeback payment type + When Admin sets the business date to "1 July 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 July 2022", with Principal: "5000", a loanTermFrequency: 24 months, and numberOfRepayments: 24 + And Admin successfully approves the loan on "1 July 2022" with "5000" amount and expected disbursement date on "1 July 2022" + And Admin successfully disburse the loan on "1 July 2022" with "5000" EUR transaction amount + And Admin runs the Increase Business Date by 1 day job + And Customer makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" repayment on "2 July 2022" with 200 EUR transaction amount + Then Repayment transaction is created with 200 amount and "Repayment Adjustment Chargeback" type + + @TestRailId:C2437 + Scenario: Verify that as a user I am able to make a repayment with Adjustment refund payment type + When Admin sets the business date to "1 July 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 July 2022", with Principal: "5000", a loanTermFrequency: 24 months, and numberOfRepayments: 24 + And Admin successfully approves the loan on "1 July 2022" with "5000" amount and expected disbursement date on "1 July 2022" + And Admin successfully disburse the loan on "1 July 2022" with "5000" EUR transaction amount + And Admin runs the Increase Business Date by 1 day job + And Customer makes "REPAYMENT_ADJUSTMENT_REFUND" repayment on "2 July 2022" with 200 EUR transaction amount + Then Repayment transaction is created with 200 amount and "Repayment Adjustment Refund" type + + @TestRailId:C2464 + Scenario: As a user I would like to check the Autopay repayment undo and repayment after loan closed state + When Admin sets the business date to "1 July 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 July 2022", with Principal: "5000", a loanTermFrequency: 24 months, and numberOfRepayments: 24 + And Admin successfully approves the loan on "1 July 2022" with "5000" amount and expected disbursement date on "1 July 2022" + And Admin successfully disburse the loan on "1 July 2022" with "5000" EUR transaction amount + And Customer makes "AUTOPAY" repayment on "1 July 2022" with 5000 EUR transaction amount + Then Repayment transaction is created with 5000 amount and "AUTOPAY" type + And Customer makes a repayment undo on "1 July 2022" + And Loan has 5000 outstanding amount + And Customer makes "AUTOPAY" repayment on "1 July 2022" with 5000 EUR transaction amount + Then Repayment transaction is created with 5000 amount and "AUTOPAY" type + Then Loan has 0 outstanding amount + When Customer makes "AUTOPAY" repayment on "1 July 2022" with 100 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 100 overpaid amount + + @TestRailId:C2465 + Scenario: As a user I would like to check the Down payment repayment undo and repayment after loan closed state + When Admin sets the business date to "1 July 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 July 2022", with Principal: "5000", a loanTermFrequency: 24 months, and numberOfRepayments: 24 + And Admin successfully approves the loan on "1 July 2022" with "5000" amount and expected disbursement date on "1 July 2022" + And Admin successfully disburse the loan on "1 July 2022" with "5000" EUR transaction amount + And Customer makes "DOWN_PAYMENT" repayment on "1 July 2022" with 5000 EUR transaction amount + Then Repayment transaction is created with 5000 amount and "DOWN_PAYMENT" type + And Customer makes a repayment undo on "1 July 2022" + And Loan has 5000 outstanding amount + And Customer makes "DOWN_PAYMENT" repayment on "1 July 2022" with 5000 EUR transaction amount + Then Repayment transaction is created with 5000 amount and "DOWN_PAYMENT" type + Then Loan has 0 outstanding amount + When Customer makes "DOWN_PAYMENT" repayment on "1 July 2022" with 100 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 100 overpaid amount + + @TestRailId:C2466 + Scenario: As a user I would like to check the real time repayment undo and repayment after loan closed state + When Admin sets the business date to "1 July 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 July 2022", with Principal: "5000", a loanTermFrequency: 24 months, and numberOfRepayments: 24 + And Admin successfully approves the loan on "1 July 2022" with "5000" amount and expected disbursement date on "1 July 2022" + And Admin successfully disburse the loan on "1 July 2022" with "5000" EUR transaction amount + And Customer makes "REAL_TIME" repayment on "1 July 2022" with 5000 EUR transaction amount + Then Repayment transaction is created with 5000 amount and "REAL_TIME" type + And Customer makes a repayment undo on "1 July 2022" + And Loan has 5000 outstanding amount + And Customer makes "REAL_TIME" repayment on "1 July 2022" with 5000 EUR transaction amount + Then Repayment transaction is created with 5000 amount and "REAL_TIME" type + Then Loan has 0 outstanding amount + When Customer makes "REAL_TIME" repayment on "1 July 2022" with 100 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 100 overpaid amount + + @TestRailId:C2467 + Scenario: As a user I would like to check the scheduled repayment undo and repayment after loan closed state + When Admin sets the business date to "1 July 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 July 2022", with Principal: "5000", a loanTermFrequency: 24 months, and numberOfRepayments: 24 + And Admin successfully approves the loan on "1 July 2022" with "5000" amount and expected disbursement date on "1 July 2022" + And Admin successfully disburse the loan on "1 July 2022" with "5000" EUR transaction amount + And Customer makes "SCHEDULED" repayment on "1 July 2022" with 5000 EUR transaction amount + Then Repayment transaction is created with 5000 amount and "SCHEDULED" type + And Customer makes a repayment undo on "1 July 2022" + And Loan has 5000 outstanding amount + And Customer makes "SCHEDULED" repayment on "1 July 2022" with 5000 EUR transaction amount + Then Repayment transaction is created with 5000 amount and "SCHEDULED" type + Then Loan has 0 outstanding amount + When Customer makes "SCHEDULED" repayment on "1 July 2022" with 100 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 100 overpaid amount + + @TestRailId:C2468 + Scenario: As a user I would like to check the check payment repayment undo and repayment after loan closed state + When Admin sets the business date to "1 July 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 July 2022", with Principal: "5000", a loanTermFrequency: 24 months, and numberOfRepayments: 24 + And Admin successfully approves the loan on "1 July 2022" with "5000" amount and expected disbursement date on "1 July 2022" + And Admin successfully disburse the loan on "1 July 2022" with "5000" EUR transaction amount + And Customer makes "CHECK_PAYMENT" repayment on "1 July 2022" with 5000 EUR transaction amount + Then Repayment transaction is created with 5000 amount and "CHECK_PAYMENT" type + And Customer makes a repayment undo on "1 July 2022" + And Loan has 5000 outstanding amount + And Customer makes "CHECK_PAYMENT" repayment on "1 July 2022" with 5000 EUR transaction amount + Then Repayment transaction is created with 5000 amount and "CHECK_PAYMENT" type + Then Loan has 0 outstanding amount + When Customer makes "CHECK_PAYMENT" repayment on "1 July 2022" with 100 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 100 overpaid amount + + @TestRailId:C2469 + Scenario: As a user I would like to check the oca payment repayment undo and repayment after loan closed state + When Admin sets the business date to "1 July 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 July 2022", with Principal: "5000", a loanTermFrequency: 24 months, and numberOfRepayments: 24 + And Admin successfully approves the loan on "1 July 2022" with "5000" amount and expected disbursement date on "1 July 2022" + And Admin successfully disburse the loan on "1 July 2022" with "5000" EUR transaction amount + And Customer makes "OCA_PAYMENT" repayment on "1 July 2022" with 5000 EUR transaction amount + Then Repayment transaction is created with 5000 amount and "OCA_PAYMENT" type + And Customer makes a repayment undo on "1 July 2022" + And Loan has 5000 outstanding amount + And Customer makes "OCA_PAYMENT" repayment on "1 July 2022" with 5000 EUR transaction amount + Then Repayment transaction is created with 5000 amount and "OCA_PAYMENT" type + Then Loan has 0 outstanding amount + When Customer makes "OCA_PAYMENT" repayment on "1 July 2022" with 100 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 100 overpaid amount + + @TestRailId:C2470 + Scenario: As a user I would like to check the repayment adjustment chargeback repayment undo and repayment after loan closed state + When Admin sets the business date to "1 July 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 July 2022", with Principal: "5000", a loanTermFrequency: 24 months, and numberOfRepayments: 24 + And Admin successfully approves the loan on "1 July 2022" with "5000" amount and expected disbursement date on "1 July 2022" + And Admin successfully disburse the loan on "1 July 2022" with "5000" EUR transaction amount + And Customer makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" repayment on "1 July 2022" with 5000 EUR transaction amount + Then Repayment transaction is created with 5000 amount and "Repayment Adjustment Chargeback" type + And Customer makes a repayment undo on "1 July 2022" + And Loan has 5000 outstanding amount + And Customer makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" repayment on "1 July 2022" with 5000 EUR transaction amount + Then Repayment transaction is created with 5000 amount and "Repayment Adjustment Chargeback" type + Then Loan has 0 outstanding amount + When Customer makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" repayment on "1 July 2022" with 100 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 100 overpaid amount + + @TestRailId:C2471 + Scenario: As a user I would like to check the repayment adjustment refund repayment undo and repayment after loan closed state + When Admin sets the business date to "1 July 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 July 2022", with Principal: "5000", a loanTermFrequency: 24 months, and numberOfRepayments: 24 + And Admin successfully approves the loan on "1 July 2022" with "5000" amount and expected disbursement date on "1 July 2022" + And Admin successfully disburse the loan on "1 July 2022" with "5000" EUR transaction amount + And Customer makes "REPAYMENT_ADJUSTMENT_REFUND" repayment on "1 July 2022" with 5000 EUR transaction amount + Then Repayment transaction is created with 5000 amount and "Repayment Adjustment Refund" type + And Customer makes a repayment undo on "1 July 2022" + And Loan has 5000 outstanding amount + And Customer makes "REPAYMENT_ADJUSTMENT_REFUND" repayment on "1 July 2022" with 5000 EUR transaction amount + Then Repayment transaction is created with 5000 amount and "Repayment Adjustment Refund" type + Then Loan has 0 outstanding amount + When Customer makes "REPAYMENT_ADJUSTMENT_REFUND" repayment on "1 July 2022" with 100 EUR transaction amount + Then Loan status will be "OVERPAID" + Then Loan has 100 overpaid amount + + @TestRailId:C2485 + Scenario: Verify that inlineCOB job creates two separate events for LoanRepaymentDueBusinessEvent and LoanRepaymentOverdueBusinessEvent: due and overdue days values from global config + When Admin sets the business date to "01 January 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 January 2023" + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + And Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "31 January 2023" + When Admin runs inline COB job for Loan + Then Loan Repayment Due Business Event is created + When Admin sets the business date to "03 February 2023" + When Admin runs inline COB job for Loan + Then Loan Repayment Overdue Business Event is created + + @TestRailId:C2689 + Scenario: Verify that inlineCOB job creates two separate events for LoanRepaymentDueBusinessEvent and LoanRepaymentOverdueBusinessEvent: due and overdue days values from Loan product + When Admin sets the business date to "1 January 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 | + | PIN30_DUE_DATE | 01 January 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 1 | MONTHS | 1 | MONTHS | 1 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + And Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "30 January 2023" + When Admin runs inline COB job for Loan + Then Loan Repayment Due Business Event is created + When Admin sets the business date to "05 February 2023" + When Admin runs inline COB job for Loan + Then Loan Repayment Overdue Business Event is created + + @TestRailId:C2490 + Scenario: RS01 - Repayment Schedule with interest type: flat, interest period: Same as payment period, amortization type: Equal installments + When Admin sets the business date to "1 November 2022" + 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 | + | PIN30_INTEREST_FLAT | 1 November 2022 | 5000 | 12 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 18 | MONTHS | 1 | MONTHS | 18 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + Then Loan Repayment schedule has 18 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 November 2022 | | 5000.0 | | | 0.0 | | 0.0 | | | | 0.0 | + | 1 | 30 | 01 December 2022 | | 4722.0 | 278.0 | 50.0 | 0.0 | 0.0 | 328.0 | 0.0 | 0.0 | 0.0 | 328.0 | + | 2 | 31 | 01 January 2023 | | 4444.0 | 278.0 | 50.0 | 0.0 | 0.0 | 328.0 | 0.0 | 0.0 | 0.0 | 328.0 | + | 3 | 31 | 01 February 2023 | | 4166.0 | 278.0 | 50.0 | 0.0 | 0.0 | 328.0 | 0.0 | 0.0 | 0.0 | 328.0 | + | 4 | 28 | 01 March 2023 | | 3888.0 | 278.0 | 50.0 | 0.0 | 0.0 | 328.0 | 0.0 | 0.0 | 0.0 | 328.0 | + | 5 | 31 | 01 April 2023 | | 3610.0 | 278.0 | 50.0 | 0.0 | 0.0 | 328.0 | 0.0 | 0.0 | 0.0 | 328.0 | + | 6 | 30 | 01 May 2023 | | 3332.0 | 278.0 | 50.0 | 0.0 | 0.0 | 328.0 | 0.0 | 0.0 | 0.0 | 328.0 | + | 7 | 31 | 01 June 2023 | | 3054.0 | 278.0 | 50.0 | 0.0 | 0.0 | 328.0 | 0.0 | 0.0 | 0.0 | 328.0 | + | 8 | 30 | 01 July 2023 | | 2776.0 | 278.0 | 50.0 | 0.0 | 0.0 | 328.0 | 0.0 | 0.0 | 0.0 | 328.0 | + | 9 | 31 | 01 August 2023 | | 2498.0 | 278.0 | 50.0 | 0.0 | 0.0 | 328.0 | 0.0 | 0.0 | 0.0 | 328.0 | + | 10 | 31 | 01 September 2023 | | 2220.0 | 278.0 | 50.0 | 0.0 | 0.0 | 328.0 | 0.0 | 0.0 | 0.0 | 328.0 | + | 11 | 30 | 01 October 2023 | | 1942.0 | 278.0 | 50.0 | 0.0 | 0.0 | 328.0 | 0.0 | 0.0 | 0.0 | 328.0 | + | 12 | 31 | 01 November 2023 | | 1664.0 | 278.0 | 50.0 | 0.0 | 0.0 | 328.0 | 0.0 | 0.0 | 0.0 | 328.0 | + | 13 | 30 | 01 December 2023 | | 1386.0 | 278.0 | 50.0 | 0.0 | 0.0 | 328.0 | 0.0 | 0.0 | 0.0 | 328.0 | + | 14 | 31 | 01 January 2024 | | 1108.0 | 278.0 | 50.0 | 0.0 | 0.0 | 328.0 | 0.0 | 0.0 | 0.0 | 328.0 | + | 15 | 31 | 01 February 2024 | | 830.0 | 278.0 | 50.0 | 0.0 | 0.0 | 328.0 | 0.0 | 0.0 | 0.0 | 328.0 | + | 16 | 29 | 01 March 2024 | | 552.0 | 278.0 | 50.0 | 0.0 | 0.0 | 328.0 | 0.0 | 0.0 | 0.0 | 328.0 | + | 17 | 31 | 01 April 2024 | | 274.0 | 278.0 | 50.0 | 0.0 | 0.0 | 328.0 | 0.0 | 0.0 | 0.0 | 328.0 | + | 18 | 30 | 01 May 2024 | | 0.0 | 274.0 | 50.0 | 0.0 | 0.0 | 324.0 | 0.0 | 0.0 | 0.0 | 324.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 5000 | 900 | 0 | 0 | 5900 | 0 | 0 | 0 | 5900 | + + @TestRailId:C2492 + Scenario: RS02 - Repayment Schedule with interest type: Declining Balance, interest period: Same as payment period, amortization type: Equal installments + When Admin sets the business date to "1 November 2022" + 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 | + | PIN30_INTEREST_DECLINING_BALANCE_PERIOD_SAME_AS_PAYMENT | 1 November 2022 | 5000 | 12 | DECLINING_BALANCE | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 18 | MONTHS | 1 | MONTHS | 18 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + Then Loan Repayment schedule has 18 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 November 2022 | | 5000.0 | | | 0.0 | | 0.0 | | | | 0.0 | + | 1 | 30 | 01 December 2022 | | 4745.0 | 255.0 | 50.0 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 2 | 31 | 01 January 2023 | | 4487.45 | 257.55 | 47.45 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 3 | 31 | 01 February 2023 | | 4227.32 | 260.13 | 44.87 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 4 | 28 | 01 March 2023 | | 3964.59 | 262.73 | 42.27 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 5 | 31 | 01 April 2023 | | 3699.24 | 265.35 | 39.65 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 6 | 30 | 01 May 2023 | | 3431.23 | 268.01 | 36.99 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 7 | 31 | 01 June 2023 | | 3160.54 | 270.69 | 34.31 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 8 | 30 | 01 July 2023 | | 2887.15 | 273.39 | 31.61 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 9 | 31 | 01 August 2023 | | 2611.02 | 276.13 | 28.87 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 10 | 31 | 01 September 2023 | | 2332.13 | 278.89 | 26.11 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 11 | 30 | 01 October 2023 | | 2050.45 | 281.68 | 23.32 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 12 | 31 | 01 November 2023 | | 1765.95 | 284.5 | 20.5 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 13 | 30 | 01 December 2023 | | 1478.61 | 287.34 | 17.66 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 14 | 31 | 01 January 2024 | | 1188.4 | 290.21 | 14.79 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 15 | 31 | 01 February 2024 | | 895.28 | 293.12 | 11.88 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 16 | 29 | 01 March 2024 | | 599.23 | 296.05 | 8.95 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 17 | 31 | 01 April 2024 | | 300.22 | 299.01 | 5.99 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 18 | 30 | 01 May 2024 | | 0.0 | 300.22 | 3.0 | 0.0 | 0.0 | 303.22 | 0.0 | 0.0 | 0.0 | 303.22 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 5000 | 488.22 | 0 | 0 | 5488.22 | 0 | 0 | 0 | 5488.22 | + + @TestRailId:C2493 + Scenario: RS03 - Repayment Schedule with interest type: Declining Balance, interest period: Daily, amortization type: Equal installments + When Admin sets the business date to "1 November 2022" + 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 | + | PIN30_INTEREST_DECLINING_BALANCE_PERIOD_DAILY | 1 November 2022 | 5000 | 12 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 18 | MONTHS | 1 | MONTHS | 18 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + Then Loan Repayment schedule has 18 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 November 2022 | | 5000.0 | | | 0.0 | | 0.0 | | | | 0.0 | + | 1 | 30 | 01 December 2022 | | 4744.32 | 255.68 | 49.32 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 2 | 31 | 01 January 2023 | | 4487.67 | 256.65 | 48.35 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 3 | 31 | 01 February 2023 | | 4228.41 | 259.26 | 45.74 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 4 | 28 | 01 March 2023 | | 3962.33 | 266.08 | 38.92 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 5 | 31 | 01 April 2023 | | 3697.71 | 264.62 | 40.38 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 6 | 30 | 01 May 2023 | | 3429.18 | 268.53 | 36.47 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 7 | 31 | 01 June 2023 | | 3159.13 | 270.05 | 34.95 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 8 | 30 | 01 July 2023 | | 2885.29 | 273.84 | 31.16 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 9 | 31 | 01 August 2023 | | 2609.7 | 275.59 | 29.41 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 10 | 31 | 01 September 2023 | | 2331.3 | 278.4 | 26.6 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 11 | 30 | 01 October 2023 | | 2049.29 | 282.01 | 22.99 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 12 | 31 | 01 November 2023 | | 1765.18 | 284.11 | 20.89 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 13 | 30 | 01 December 2023 | | 1477.59 | 287.59 | 17.41 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 14 | 31 | 01 January 2024 | | 1187.65 | 289.94 | 15.06 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 15 | 31 | 01 February 2024 | | 894.75 | 292.9 | 12.1 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 16 | 29 | 01 March 2024 | | 598.28 | 296.47 | 8.53 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 17 | 31 | 01 April 2024 | | 299.38 | 298.9 | 6.1 | 0.0 | 0.0 | 305.0 | 0.0 | 0.0 | 0.0 | 305.0 | + | 18 | 30 | 01 May 2024 | | 0.0 | 299.38 | 2.95 | 0.0 | 0.0 | 302.33 | 0.0 | 0.0 | 0.0 | 302.33 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 5000 | 487.33 | 0 | 0 | 5487.33 | 0 | 0 | 0 | 5487.33 | + + @TestRailId:C2494 + Scenario: RS04 - Repayment Schedule with interest type: Declining Balance, interest period: Same as payment period, amortization type: Equal principal payments + When Admin sets the business date to "1 November 2022" + 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 | + | PIN30_INTEREST_DECLINING_BALANCE_PERIOD_SAME_AS_PAYMENT | 1 November 2022 | 5000 | 12 | DECLINING_BALANCE | SAME_AS_REPAYMENT_PERIOD | EQUAL_PRINCIPAL_PAYMENTS | 18 | MONTHS | 1 | MONTHS | 18 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + Then Loan Repayment schedule has 18 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 November 2022 | | 5000.0 | | | 0.0 | | 0.0 | | | | 0.0 | + | 1 | 30 | 01 December 2022 | | 4722.22 | 277.78 | 50.0 | 0.0 | 0.0 | 327.78 | 0.0 | 0.0 | 0.0 | 327.78 | + | 2 | 31 | 01 January 2023 | | 4444.44 | 277.78 | 47.22 | 0.0 | 0.0 | 325.0 | 0.0 | 0.0 | 0.0 | 325.0 | + | 3 | 31 | 01 February 2023 | | 4166.66 | 277.78 | 44.44 | 0.0 | 0.0 | 322.22 | 0.0 | 0.0 | 0.0 | 322.22 | + | 4 | 28 | 01 March 2023 | | 3888.88 | 277.78 | 41.67 | 0.0 | 0.0 | 319.45 | 0.0 | 0.0 | 0.0 | 319.45 | + | 5 | 31 | 01 April 2023 | | 3611.1 | 277.78 | 38.89 | 0.0 | 0.0 | 316.67 | 0.0 | 0.0 | 0.0 | 316.67 | + | 6 | 30 | 01 May 2023 | | 3333.32 | 277.78 | 36.11 | 0.0 | 0.0 | 313.89 | 0.0 | 0.0 | 0.0 | 313.89 | + | 7 | 31 | 01 June 2023 | | 3055.54 | 277.78 | 33.33 | 0.0 | 0.0 | 311.11 | 0.0 | 0.0 | 0.0 | 311.11 | + | 8 | 30 | 01 July 2023 | | 2777.76 | 277.78 | 30.56 | 0.0 | 0.0 | 308.34 | 0.0 | 0.0 | 0.0 | 308.34 | + | 9 | 31 | 01 August 2023 | | 2499.98 | 277.78 | 27.78 | 0.0 | 0.0 | 305.56 | 0.0 | 0.0 | 0.0 | 305.56 | + | 10 | 31 | 01 September 2023 | | 2222.2 | 277.78 | 25.0 | 0.0 | 0.0 | 302.78 | 0.0 | 0.0 | 0.0 | 302.78 | + | 11 | 30 | 01 October 2023 | | 1944.42 | 277.78 | 22.22 | 0.0 | 0.0 | 300.0 | 0.0 | 0.0 | 0.0 | 300.0 | + | 12 | 31 | 01 November 2023 | | 1666.64 | 277.78 | 19.44 | 0.0 | 0.0 | 297.22 | 0.0 | 0.0 | 0.0 | 297.22 | + | 13 | 30 | 01 December 2023 | | 1388.86 | 277.78 | 16.67 | 0.0 | 0.0 | 294.45 | 0.0 | 0.0 | 0.0 | 294.45 | + | 14 | 31 | 01 January 2024 | | 1111.08 | 277.78 | 13.89 | 0.0 | 0.0 | 291.67 | 0.0 | 0.0 | 0.0 | 291.67 | + | 15 | 31 | 01 February 2024 | | 833.3 | 277.78 | 11.11 | 0.0 | 0.0 | 288.89 | 0.0 | 0.0 | 0.0 | 288.89 | + | 16 | 29 | 01 March 2024 | | 555.52 | 277.78 | 8.33 | 0.0 | 0.0 | 286.11 | 0.0 | 0.0 | 0.0 | 286.11 | + | 17 | 31 | 01 April 2024 | | 277.74 | 277.78 | 5.56 | 0.0 | 0.0 | 283.34 | 0.0 | 0.0 | 0.0 | 283.34 | + | 18 | 30 | 01 May 2024 | | 0.0 | 277.74 | 2.78 | 0.0 | 0.0 | 280.52 | 0.0 | 0.0 | 0.0 | 280.52 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 5000 | 475.0 | 0 | 0 | 5475.0 | 0 | 0 | 0 | 5475.0 | + + @TestRailId:C2495 + Scenario: RS05 - Repayment Schedule with interest type: Declining Balance, interest period: Same as payment period, amortization type: Equal installments, Grace on principal payment + When Admin sets the business date to "1 November 2022" + 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 | + | PIN30_INTEREST_DECLINING_BALANCE_PERIOD_SAME_AS_PAYMENT | 1 November 2022 | 5000 | 12 | DECLINING_BALANCE | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 18 | MONTHS | 1 | MONTHS | 18 | 3 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + Then Loan Repayment schedule has 18 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 November 2022 | | 5000.0 | | | 0.0 | | 0.0 | | | | 0.0 | + | 1 | 30 | 01 December 2022 | | 5000.0 | 0.0 | 50.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | + | 2 | 31 | 01 January 2023 | | 5000.0 | 0.0 | 50.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | + | 3 | 31 | 01 February 2023 | | 5000.0 | 0.0 | 50.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | + | 4 | 28 | 01 March 2023 | | 4689.0 | 311.0 | 50.0 | 0.0 | 0.0 | 361.0 | 0.0 | 0.0 | 0.0 | 361.0 | + | 5 | 31 | 01 April 2023 | | 4374.89 | 314.11 | 46.89 | 0.0 | 0.0 | 361.0 | 0.0 | 0.0 | 0.0 | 361.0 | + | 6 | 30 | 01 May 2023 | | 4057.64 | 317.25 | 43.75 | 0.0 | 0.0 | 361.0 | 0.0 | 0.0 | 0.0 | 361.0 | + | 7 | 31 | 01 June 2023 | | 3737.22 | 320.42 | 40.58 | 0.0 | 0.0 | 361.0 | 0.0 | 0.0 | 0.0 | 361.0 | + | 8 | 30 | 01 July 2023 | | 3413.59 | 323.63 | 37.37 | 0.0 | 0.0 | 361.0 | 0.0 | 0.0 | 0.0 | 361.0 | + | 9 | 31 | 01 August 2023 | | 3086.73 | 326.86 | 34.14 | 0.0 | 0.0 | 361.0 | 0.0 | 0.0 | 0.0 | 361.0 | + | 10 | 31 | 01 September 2023 | | 2756.6 | 330.13 | 30.87 | 0.0 | 0.0 | 361.0 | 0.0 | 0.0 | 0.0 | 361.0 | + | 11 | 30 | 01 October 2023 | | 2423.17 | 333.43 | 27.57 | 0.0 | 0.0 | 361.0 | 0.0 | 0.0 | 0.0 | 361.0 | + | 12 | 31 | 01 November 2023 | | 2086.4 | 336.77 | 24.23 | 0.0 | 0.0 | 361.0 | 0.0 | 0.0 | 0.0 | 361.0 | + | 13 | 30 | 01 December 2023 | | 1746.26 | 340.14 | 20.86 | 0.0 | 0.0 | 361.0 | 0.0 | 0.0 | 0.0 | 361.0 | + | 14 | 31 | 01 January 2024 | | 1402.72 | 343.54 | 17.46 | 0.0 | 0.0 | 361.0 | 0.0 | 0.0 | 0.0 | 361.0 | + | 15 | 31 | 01 February 2024 | | 1055.75 | 346.97 | 14.03 | 0.0 | 0.0 | 361.0 | 0.0 | 0.0 | 0.0 | 361.0 | + | 16 | 29 | 01 March 2024 | | 705.31 | 350.44 | 10.56 | 0.0 | 0.0 | 361.0 | 0.0 | 0.0 | 0.0 | 361.0 | + | 17 | 31 | 01 April 2024 | | 351.36 | 353.95 | 7.05 | 0.0 | 0.0 | 361.0 | 0.0 | 0.0 | 0.0 | 361.0 | + | 18 | 30 | 01 May 2024 | | 0.0 | 351.36 | 3.51 | 0.0 | 0.0 | 354.87 | 0.0 | 0.0 | 0.0 | 354.87 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 5000 | 558.87 | 0 | 0 | 5558.87 | 0 | 0 | 0 | 5558.87 | + + @TestRailId:C2496 + Scenario: RS06 - Repayment Schedule with interest type: Declining Balance, interest period: Same as payment period, amortization type: Equal installments, Grace on principal payment and interest payment + When Admin sets the business date to "1 November 2022" + 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 | + | PIN30_INTEREST_DECLINING_BALANCE_PERIOD_SAME_AS_PAYMENT | 1 November 2022 | 5000 | 12 | DECLINING_BALANCE | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 18 | MONTHS | 1 | MONTHS | 18 | 6 | 3 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + Then Loan Repayment schedule has 18 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 November 2022 | | 5000.0 | | | 0.0 | | 0.0 | | | | 0.0 | + | 1 | 30 | 01 December 2022 | | 5000.0 | 0.0 | 50.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | + | 2 | 31 | 01 January 2023 | | 5000.0 | 0.0 | 50.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | + | 3 | 31 | 01 February 2023 | | 5000.0 | 0.0 | 50.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | + | 4 | 28 | 01 March 2023 | | 5000.0 | 0.0 | 50.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | + | 5 | 31 | 01 April 2023 | | 5000.0 | 0.0 | 50.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | + | 6 | 30 | 01 May 2023 | | 5000.0 | 0.0 | 50.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | + | 7 | 31 | 01 June 2023 | | 4606.0 | 394.0 | 50.0 | 0.0 | 0.0 | 444.0 | 0.0 | 0.0 | 0.0 | 444.0 | + | 8 | 30 | 01 July 2023 | | 4208.06 | 397.94 | 46.06 | 0.0 | 0.0 | 444.0 | 0.0 | 0.0 | 0.0 | 444.0 | + | 9 | 31 | 01 August 2023 | | 3806.14 | 401.92 | 42.08 | 0.0 | 0.0 | 444.0 | 0.0 | 0.0 | 0.0 | 444.0 | + | 10 | 31 | 01 September 2023 | | 3400.2 | 405.94 | 38.06 | 0.0 | 0.0 | 444.0 | 0.0 | 0.0 | 0.0 | 444.0 | + | 11 | 30 | 01 October 2023 | | 2990.2 | 410.0 | 34.0 | 0.0 | 0.0 | 444.0 | 0.0 | 0.0 | 0.0 | 444.0 | + | 12 | 31 | 01 November 2023 | | 2576.1 | 414.1 | 29.9 | 0.0 | 0.0 | 444.0 | 0.0 | 0.0 | 0.0 | 444.0 | + | 13 | 30 | 01 December 2023 | | 2157.86 | 418.24 | 25.76 | 0.0 | 0.0 | 444.0 | 0.0 | 0.0 | 0.0 | 444.0 | + | 14 | 31 | 01 January 2024 | | 1735.44 | 422.42 | 21.58 | 0.0 | 0.0 | 444.0 | 0.0 | 0.0 | 0.0 | 444.0 | + | 15 | 31 | 01 February 2024 | | 1308.79 | 426.65 | 17.35 | 0.0 | 0.0 | 444.0 | 0.0 | 0.0 | 0.0 | 444.0 | + | 16 | 29 | 01 March 2024 | | 877.88 | 430.91 | 13.09 | 0.0 | 0.0 | 444.0 | 0.0 | 0.0 | 0.0 | 444.0 | + | 17 | 31 | 01 April 2024 | | 442.66 | 435.22 | 8.78 | 0.0 | 0.0 | 444.0 | 0.0 | 0.0 | 0.0 | 444.0 | + | 18 | 30 | 01 May 2024 | | 0.0 | 442.66 | 4.43 | 0.0 | 0.0 | 447.09 | 0.0 | 0.0 | 0.0 | 447.09 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 5000 | 631.09 | 0 | 0 | 5631.09 | 0 | 0 | 0 | 5631.09 | + + @TestRailId:C2497 + Scenario: RS07 - Repayment Schedule with interest type: Declining Balance, interest period: Same as payment period, amortization type: Equal installments, Grace on principal payment and setting up interest free period + When Admin sets the business date to "1 November 2022" + 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 | + | PIN30_INTEREST_DECLINING_BALANCE_PERIOD_SAME_AS_PAYMENT | 1 November 2022 | 5000 | 12 | DECLINING_BALANCE | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 18 | MONTHS | 1 | MONTHS | 18 | 6 | 0 | 3 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + Then Loan Repayment schedule has 18 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 November 2022 | | 5000.0 | | | 0.0 | | 0.0 | | | | 0.0 | + | 1 | 30 | 01 December 2022 | | 5000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 January 2023 | | 5000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 February 2023 | | 5000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 4 | 28 | 01 March 2023 | | 5000.0 | 0.0 | 200.0 | 0.0 | 0.0 | 200.0 | 0.0 | 0.0 | 0.0 | 200.0 | + | 5 | 31 | 01 April 2023 | | 5000.0 | 0.0 | 50.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | + | 6 | 30 | 01 May 2023 | | 5000.0 | 0.0 | 50.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | + | 7 | 31 | 01 June 2023 | | 4606.0 | 394.0 | 50.0 | 0.0 | 0.0 | 444.0 | 0.0 | 0.0 | 0.0 | 444.0 | + | 8 | 30 | 01 July 2023 | | 4208.06 | 397.94 | 46.06 | 0.0 | 0.0 | 444.0 | 0.0 | 0.0 | 0.0 | 444.0 | + | 9 | 31 | 01 August 2023 | | 3806.14 | 401.92 | 42.08 | 0.0 | 0.0 | 444.0 | 0.0 | 0.0 | 0.0 | 444.0 | + | 10 | 31 | 01 September 2023 | | 3400.2 | 405.94 | 38.06 | 0.0 | 0.0 | 444.0 | 0.0 | 0.0 | 0.0 | 444.0 | + | 11 | 30 | 01 October 2023 | | 2990.2 | 410.0 | 34.0 | 0.0 | 0.0 | 444.0 | 0.0 | 0.0 | 0.0 | 444.0 | + | 12 | 31 | 01 November 2023 | | 2576.1 | 414.1 | 29.9 | 0.0 | 0.0 | 444.0 | 0.0 | 0.0 | 0.0 | 444.0 | + | 13 | 30 | 01 December 2023 | | 2157.86 | 418.24 | 25.76 | 0.0 | 0.0 | 444.0 | 0.0 | 0.0 | 0.0 | 444.0 | + | 14 | 31 | 01 January 2024 | | 1735.44 | 422.42 | 21.58 | 0.0 | 0.0 | 444.0 | 0.0 | 0.0 | 0.0 | 444.0 | + | 15 | 31 | 01 February 2024 | | 1308.79 | 426.65 | 17.35 | 0.0 | 0.0 | 444.0 | 0.0 | 0.0 | 0.0 | 444.0 | + | 16 | 29 | 01 March 2024 | | 877.88 | 430.91 | 13.09 | 0.0 | 0.0 | 444.0 | 0.0 | 0.0 | 0.0 | 444.0 | + | 17 | 31 | 01 April 2024 | | 442.66 | 435.22 | 8.78 | 0.0 | 0.0 | 444.0 | 0.0 | 0.0 | 0.0 | 444.0 | + | 18 | 30 | 01 May 2024 | | 0.0 | 442.66 | 4.43 | 0.0 | 0.0 | 447.09 | 0.0 | 0.0 | 0.0 | 447.09 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 5000 | 631.09 | 0 | 0 | 5631.09 | 0 | 0 | 0 | 5631.09 | + + @TestRailId:C2498 + Scenario: As admin I would like to be sure that Edit from Goodwill Credit of on loan transaction can not be done + When Admin sets the business date to "1 November 2022" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 November 2022" + And Admin successfully approves the loan on "1 November 2022" with "1000" amount and expected disbursement date on "1 November 2022" + When Admin successfully disburse the loan on "1 November 2022" with "1000" EUR transaction amount + When Admin sets the business date to "15 November 2022" + And Customer makes "AUTOPAY" repayment on "15 November 2022" with 1000 EUR transaction amount + And Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "15 November 2022" with 200 EUR transaction amount and self-generated Idempotency key + Then Loan "loanPaymentTransactionResponse" transaction adjust amount 900 must return 403 code + + @TestRailId:C2499 + Scenario: As admin I would like to be sure that Edit from Payout Refund of on loan transaction can not be done + When Admin sets the business date to "1 November 2022" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 November 2022" + And Admin successfully approves the loan on "1 November 2022" with "1000" amount and expected disbursement date on "1 November 2022" + When Admin successfully disburse the loan on "1 November 2022" with "1000" EUR transaction amount + When Admin sets the business date to "15 November 2022" + And Customer makes "AUTOPAY" repayment on "15 November 2022" with 1000 EUR transaction amount + And Refund happens on "15 November 2022" with 100 EUR transaction amount + Then Loan "loanRefundResponse" transaction adjust amount 90 must return 403 code + + @TestRailId:C2500 + Scenario: As admin I would like to be sure that Edit from Merchant Issued Refund of on loan transaction can not be done + When Admin sets the business date to "1 November 2022" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "1 November 2022" + And Admin successfully approves the loan on "1 November 2022" with "1000" amount and expected disbursement date on "1 November 2022" + When Admin successfully disburse the loan on "1 November 2022" with "1000" EUR transaction amount + When Admin sets the business date to "15 November 2022" + And Customer makes "AUTOPAY" repayment on "15 November 2022" with 1000 EUR transaction amount + And Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "15 November 2022" with 200 EUR transaction amount and self-generated Idempotency key + Then Loan "loanPaymentTransactionResponse" transaction adjust amount 190 must return 403 code + + @TestRailId:C2531 + Scenario: As admin I would like to check the last payment amount after a merchant issue refund + When Admin sets the business date to "9 February 2023" + And Admin creates a client with random data + When Admin creates a new default Loan with date: "9 February 2023" + And Admin successfully approves the loan on "9 February 2023" with "1000" amount and expected disbursement date on "9 February 2023" + When Admin successfully disburse the loan on "9 February 2023" with "1000" EUR transaction amount + And Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "9 February 2023" with 50 EUR transaction amount and self-generated Idempotency key + And Customer makes "AUTOPAY" repayment on "9 February 2023" with 200 EUR transaction amount + Then Loan has 200 last payment amount + + @TestRailId:C2555 + Scenario: RP01 - Repayment Schedule with interest type: Declining Balance and Interest Recalculation with Interest compounding + When Admin sets the business date to "1 September 2022" + 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 | + | PIN30_1MONTH_INTEREST_DECLINING_BALANCE_DAILY_RECALCULATION_COMPOUNDING_MONTHLY | 1 September 2022 | 5000 | 12 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "1 September 2022" with "5000" amount and expected disbursement date on "1 September 2022" + When Admin successfully disburse the loan on "1 September 2022" with "5000" EUR transaction amount + When Admin sets the business date to "4 December 2022" + And Customer makes "AUTOPAY" repayment on "4 December 2022" with 862 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 | + | | | 01 September 2022 | | 5000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 01 October 2022 | 04 December 2022 | 4187.32 | 812.68 | 49.32 | 0.0 | 0.0 | 862.0 | 862.0 | 0.0 | 862.0 | 0.0 | + | 2 | 31 | 01 November 2022 | | 3368.0 | 819.32 | 42.68 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 3 | 30 | 01 December 2022 | | 2539.22 | 828.78 | 33.22 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 4 | 31 | 01 January 2023 | | 1705.65 | 833.57 | 28.43 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 5 | 31 | 01 February 2023 | | 861.03 | 844.62 | 17.38 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 6 | 28 | 01 March 2023 | | 0.0 | 861.03 | 7.93 | 0.0 | 0.0 | 868.96 | 0.0 | 0.0 | 0.0 | 868.96 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 5000.0 | 178.96 | 0.0 | 0.0 | 5178.96 | 862.0 | 0.0 | 862.0 | 4316.96 | + + @TestRailId:C2556 + Scenario: RP02 - Repayment Schedule with interest type: Declining Balance and Interest Recalculation with on time exact payment + When Admin sets the business date to "1 November 2022" + 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 | + | PIN30_INTEREST_DECLINING_BALANCE_DAILY_RECALCULATION_COMPOUNDING_NONE | 1 November 2022 | 5000 | 12 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "1 November 2022" with "5000" amount and expected disbursement date on "1 November 2023" + When Admin successfully disburse the loan on "1 November 2022" with "5000" EUR transaction amount + When Admin sets the business date to "1 December 2022" + And Customer makes "AUTOPAY" repayment on "1 December 2022" with 863 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 | + | | | 01 November 2022 | | 5000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 01 December 2022 | 01 December 2022 | 4186.32 | 813.68 | 49.32 | 0.0 | 0.0 | 863.0 | 863.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 January 2023 | | 3366.99 | 819.33 | 42.67 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 3 | 31 | 01 February 2023 | | 2539.31 | 827.68 | 34.32 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 4 | 28 | 01 March 2023 | | 1700.69 | 838.62 | 23.38 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 5 | 31 | 01 April 2023 | | 856.02 | 844.67 | 17.33 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 6 | 30 | 01 May 2023 | | 0.0 | 856.02 | 8.44 | 0.0 | 0.0 | 864.46 | 0.0 | 0.0 | 0.0 | 864.46 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 5000.0 | 175.46 | 0.0 | 0.0 | 5175.46 | 863.0 | 0.0 | 0.0 | 4312.46 | + + @TestRailId:C2557 + Scenario: RP03 - Repayment Schedule with interest type: Declining Balance and Interest Recalculation with early exact payment + When Admin sets the business date to "1 November 2022" + 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 | + | PIN30_INTEREST_DECLINING_BALANCE_DAILY_RECALCULATION_COMPOUNDING_NONE | 1 November 2022 | 5000 | 12 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "1 November 2022" with "5000" amount and expected disbursement date on "1 November 2023" + When Admin successfully disburse the loan on "1 November 2022" with "5000" EUR transaction amount + When Admin sets the business date to "27 November 2022" + And Customer makes "AUTOPAY" repayment on "27 November 2022" with 863 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 | + | | | 01 November 2022 | | 5000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 01 December 2022 | | 4137.0 | 863.0 | 48.18 | 0.0 | 0.0 | 911.18 | 863.0 | 863.0 | 0.0 | 48.18 | + | 2 | 31 | 01 January 2023 | | 3327.16 | 809.84 | 42.16 | 0.0 | 0.0 | 852.0 | 0.0 | 0.0 | 0.0 | 852.0 | + | 3 | 31 | 01 February 2023 | | 2509.07 | 818.09 | 33.91 | 0.0 | 0.0 | 852.0 | 0.0 | 0.0 | 0.0 | 852.0 | + | 4 | 28 | 01 March 2023 | | 1680.17 | 828.9 | 23.1 | 0.0 | 0.0 | 852.0 | 0.0 | 0.0 | 0.0 | 852.0 | + | 5 | 31 | 01 April 2023 | | 845.29 | 834.88 | 17.12 | 0.0 | 0.0 | 852.0 | 0.0 | 0.0 | 0.0 | 852.0 | + | 6 | 30 | 01 May 2023 | | 0.0 | 845.29 | 8.34 | 0.0 | 0.0 | 853.63 | 0.0 | 0.0 | 0.0 | 853.63 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 5000.0 | 172.81 | 0.0 | 0.0 | 5172.81 | 863.0 | 863.0 | 0.0 | 4309.81 | + + @TestRailId:C2558 + Scenario: RP04 - Repayment Schedule with interest type: Declining Balance and Interest Recalculation with late exact payment + When Admin sets the business date to "1 November 2022" + 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 | + | PIN30_INTEREST_DECLINING_BALANCE_DAILY_RECALCULATION_COMPOUNDING_NONE | 1 November 2022 | 5000 | 12 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "1 November 2022" with "5000" amount and expected disbursement date on "1 November 2023" + When Admin successfully disburse the loan on "1 November 2022" with "5000" EUR transaction amount + When Admin sets the business date to "5 December 2022" + And Customer makes "AUTOPAY" repayment on "5 December 2022" with 862 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 | + | | | 01 November 2022 | | 5000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 01 December 2022 | 05 December 2022 | 4187.32 | 812.68 | 49.32 | 0.0 | 0.0 | 862.0 | 862.0 | 0.0 | 862.0 | 0.0 | + | 2 | 31 | 01 January 2023 | | 3369.07 | 818.25 | 43.75 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 3 | 31 | 01 February 2023 | | 2541.41 | 827.66 | 34.34 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 4 | 28 | 01 March 2023 | | 1702.8 | 838.61 | 23.39 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 5 | 31 | 01 April 2023 | | 858.15 | 844.65 | 17.35 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 6 | 30 | 01 May 2023 | | 0.0 | 858.15 | 8.46 | 0.0 | 0.0 | 866.61 | 0.0 | 0.0 | 0.0 | 866.61 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 5000.0 | 176.61 | 0.0 | 0.0 | 5176.61 | 862.0 | 0.0 | 862.0 | 4314.61 | + + @TestRailId:C2559 + Scenario: RP05 - Repayment Schedule with interest type: Declining Balance and Interest Recalculation with on time partial payment + When Admin sets the business date to "1 November 2022" + 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 | + | PIN30_INTEREST_DECLINING_BALANCE_DAILY_RECALCULATION_COMPOUNDING_NONE | 1 November 2022 | 5000 | 12 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "1 November 2022" with "5000" amount and expected disbursement date on "1 November 2023" + When Admin successfully disburse the loan on "1 November 2022" with "5000" EUR transaction amount + When Admin sets the business date to "1 December 2022" + And Customer makes "AUTOPAY" repayment on "1 December 2022" with 200 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 | + | | | 01 November 2022 | | 5000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 01 December 2022 | | 4187.32 | 812.68 | 49.32 | 0.0 | 0.0 | 862.0 | 200.0 | 0.0 | 0.0 | 662.0 | + | 2 | 31 | 01 January 2023 | | 3368.0 | 819.32 | 42.68 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 3 | 31 | 01 February 2023 | | 2540.33 | 827.67 | 34.33 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 4 | 28 | 01 March 2023 | | 1701.71 | 838.62 | 23.38 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 5 | 31 | 01 April 2023 | | 857.05 | 844.66 | 17.34 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 6 | 30 | 01 May 2023 | | 0.0 | 857.05 | 8.45 | 0.0 | 0.0 | 865.5 | 0.0 | 0.0 | 0.0 | 865.5 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 5000.0 | 175.5 | 0.0 | 0.0 | 5175.5 | 200.0 | 0.0 | 0.0 | 4975.50 | + + @TestRailId:C2560 + Scenario: RP06 - Repayment Schedule with interest type: Declining Balance and Interest Recalculation with early partial payment + When Admin sets the business date to "1 November 2022" + 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 | + | PIN30_INTEREST_DECLINING_BALANCE_DAILY_RECALCULATION_COMPOUNDING_NONE | 1 November 2022 | 5000 | 12 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "1 November 2022" with "5000" amount and expected disbursement date on "1 November 2023" + When Admin successfully disburse the loan on "1 November 2022" with "5000" EUR transaction amount + When Admin sets the business date to "27 November 2022" + And Customer makes "AUTOPAY" repayment on "27 November 2022" with 200 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 | + | | | 01 November 2022 | | 5000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 01 December 2022 | | 4187.05 | 812.95 | 49.05 | 0.0 | 0.0 | 862.0 | 200.0 | 200.0 | 0.0 | 662.0 | + | 2 | 31 | 01 January 2023 | | 3367.72 | 819.33 | 42.67 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 3 | 31 | 01 February 2023 | | 2540.04 | 827.68 | 34.32 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 4 | 28 | 01 March 2023 | | 1701.42 | 838.62 | 23.38 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 5 | 31 | 01 April 2023 | | 856.76 | 844.66 | 17.34 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 6 | 30 | 01 May 2023 | | 0.0 | 856.76 | 8.45 | 0.0 | 0.0 | 865.21 | 0.0 | 0.0 | 0.0 | 865.21 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 5000.0 | 175.21 | 0.0 | 0.0 | 5175.21 | 200.0 | 200.0 | 0.0 | 4975.21 | + + @TestRailId:C2561 + Scenario: RP07 - Repayment Schedule with interest type: Declining Balance and Interest Recalculation with late partial payment + When Admin sets the business date to "1 November 2022" + 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 | + | PIN30_INTEREST_DECLINING_BALANCE_DAILY_RECALCULATION_COMPOUNDING_NONE | 1 November 2022 | 5000 | 12 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "1 November 2022" with "5000" amount and expected disbursement date on "1 November 2023" + When Admin successfully disburse the loan on "1 November 2022" with "5000" EUR transaction amount + When Admin sets the business date to "5 December 2022" + And Customer makes "AUTOPAY" repayment on "5 December 2022" with 200 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 | + | | | 01 November 2022 | | 5000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 01 December 2022 | | 4187.32 | 812.68 | 49.32 | 0.0 | 0.0 | 862.0 | 200.0 | 0.0 | 200.0 | 662.0 | + | 2 | 31 | 01 January 2023 | | 3369.07 | 818.25 | 43.75 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 3 | 31 | 01 February 2023 | | 2541.41 | 827.66 | 34.34 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 4 | 28 | 01 March 2023 | | 1702.8 | 838.61 | 23.39 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 5 | 31 | 01 April 2023 | | 858.15 | 844.65 | 17.35 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 6 | 30 | 01 May 2023 | | 0.0 | 858.15 | 8.46 | 0.0 | 0.0 | 866.61 | 0.0 | 0.0 | 0.0 | 866.61 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 5000.0 | 176.61 | 0.0 | 0.0 | 5176.61 | 200.0 | 0.0 | 200.0 | 4976.61 | + + @TestRailId:C2562 + Scenario: RP08 - Repayment Schedule with interest type: Declining Balance and Interest Recalculation with on time excess payment + When Admin sets the business date to "1 November 2022" + 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 | + | PIN30_INTEREST_DECLINING_BALANCE_DAILY_RECALCULATION_COMPOUNDING_NONE | 1 November 2022 | 5000 | 12 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "1 November 2022" with "5000" amount and expected disbursement date on "1 November 2023" + When Admin successfully disburse the loan on "1 November 2022" with "5000" EUR transaction amount + When Admin sets the business date to "1 December 2022" + And Customer makes "AUTOPAY" repayment on "1 December 2022" with 1500 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 | + | | | 01 November 2022 | | 5000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 01 December 2022 | 01 December 2022 | 3549.32 | 1450.68 | 49.32 | 0.0 | 0.0 | 1500.0 | 1500.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 January 2023 | | 2854.49 | 694.83 | 36.17 | 0.0 | 0.0 | 731.0 | 0.0 | 0.0 | 0.0 | 731.0 | + | 3 | 31 | 01 February 2023 | | 2152.58 | 701.91 | 29.09 | 0.0 | 0.0 | 731.0 | 0.0 | 0.0 | 0.0 | 731.0 | + | 4 | 28 | 01 March 2023 | | 1441.4 | 711.18 | 19.82 | 0.0 | 0.0 | 731.0 | 0.0 | 0.0 | 0.0 | 731.0 | + | 5 | 31 | 01 April 2023 | | 725.09 | 716.31 | 14.69 | 0.0 | 0.0 | 731.0 | 0.0 | 0.0 | 0.0 | 731.0 | + | 6 | 30 | 01 May 2023 | | 0.0 | 725.09 | 7.15 | 0.0 | 0.0 | 732.24 | 0.0 | 0.0 | 0.0 | 732.24 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 5000.0 | 156.24 | 0.0 | 0.0 | 5156.24 | 1500.0 | 0.0 | 0.0 | 3656.24 | + + @TestRailId:C2563 + Scenario: RP09 - Repayment Schedule with interest type: Declining Balance and Interest Recalculation with early excess payment + When Admin sets the business date to "1 November 2022" + 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 | + | PIN30_INTEREST_DECLINING_BALANCE_DAILY_RECALCULATION_COMPOUNDING_NONE | 1 November 2022 | 5000 | 12 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "1 November 2022" with "5000" amount and expected disbursement date on "1 November 2023" + When Admin successfully disburse the loan on "1 November 2022" with "5000" EUR transaction amount + When Admin sets the business date to "27 November 2022" + And Customer makes "AUTOPAY" repayment on "27 November 2022" with 1500 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 | + | | | 01 November 2022 | | 5000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 01 December 2022 | | 3500.0 | 1500.0 | 47.34 | 0.0 | 0.0 | 1547.34 | 1500.0 | 1500.0 | 0.0 | 47.34 | + | 2 | 31 | 01 January 2023 | | 2814.67 | 685.33 | 35.67 | 0.0 | 0.0 | 721.0 | 0.0 | 0.0 | 0.0 | 721.0 | + | 3 | 31 | 01 February 2023 | | 2122.36 | 692.31 | 28.69 | 0.0 | 0.0 | 721.0 | 0.0 | 0.0 | 0.0 | 721.0 | + | 4 | 28 | 01 March 2023 | | 1420.9 | 701.46 | 19.54 | 0.0 | 0.0 | 721.0 | 0.0 | 0.0 | 0.0 | 721.0 | + | 5 | 31 | 01 April 2023 | | 714.38 | 706.52 | 14.48 | 0.0 | 0.0 | 721.0 | 0.0 | 0.0 | 0.0 | 721.0 | + | 6 | 30 | 01 May 2023 | | 0.0 | 714.38 | 7.05 | 0.0 | 0.0 | 721.43 | 0.0 | 0.0 | 0.0 | 721.43 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 5000.0 | 152.77 | 0.0 | 0.0 | 5152.77 | 1500.0 | 1500.0 | 0.0 | 3652.77 | + + @TestRailId:C2564 + Scenario: RP10 - Repayment Schedule with interest type: Declining Balance and Interest Recalculation with late excess payment + When Admin sets the business date to "1 November 2022" + 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 | + | PIN30_INTEREST_DECLINING_BALANCE_DAILY_RECALCULATION_COMPOUNDING_NONE | 1 November 2022 | 5000 | 12 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "1 November 2022" with "5000" amount and expected disbursement date on "1 November 2023" + When Admin successfully disburse the loan on "1 November 2022" with "5000" EUR transaction amount + When Admin sets the business date to "5 December 2022" + And Customer makes "AUTOPAY" repayment on "5 December 2022" with 1500 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 | + | | | 01 November 2022 | | 5000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 01 December 2022 | 05 December 2022 | 4187.32 | 812.68 | 49.32 | 0.0 | 0.0 | 862.0 | 862.0 | 0.0 | 862.0 | 0.0 | + | 2 | 31 | 01 January 2023 | | 3363.41 | 823.91 | 38.09 | 0.0 | 0.0 | 862.0 | 638.0 | 638.0 | 0.0 | 224.0 | + | 3 | 31 | 01 February 2023 | | 2535.69 | 827.72 | 34.28 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 4 | 28 | 01 March 2023 | | 1697.03 | 838.66 | 23.34 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 5 | 31 | 01 April 2023 | | 852.33 | 844.7 | 17.3 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 6 | 30 | 01 May 2023 | | 0.0 | 852.33 | 8.41 | 0.0 | 0.0 | 860.74 | 0.0 | 0.0 | 0.0 | 860.74 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 5000.0 | 170.74 | 0.0 | 0.0 | 5170.74 | 1500.0 | 638.0 | 862.0 | 3670.74 | + + @TestRailId:C2625 + Scenario: Verify that the accounting treatment is correct for Goodwill Credit transaction + When Admin sets the business date to "1 January 2023" + 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 | + | PIN30_INTEREST_FLAT | 1 January 2023 | 1000 | 12 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + And Admin adds an NSF fee because of payment bounce with "1 January 2023" transaction date + And Admin adds a 10 % Processing charge to the loan with "en" locale on date: "1 January 2023" + When Admin sets the business date to "10 January 2023" + And Customer makes "AUTOPAY" repayment on "10 January 2023" with 100 EUR transaction amount + When Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "10 January 2023" with 300 EUR transaction amount and system-generated Idempotency key + 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 667.0 | 333.0 | 10.0 | 103.0 | 10.0 | 456.0 | 400.0 | 400.0 | 0.0 | 56.0 | + | 2 | 28 | 01 March 2023 | | 334.0 | 333.0 | 10.0 | 0.0 | 0.0 | 343.0 | 0.0 | 0.0 | 0.0 | 343.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 334.0 | 10.0 | 0.0 | 0.0 | 344.0 | 0.0 | 0.0 | 0.0 | 344.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 30 | 103 | 10 | 1143 | 400 | 400 | 0 | 743 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "10 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112603 | Interest/Fee Receivable | | 100.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 100.0 | | + Then Loan Transactions tab has a "GOODWILL_CREDIT" transaction with date "10 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 277.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 23.0 | + | EXPENSE | 744003 | Goodwill Expense Account | 277.0 | | + | INCOME | 404001 | Interest Income Charge Off | 10.0 | | + | INCOME | 404008 | Fee Charge Off | 13.0 | | + + @Skip @TestRailId:C2626 @chargeoffOnLoanWithInterest + Scenario: Verify that the accounting treatment is correct for Goodwill Credit transaction after Charge-off + When Admin sets the business date to "1 January 2023" + 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 | + | PIN30_INTEREST_FLAT | 1 January 2023 | 1000 | 12 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + And Admin adds an NSF fee because of payment bounce with "1 January 2023" transaction date + And Admin adds a 10 % Processing charge to the loan with "en" locale on date: "1 January 2023" + When Admin sets the business date to "10 January 2023" + And Customer makes "AUTOPAY" repayment on "10 January 2023" with 100 EUR transaction amount + And Admin does charge-off the loan on "10 January 2023" + When Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "10 January 2023" with 300 EUR transaction amount and system-generated Idempotency key + 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 666.67 | 333.33 | 10.0 | 103.0 | 10.0 | 456.33 | 400.0 | 400.0 | 0.0 | 56.33 | + | 2 | 28 | 01 March 2023 | | 333.34 | 333.33 | 10.0 | 0.0 | 0.0 | 343.33 | 0.0 | 0.0 | 0.0 | 343.33 | + | 3 | 31 | 01 April 2023 | | 0.0 | 333.34 | 10.0 | 0.0 | 0.0 | 343.34 | 0.0 | 0.0 | 0.0 | 343.34 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 30 | 103 | 10 | 1143 | 400 | 400 | 0 | 743 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "10 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112603 | Interest/Fee Receivable | | 100.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 100.0 | | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "10 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 43.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 1000.0 | | + | INCOME | 404001 | Interest Income Charge Off | 30.0 | | + | INCOME | 404008 | Fee Charge Off | 13.0 | | + Then Loan Transactions tab has a "GOODWILL_CREDIT" transaction with date "10 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | INCOME | 744008 | Recoveries | | 300.0 | + | EXPENSE | 744003 | Goodwill Expense Account | 277.0 | | + | INCOME | 404001 | Interest Income Charge Off | 10.0 | | + | INCOME | 404008 | Fee Charge Off | 13.0 | | + + @TestRailId:C2627 + Scenario: Verify that the accounting treatment is correct for Goodwill Credit transaction when undo happened + When Admin sets the business date to "1 January 2023" + 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 | + | PIN30_INTEREST_FLAT | 1 January 2023 | 1000 | 12 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + And Admin adds an NSF fee because of payment bounce with "1 January 2023" transaction date + And Admin adds a 10 % Processing charge to the loan with "en" locale on date: "1 January 2023" + When Admin sets the business date to "10 January 2023" + And Customer makes "AUTOPAY" repayment on "10 January 2023" with 100 EUR transaction amount + When Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "10 January 2023" with 300 EUR transaction amount and system-generated Idempotency key + When Customer undo "2"th transaction made on "10 January 2023" + 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 667.0 | 333.0 | 10.0 | 103.0 | 10.0 | 456.0 | 100.0 | 100.0 | 0.0 | 356.0 | + | 2 | 28 | 01 March 2023 | | 334.0 | 333.0 | 10.0 | 0.0 | 0.0 | 343.0 | 0.0 | 0.0 | 0.0 | 343.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 334.0 | 10.0 | 0.0 | 0.0 | 344.0 | 0.0 | 0.0 | 0.0 | 344.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 30 | 103 | 10 | 1143 | 100 | 100 | 0 | 1043 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "10 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112603 | Interest/Fee Receivable | | 100.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 100.0 | | + Then Loan Transactions tab has a "GOODWILL_CREDIT" transaction with date "10 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 277.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 23.0 | + | EXPENSE | 744003 | Goodwill Expense Account | 277.0 | | + | INCOME | 404001 | Interest Income Charge Off | 10.0 | | + | INCOME | 404008 | Fee Charge Off | 13.0 | | + | ASSET | 112601 | Loans Receivable | 277.0 | | + | ASSET | 112603 | Interest/Fee Receivable | 23.0 | | + | EXPENSE | 744003 | Goodwill Expense Account | | 277.0 | + | INCOME | 404001 | Interest Income Charge Off | | 10.0 | + | INCOME | 404008 | Fee Charge Off | | 13.0 | + + @Skip @TestRailId:C2628 @chargeoffOnLoanWithInterest + Scenario: Verify that the accounting treatment is correct for Goodwill Credit transaction when the loan was Charged-off and undo happened for Goodwill + When Admin sets the business date to "1 January 2023" + 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 | + | PIN30_INTEREST_FLAT | 1 January 2023 | 1000 | 12 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + And Admin adds an NSF fee because of payment bounce with "1 January 2023" transaction date + And Admin adds a 10 % Processing charge to the loan with "en" locale on date: "1 January 2023" + When Admin sets the business date to "10 January 2023" + And Customer makes "AUTOPAY" repayment on "10 January 2023" with 100 EUR transaction amount + And Admin does charge-off the loan on "10 January 2023" + When Admin sets the business date to "11 January 2023" + When Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "11 January 2023" with 300 EUR transaction amount and system-generated Idempotency key + When Customer undo "1"th transaction made on "11 January 2023" + 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 666.67 | 333.33 | 10.0 | 103.0 | 10.0 | 456.33 | 100.0 | 100.0 | 0.0 | 356.33 | + | 2 | 28 | 01 March 2023 | | 333.34 | 333.33 | 10.0 | 0.0 | 0.0 | 343.33 | 0.0 | 0.0 | 0.0 | 343.33 | + | 3 | 31 | 01 April 2023 | | 0.0 | 333.34 | 10.0 | 0.0 | 0.0 | 343.34 | 0.0 | 0.0 | 0.0 | 343.34 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 30 | 103 | 10 | 1143 | 100 | 100 | 0 | 1043 | + Then Loan Transactions tab has a "DISBURSEMENT" transaction with date "01 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | 1000.0 | | + | LIABILITY | 145023 | Suspense/Clearing account | | 1000.0 | + Then Loan Transactions tab has a "REPAYMENT" transaction with date "10 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112603 | Interest/Fee Receivable | | 100.0 | + | LIABILITY | 145023 | Suspense/Clearing account | 100.0 | | + Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "10 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | ASSET | 112601 | Loans Receivable | | 1000.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 43.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 1000.0 | | + | INCOME | 404001 | Interest Income Charge Off | 30.0 | | + | INCOME | 404008 | Fee Charge Off | 13.0 | | + Then Loan Transactions tab has a "GOODWILL_CREDIT" transaction with date "11 January 2023" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | INCOME | 744008 | Recoveries | | 300.0 | + | EXPENSE | 744003 | Goodwill Expense Account | 277.0 | | + | INCOME | 404001 | Interest Income Charge Off | 10.0 | | + | INCOME | 404008 | Fee Charge Off | 13.0 | | + | INCOME | 744008 | Recoveries | 300.0 | | + | EXPENSE | 744003 | Goodwill Expense Account | | 277.0 | + | INCOME | 404001 | Interest Income Charge Off | | 10.0 | + | INCOME | 404008 | Fee Charge Off | | 13.0 | + + @TestRailId:C2629 + Scenario: RP11 - Repayment Schedule with interest type: Declining Balance - Prepayment - Reduce number of installments + When Admin sets the business date to "01 November 2022" + 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 | + | PIN30_INTEREST_DECLINING_BALANCE_DAILY_RECALCULATION_COMPOUNDING_NONE_RESCHEDULE_REDUCE_NR_INST | 01 November 2022 | 5000 | 12 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "01 November 2022" with "5000" amount and expected disbursement date on "01 November 2023" + When Admin successfully disburse the loan on "01 November 2022" with "5000" EUR transaction amount + When Admin sets the business date to "01 December 2022" + And Customer makes "AUTOPAY" repayment on "01 December 2022" with 1000 EUR transaction amount + When Admin sets the business date to "01 January 2023" + And Customer makes "AUTOPAY" repayment on "01 January 2023" with 2000 EUR transaction amount + Then Loan Repayment schedule has 5 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 November 2022 | | 5000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 01 December 2022 | 01 December 2022 | 4049.32 | 950.68 | 49.32 | 0.0 | 0.0 | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 January 2023 | 01 January 2023 | 2090.59 | 1958.73 | 41.27 | 0.0 | 0.0 | 2000.0 | 2000.0 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 February 2023 | | 1249.9 | 840.69 | 21.31 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 4 | 28 | 01 March 2023 | | 399.41 | 850.49 | 11.51 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 5 | 31 | 01 April 2023 | | 0.0 | 399.41 | 4.07 | 0.0 | 0.0 | 403.48 | 0.0 | 0.0 | 0.0 | 403.48 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 5000.0 | 127.48 | 0.0 | 0.0 | 5127.48 | 3000.0 | 0.0 | 0.0 | 2127.48 | + + @TestRailId:C2630 + Scenario: RP12 - Repayment Schedule with interest type: Declining Balance - Prepayment - Reduce Installment amount + When Admin sets the business date to "01 November 2022" + 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 | + | PIN30_INTEREST_DECLINING_BALANCE_DAILY_RECALCULATION_COMPOUNDING_NONE | 01 November 2022 | 5000 | 12 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "01 November 2022" with "5000" amount and expected disbursement date on "01 November 2023" + When Admin successfully disburse the loan on "01 November 2022" with "5000" EUR transaction amount + When Admin sets the business date to "01 December 2022" + And Customer makes "AUTOPAY" repayment on "01 December 2022" with 1000 EUR transaction amount + When Admin sets the business date to "01 January 2023" + And Customer makes "AUTOPAY" repayment on "01 January 2023" with 2000 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 | + | | | 01 November 2022 | | 5000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 01 December 2022 | 01 December 2022 | 4049.32 | 950.68 | 49.32 | 0.0 | 0.0 | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 January 2023 | 01 January 2023 | 2090.59 | 1958.73 | 41.27 | 0.0 | 0.0 | 2000.0 | 2000.0 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 February 2023 | | 1575.9 | 514.69 | 21.31 | 0.0 | 0.0 | 536.0 | 0.0 | 0.0 | 0.0 | 536.0 | + | 4 | 28 | 01 March 2023 | | 1054.41 | 521.49 | 14.51 | 0.0 | 0.0 | 536.0 | 0.0 | 0.0 | 0.0 | 536.0 | + | 5 | 31 | 01 April 2023 | | 529.16 | 525.25 | 10.75 | 0.0 | 0.0 | 536.0 | 0.0 | 0.0 | 0.0 | 536.0 | + | 6 | 30 | 01 May 2023 | | 0.0 | 529.16 | 5.22 | 0.0 | 0.0 | 534.38 | 0.0 | 0.0 | 0.0 | 534.38 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 5000.0 | 142.38 | 0.0 | 0.0 | 5142.38 | 3000.0 | 0.0 | 0.0 | 2142.38 | + + @TestRailId:C2631 + Scenario: RP13 - Repayment Schedule with interest type: Declining Balance - Prepayment - Reschedule next repayments + When Admin sets the business date to "01 November 2022" + 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 | + | PIN30_INTEREST_DECLINING_BALANCE_DAILY_RECALCULATION_COMPOUNDING_NONE_RESCHEDULE_RESCH_NEXT_REP | 01 November 2022 | 5000 | 12 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "01 November 2022" with "5000" amount and expected disbursement date on "01 November 2023" + When Admin successfully disburse the loan on "01 November 2022" with "5000" EUR transaction amount + When Admin sets the business date to "01 December 2022" + And Customer makes "AUTOPAY" repayment on "01 December 2022" with 1000 EUR transaction amount + When Admin sets the business date to "01 January 2023" + And Customer makes "AUTOPAY" repayment on "01 January 2023" with 2000 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 | + | | | 01 November 2022 | | 5000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 01 December 2022 | 01 December 2022 | 4049.32 | 950.68 | 49.32 | 0.0 | 0.0 | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | + | 2 | 31 | 01 January 2023 | 01 January 2023 | 2090.59 | 1958.73 | 41.27 | 0.0 | 0.0 | 2000.0 | 2000.0 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 February 2023 | | 2090.59 | 0.0 | 21.31 | 0.0 | 0.0 | 21.31 | 0.0 | 0.0 | 0.0 | 21.31 | + | 4 | 28 | 01 March 2023 | | 1683.14 | 407.45 | 19.24 | 0.0 | 0.0 | 426.69 | 0.0 | 0.0 | 0.0 | 426.69 | + | 5 | 31 | 01 April 2023 | | 838.29 | 844.85 | 17.15 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 6 | 30 | 01 May 2023 | | 0.0 | 838.29 | 8.27 | 0.0 | 0.0 | 846.56 | 0.0 | 0.0 | 0.0 | 846.56 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 5000.0 | 156.56 | 0.0 | 0.0 | 5156.56 | 3000.0 | 0.0 | 0.0 | 2156.56 | + + @TestRailId:C2632 + Scenario: RP14 - Repayment Schedule with interest type: Declining Balance - Interest Recalculation Frequency: Same as Repayment Period - Partial payment + When Admin sets the business date to "01 November 2022" + 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 | + | PIN30_INTEREST_DECLINING_BALANCE_DAILY_RECALCULATION_SAME_AS_REPAYMENT_COMPOUNDING_NONE | 01 November 2022 | 5000 | 12 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "01 November 2022" with "5000" amount and expected disbursement date on "01 November 2023" + When Admin successfully disburse the loan on "01 November 2022" with "5000" EUR transaction amount + When Admin sets the business date to "20 November 2022" + And Customer makes "AUTOPAY" repayment on "20 November 2022" with 200 EUR transaction amount + When Admin sets the business date to "04 January 2023" + And Customer makes "AUTOPAY" repayment on "04 January 2023" with 200 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 | + | | | 01 November 2022 | | 5000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 01 December 2022 | | 4187.32 | 812.68 | 49.32 | 0.0 | 0.0 | 862.0 | 400.0 | 200.0 | 200.0 | 462.0 | + | 2 | 31 | 01 January 2023 | | 3368.0 | 819.32 | 42.68 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 3 | 31 | 01 February 2023 | | 2555.42 | 812.58 | 49.42 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 4 | 28 | 01 March 2023 | | 1716.94 | 838.48 | 23.52 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 5 | 31 | 01 April 2023 | | 872.44 | 844.5 | 17.5 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 6 | 30 | 01 May 2023 | | 0.0 | 872.44 | 8.6 | 0.0 | 0.0 | 881.04 | 0.0 | 0.0 | 0.0 | 881.04 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 5000.0 | 191.04 | 0.0 | 0.0 | 5191.04 | 400.0 | 200.0 | 200.0 | 4791.04 | + + @TestRailId:C2633 + Scenario: RP15 - Repayment Schedule with interest type: Declining Balance - Interest Recalculation Frequency: Same as Repayment Period - Late payment + When Admin sets the business date to "01 November 2022" + 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 | + | PIN30_INTEREST_DECLINING_BALANCE_DAILY_RECALCULATION_SAME_AS_REPAYMENT_COMPOUNDING_NONE | 01 November 2022 | 5000 | 12 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "01 November 2022" with "5000" amount and expected disbursement date on "01 November 2023" + When Admin successfully disburse the loan on "01 November 2022" with "5000" EUR transaction amount + When Admin sets the business date to "01 February 2023" + And Customer makes "AUTOPAY" repayment on "01 February 2023" with 862 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 | + | | | 01 November 2022 | | 5000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 01 December 2022 | 01 February 2023 | 4187.32 | 812.68 | 49.32 | 0.0 | 0.0 | 862.0 | 862.0 | 0.0 | 862.0 | 0.0 | + | 2 | 31 | 01 January 2023 | | 3368.0 | 819.32 | 42.68 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 3 | 31 | 01 February 2023 | | 2556.96 | 811.04 | 50.96 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 4 | 28 | 01 March 2023 | | 1718.5 | 838.46 | 23.54 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 5 | 31 | 01 April 2023 | | 874.01 | 844.49 | 17.51 | 0.0 | 0.0 | 862.0 | 0.0 | 0.0 | 0.0 | 862.0 | + | 6 | 30 | 01 May 2023 | | 0.0 | 874.01 | 8.62 | 0.0 | 0.0 | 882.63 | 0.0 | 0.0 | 0.0 | 882.63 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 5000.0 | 192.63 | 0.0 | 0.0 | 5192.63 | 862.0 | 0.0 | 862.0 | 4330.63 | + + @TestRailId:C2634 + Scenario: RP16 - Repayment Schedule with interest type: Declining Balance - Interest Recalculation Frequency: Same as Repayment Period - Multi-disbursement + When Admin sets the business date to "01 November 2022" + 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 | + | PIN30_INTEREST_DECLINING_BALANCE_SAR_RECALCULATION_SAME_AS_REPAYMENT_COMPOUNDING_NONE_MULTIDISB | 01 November 2022 | 10000 | 12 | DECLINING_BALANCE | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "01 November 2022" with "10000" amount and expected disbursement date on "01 November 2023" + When Admin successfully disburse the loan on "01 November 2022" with "5000" EUR transaction amount + When Admin sets the business date to "01 December 2022" + And Customer makes "AUTOPAY" repayment on "01 December 2022" with 1725 EUR transaction amount + When Admin sets the business date to "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "3000" EUR transaction amount + And Customer makes "AUTOPAY" repayment on "01 January 2023" with 1725 EUR transaction amount + When Admin sets the business date to "01 February 2023" + And Customer makes "AUTOPAY" repayment on "01 February 2023" with 1725 EUR transaction amount + When Admin sets the business date to "01 March 2023" + When Admin successfully disburse the loan on "01 March 2023" with "2000" EUR transaction amount + And Customer makes "AUTOPAY" repayment on "01 March 2023" with 1725 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 | + | | | 01 November 2022 | | 5000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 01 December 2022 | 01 December 2022 | 3325.0 | 1675.0 | 50.0 | 0.0 | 0.0 | 1725.0 | 1725.0 | 0.0 | 0.0 | 0.0 | + | | | 01 January 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 31 | 01 January 2023 | 01 January 2023 | 4633.25 | 1691.75 | 33.25 | 0.0 | 0.0 | 1725.0 | 1725.0 | 0.0 | 0.0 | 0.0 | + | 3 | 31 | 01 February 2023 | 01 February 2023 | 2954.58 | 1678.67 | 46.33 | 0.0 | 0.0 | 1725.0 | 1725.0 | 0.0 | 0.0 | 0.0 | + | | | 01 March 2023 | | 2000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 4 | 28 | 01 March 2023 | 01 March 2023 | 3259.13 | 1695.45 | 29.55 | 0.0 | 0.0 | 1725.0 | 1725.0 | 0.0 | 0.0 | 0.0 | + | 5 | 31 | 01 April 2023 | | 1566.72 | 1692.41 | 32.59 | 0.0 | 0.0 | 1725.0 | 0.0 | 0.0 | 0.0 | 1725.0 | + | 6 | 30 | 01 May 2023 | | 0.0 | 1566.72 | 15.67 | 0.0 | 0.0 | 1582.39 | 0.0 | 0.0 | 0.0 | 1582.39 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 10000.0 | 207.39 | 0.0 | 0.0 | 10207.39 | 6900.0 | 0.0 | 0.0 | 3307.39 | + + + @TestRailId:C2636 @PaymentStrategyDueInAdvance + Scenario: Verify the due-penalty-fee-interest-principal-in-advance-principal-penalty-fee-interest-strategy payment strategy - adding charge due in the future + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE | 1 January 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 1 | MONTHS | 1 | MONTHS | 1 | 0 | 0 | 0 | DUE_PENALTY_FEE_INTEREST_PRINCIPAL_IN_ADVANCE_PRINCIPAL_PENALTY_FEE_INTEREST | + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "10 January 2023" + And Customer makes "AUTOPAY" repayment on "10 January 2023" with 500 EUR transaction amount + When Admin sets the business date to "15 January 2023" + When Admin adds "LOAN_NSF_FEE" due date charge with "20 January 2023" due date and 50 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 January 2023 | Repayment | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 20 January 2023 | Flat | 50.0 | 0.0 | 0.0 | 50.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 50.0 | 1050.0 | 500.0 | 500.0 | 0.0 | 550.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 50 | 1050 | 500 | 500 | 0 | 550 | + + @TestRailId:C2637 @PaymentStrategyDueInAdvance + Scenario: Verify the due-penalty-fee-interest-principal-in-advance-principal-penalty-fee-interest-strategy payment strategy - adding charge due in the future, then repayments before and after charge due date + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE | 1 January 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 1 | MONTHS | 1 | MONTHS | 1 | 0 | 0 | 0 | DUE_PENALTY_FEE_INTEREST_PRINCIPAL_IN_ADVANCE_PRINCIPAL_PENALTY_FEE_INTEREST | + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "10 January 2023" + And Customer makes "AUTOPAY" repayment on "10 January 2023" with 500 EUR transaction amount + When Admin sets the business date to "15 January 2023" + When Admin adds "LOAN_NSF_FEE" due date charge with "20 January 2023" due date and 50 EUR transaction amount + When Admin sets the business date to "17 January 2023" + And Customer makes "AUTOPAY" repayment on "17 January 2023" with 450 EUR transaction amount + When Admin sets the business date to "21 January 2023" + And Customer makes "AUTOPAY" repayment on "21 January 2023" with 50 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 January 2023 | Repayment | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 17 January 2023 | Repayment | 450.0 | 450.0 | 0.0 | 0.0 | 0.0 | 50.0 | + | 21 January 2023 | Repayment | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 50.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 20 January 2023 | Flat | 50.0 | 50.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 50.0 | 1050.0 | 1000.0 | 1000.0 | 0.0 | 50.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 50 | 1050 | 1000 | 1000 | 0 | 50 | + + @TestRailId:C2638 @PaymentStrategyDueInAdvance + Scenario: Verify the due-penalty-fee-interest-principal-in-advance-principal-penalty-fee-interest-strategy payment strategy - adding charge due in the future, then repayment before due date, new charge with due date in future and repayment on first charge due date + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE | 1 January 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 1 | MONTHS | 1 | MONTHS | 1 | 0 | 0 | 0 | DUE_PENALTY_FEE_INTEREST_PRINCIPAL_IN_ADVANCE_PRINCIPAL_PENALTY_FEE_INTEREST | + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "10 January 2023" + And Customer makes "AUTOPAY" repayment on "10 January 2023" with 500 EUR transaction amount + When Admin sets the business date to "15 January 2023" + When Admin adds "LOAN_NSF_FEE" due date charge with "20 January 2023" due date and 50 EUR transaction amount + When Admin sets the business date to "17 January 2023" + And Customer makes "AUTOPAY" repayment on "17 January 2023" with 100 EUR transaction amount + When Admin sets the business date to "19 January 2023" + When Admin adds "LOAN_NSF_FEE" due date charge with "23 January 2023" due date and 10 EUR transaction amount + When Admin sets the business date to "20 January 2023" + And Customer makes "AUTOPAY" repayment on "20 January 2023" with 100 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 January 2023 | Repayment | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 17 January 2023 | Repayment | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 400.0 | + | 20 January 2023 | Repayment | 100.0 | 50.0 | 0.0 | 0.0 | 50.0 | 350.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 20 January 2023 | Flat | 50.0 | 50.0 | 0.0 | 0.0 | + | NSF fee | true | Specified due date | 23 January 2023 | Flat | 10.0 | 0.0 | 0.0 | 10.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 60.0 | 1060.0 | 700.0 | 700.0 | 0.0 | 360.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 60 | 1060 | 700 | 700 | 0 | 360 | + + @Skip @TestRailId:C2639 @PaymentStrategyDueInAdvance + Scenario: Verify the due-penalty-fee-interest-principal-in-advance-principal-penalty-fee-interest-strategy payment strategy - adding charge due in the future, then repayment before due date with full amount + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE | 1 January 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 1 | MONTHS | 1 | MONTHS | 1 | 0 | 0 | 0 | DUE_PENALTY_FEE_INTEREST_PRINCIPAL_IN_ADVANCE_PRINCIPAL_PENALTY_FEE_INTEREST | + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "10 January 2023" + And Customer makes "AUTOPAY" repayment on "10 January 2023" with 500 EUR transaction amount + When Admin sets the business date to "15 January 2023" + When Admin adds "LOAN_NSF_FEE" due date charge with "20 January 2023" due date and 50 EUR transaction amount + When Admin sets the business date to "17 January 2023" + And Customer makes "AUTOPAY" repayment on "17 January 2023" with 550 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 January 2023 | Repayment | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 17 January 2023 | Repayment | 550.0 | 500.0 | 0.0 | 0.0 | 50.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 20 January 2023 | Flat | 50.0 | 50.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 17 January 2023 | 0.0 | 1000.0 | 0.0 | 0.0 | 50.0 | 1050.0 | 1050.0 | 1000.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 50 | 1050 | 1050 | 1000 | 0 | 0 | + + @TestRailId:C2655 @PaymentStrategyDueInAdvance + Scenario: Verify the due-penalty-fee-interest-principal-in-advance-principal-penalty-fee-interest-strategy payment strategy - due principal + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE | 01 January 2023 | 3000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_FEE_INTEREST_PRINCIPAL_IN_ADVANCE_PRINCIPAL_PENALTY_FEE_INTEREST | + And Admin successfully approves the loan on "01 January 2023" with "3000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "3000" EUR transaction amount + When Admin sets the business date to "01 February 2023" + And Customer makes "AUTOPAY" repayment on "01 February 2023" with 1000 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 3000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | + | 01 February 2023 | Repayment | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 2000.0 | + 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 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 01 February 2023 | 2000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | + | 2 | 28 | 01 March 2023 | | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 0 | 0 | 0 | 3000 | 1000 | 0 | 0 | 2000 | + + @TestRailId:C2656 @PaymentStrategyDueInAdvance + Scenario: Verify the due-penalty-fee-interest-principal-in-advance-principal-penalty-fee-interest-strategy payment strategy - inAdvance principal + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE | 01 January 2023 | 3000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_FEE_INTEREST_PRINCIPAL_IN_ADVANCE_PRINCIPAL_PENALTY_FEE_INTEREST | + And Admin successfully approves the loan on "01 January 2023" with "3000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "3000" EUR transaction amount + When Admin sets the business date to "10 January 2023" + And Customer makes "AUTOPAY" repayment on "10 January 2023" with 1000 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 3000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | + | 10 January 2023 | Repayment | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 2000.0 | + 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 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 10 January 2023 | 2000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 1000.0 | 1000.0 | 0.0 | 0.0 | + | 2 | 28 | 01 March 2023 | | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 0 | 0 | 0 | 3000 | 1000 | 1000 | 0 | 2000 | + + @TestRailId:C2657 @PaymentStrategyDueInAdvance + Scenario: Verify the due-penalty-fee-interest-principal-in-advance-principal-penalty-fee-interest-strategy payment strategy - due + inAdvance principal + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE | 01 January 2023 | 3000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_FEE_INTEREST_PRINCIPAL_IN_ADVANCE_PRINCIPAL_PENALTY_FEE_INTEREST | + And Admin successfully approves the loan on "01 January 2023" with "3000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "3000" EUR transaction amount + When Admin sets the business date to "01 February 2023" + And Customer makes "AUTOPAY" repayment on "01 February 2023" with 1500 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 3000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | + | 01 February 2023 | Repayment | 1500.0 | 1500.0 | 0.0 | 0.0 | 0.0 | 1500.0 | + 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 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 01 February 2023 | 2000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | + | 2 | 28 | 01 March 2023 | | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 500.0 | 500.0 | 0.0 | 500.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 0 | 0 | 0 | 3000 | 1500 | 500 | 0 | 1500 | + + @TestRailId:C2658 @PaymentStrategyDueInAdvance + Scenario: Verify the due-penalty-fee-interest-principal-in-advance-principal-penalty-fee-interest-strategy payment strategy - due penalty + due principal + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE | 01 January 2023 | 3000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_FEE_INTEREST_PRINCIPAL_IN_ADVANCE_PRINCIPAL_PENALTY_FEE_INTEREST | + And Admin successfully approves the loan on "01 January 2023" with "3000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "3000" EUR transaction amount + When Admin sets the business date to "01 February 2023" + When Admin adds "LOAN_NSF_FEE" due date charge with "01 February 2023" due date and 50 EUR transaction amount + And Customer makes "AUTOPAY" repayment on "01 February 2023" with 500 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 3000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | + | 01 February 2023 | Repayment | 500.0 | 450.0 | 0.0 | 0.0 | 50.0 | 2550.0 | + 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 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 2000.0 | 1000.0 | 0.0 | 0.0 | 50.0 | 1050.0 | 500.0 | 0.0 | 0.0 | 550.0 | + | 2 | 28 | 01 March 2023 | | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 0 | 0 | 50 | 3050 | 500 | 0 | 0 | 2550 | + + @TestRailId:C2659 @PaymentStrategyDueInAdvance + Scenario: Verify the due-penalty-fee-interest-principal-in-advance-principal-penalty-fee-interest-strategy payment strategy - due fee + due principal + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE | 01 January 2023 | 3000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_FEE_INTEREST_PRINCIPAL_IN_ADVANCE_PRINCIPAL_PENALTY_FEE_INTEREST | + And Admin successfully approves the loan on "01 January 2023" with "3000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "3000" EUR transaction amount + When Admin sets the business date to "01 February 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "01 February 2023" due date and 50 EUR transaction amount + And Customer makes "AUTOPAY" repayment on "01 February 2023" with 500 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 3000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | + | 01 February 2023 | Repayment | 500.0 | 450.0 | 0.0 | 50.0 | 0.0 | 2550.0 | + 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 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 2000.0 | 1000.0 | 0.0 | 50.0 | 0.0 | 1050.0 | 500.0 | 0.0 | 0.0 | 550.0 | + | 2 | 28 | 01 March 2023 | | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 0 | 50 | 0 | 3050 | 500 | 0 | 0 | 2550 | + + @TestRailId:C2660 @PaymentStrategyDueInAdvance + Scenario: Verify the due-penalty-fee-interest-principal-in-advance-principal-penalty-fee-interest-strategy payment strategy - due interest + due principal + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE_INTEREST_FLAT | 01 January 2023 | 3000 | 12 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_FEE_INTEREST_PRINCIPAL_IN_ADVANCE_PRINCIPAL_PENALTY_FEE_INTEREST | + And Admin successfully approves the loan on "01 January 2023" with "3000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "3000" EUR transaction amount + When Admin sets the business date to "01 February 2023" + And Customer makes "AUTOPAY" repayment on "01 February 2023" with 500 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 3000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | + | 01 February 2023 | Repayment | 500.0 | 470.0 | 30.0 | 0.0 | 0.0 | 2530.0 | + 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 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 2000.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 500.0 | 0.0 | 0.0 | 530.0 | + | 2 | 28 | 01 March 2023 | | 1000.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 90 | 0 | 0 | 3090 | 500 | 0 | 0 | 2590 | + + @TestRailId:C2661 @PaymentStrategyDueInAdvance + Scenario: Verify the due-penalty-fee-interest-principal-in-advance-principal-penalty-fee-interest-strategy payment strategy - due penalty + due fee + due principal + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE | 01 January 2023 | 3000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_FEE_INTEREST_PRINCIPAL_IN_ADVANCE_PRINCIPAL_PENALTY_FEE_INTEREST | + And Admin successfully approves the loan on "01 January 2023" with "3000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "3000" EUR transaction amount + When Admin sets the business date to "01 February 2023" + When Admin adds "LOAN_NSF_FEE" due date charge with "01 February 2023" due date and 50 EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "01 February 2023" due date and 50 EUR transaction amount + And Customer makes "AUTOPAY" repayment on "01 February 2023" with 500 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 3000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | + | 01 February 2023 | Repayment | 500.0 | 400.0 | 0.0 | 50.0 | 50.0 | 2600.0 | + 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 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 2000.0 | 1000.0 | 0.0 | 50.0 | 50.0 | 1100.0 | 500.0 | 0.0 | 0.0 | 600.0 | + | 2 | 28 | 01 March 2023 | | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 0 | 50 | 50 | 3100 | 500 | 0 | 0 | 2600 | + + @TestRailId:C2662 @PaymentStrategyDueInAdvance + Scenario: Verify the due-penalty-fee-interest-principal-in-advance-principal-penalty-fee-interest-strategy payment strategy - due penalty + inAdvance principal + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE | 01 January 2023 | 3000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_FEE_INTEREST_PRINCIPAL_IN_ADVANCE_PRINCIPAL_PENALTY_FEE_INTEREST | + And Admin successfully approves the loan on "01 January 2023" with "3000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "3000" EUR transaction amount + When Admin sets the business date to "15 January 2023" + When Admin adds "LOAN_NSF_FEE" due date charge with "15 January 2023" due date and 50 EUR transaction amount + And Customer makes "AUTOPAY" repayment on "15 January 2023" with 500 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 3000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | + | 15 January 2023 | Repayment | 500.0 | 450.0 | 0.0 | 0.0 | 50.0 | 2550.0 | + 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 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 2000.0 | 1000.0 | 0.0 | 0.0 | 50.0 | 1050.0 | 500.0 | 500.0 | 0.0 | 550.0 | + | 2 | 28 | 01 March 2023 | | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 0 | 0 | 50 | 3050 | 500 | 500 | 0 | 2550 | + + @TestRailId:C2663 @PaymentStrategyDueInAdvance + Scenario: Verify the due-penalty-fee-interest-principal-in-advance-principal-penalty-fee-interest-strategy payment strategy - due penalty + inAdvance principal + inAdvance penalty not effective because of partial payment + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE | 01 January 2023 | 3000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_FEE_INTEREST_PRINCIPAL_IN_ADVANCE_PRINCIPAL_PENALTY_FEE_INTEREST | + And Admin successfully approves the loan on "01 January 2023" with "3000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "3000" EUR transaction amount + When Admin sets the business date to "15 January 2023" + When Admin adds "LOAN_NSF_FEE" due date charge with "15 January 2023" due date and 50 EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "20 January 2023" due date and 50 EUR transaction amount + And Customer makes "AUTOPAY" repayment on "15 January 2023" with 500 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 3000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | + | 15 January 2023 | Repayment | 500.0 | 450.0 | 0.0 | 0.0 | 50.0 | 2550.0 | + 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 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 2000.0 | 1000.0 | 0.0 | 0.0 | 100.0 | 1100.0 | 500.0 | 500.0 | 0.0 | 600.0 | + | 2 | 28 | 01 March 2023 | | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 0 | 0 | 100 | 3100 | 500 | 500 | 0 | 2600 | + + @TestRailId:C2664 @PaymentStrategyDueInAdvance + Scenario: Verify the due-penalty-fee-interest-principal-in-advance-principal-penalty-fee-interest-strategy payment strategy - due penalty + inAdvance principal + inAdvance penalty + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE | 01 January 2023 | 3000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_FEE_INTEREST_PRINCIPAL_IN_ADVANCE_PRINCIPAL_PENALTY_FEE_INTEREST | + And Admin successfully approves the loan on "01 January 2023" with "3000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "3000" EUR transaction amount + When Admin sets the business date to "15 January 2023" + When Admin adds "LOAN_NSF_FEE" due date charge with "15 January 2023" due date and 50 EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "20 January 2023" due date and 50 EUR transaction amount + And Customer makes "AUTOPAY" repayment on "15 January 2023" with 1100 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 3000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | + | 15 January 2023 | Repayment | 1100.0 | 1000.0 | 0.0 | 0.0 | 100.0 | 2000.0 | + 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 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 15 January 2023 | 2000.0 | 1000.0 | 0.0 | 0.0 | 100.0 | 1100.0 | 1100.0 | 1100.0 | 0.0 | 0.0 | + | 2 | 28 | 01 March 2023 | | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 0 | 0 | 100 | 3100 | 1100 | 1100 | 0 | 2000 | + + @TestRailId:C2665 @PaymentStrategyDueInAdvance + Scenario: Verify the due-penalty-fee-interest-principal-in-advance-principal-penalty-fee-interest-strategy payment strategy - due penalty + inAdvance principal + inAdvance penalty + inAdvance fee + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE | 01 January 2023 | 3000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_FEE_INTEREST_PRINCIPAL_IN_ADVANCE_PRINCIPAL_PENALTY_FEE_INTEREST | + And Admin successfully approves the loan on "01 January 2023" with "3000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "3000" EUR transaction amount + When Admin sets the business date to "15 January 2023" + When Admin adds "LOAN_NSF_FEE" due date charge with "15 January 2023" due date and 50 EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "20 January 2023" due date and 50 EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "20 January 2023" due date and 50 EUR transaction amount + And Customer makes "AUTOPAY" repayment on "15 January 2023" with 1150 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 3000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | + | 15 January 2023 | Repayment | 1150.0 | 1000.0 | 0.0 | 50.0 | 100.0 | 2000.0 | + 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 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 15 January 2023 | 2000.0 | 1000.0 | 0.0 | 50.0 | 100.0 | 1150.0 | 1150.0 | 1150.0 | 0.0 | 0.0 | + | 2 | 28 | 01 March 2023 | | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 0 | 50 | 100 | 3150 | 1150 | 1150 | 0 | 2000 | + + @TestRailId:C2666 @PaymentStrategyDueInAdvance + Scenario: Verify the due-penalty-fee-interest-principal-in-advance-principal-penalty-fee-interest-strategy payment strategy - due penalty + inAdvance principal + inAdvance penalty + inAdvance fee + inAdvance interest + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE_INTEREST_FLAT | 01 January 2023 | 3000 | 12 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_FEE_INTEREST_PRINCIPAL_IN_ADVANCE_PRINCIPAL_PENALTY_FEE_INTEREST | + And Admin successfully approves the loan on "01 January 2023" with "3000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "3000" EUR transaction amount + When Admin sets the business date to "15 January 2023" + When Admin adds "LOAN_NSF_FEE" due date charge with "15 January 2023" due date and 50 EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "20 January 2023" due date and 50 EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "20 January 2023" due date and 50 EUR transaction amount + And Customer makes "AUTOPAY" repayment on "15 January 2023" with 1180 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 3000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | + | 15 January 2023 | Repayment | 1180.0 | 1000.0 | 30.0 | 50.0 | 100.0 | 2000.0 | + 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 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 15 January 2023 | 2000.0 | 1000.0 | 30.0 | 50.0 | 100.0 | 1180.0 | 1180.0 | 1180.0 | 0.0 | 0.0 | + | 2 | 28 | 01 March 2023 | | 1000.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 90 | 50 | 100 | 3240 | 1180 | 1180 | 0 | 2060 | + + + @TestRailId:C2667 @PaymentStrategyDueInAdvance + Scenario: Verify the due-penalty-fee-interest-principal-in-advance-principal-penalty-fee-interest-strategy payment strategy - repayment + reversal + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE_INTEREST_FLAT | 01 January 2023 | 3000 | 12 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_FEE_INTEREST_PRINCIPAL_IN_ADVANCE_PRINCIPAL_PENALTY_FEE_INTEREST | + And Admin successfully approves the loan on "01 January 2023" with "3000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "3000" EUR transaction amount + When Admin sets the business date to "15 January 2023" + When Admin adds "LOAN_NSF_FEE" due date charge with "15 January 2023" due date and 50 EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "20 January 2023" due date and 50 EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "20 January 2023" due date and 50 EUR transaction amount + And Customer makes "AUTOPAY" repayment on "15 January 2023" with 1180 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 3000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | + | 15 January 2023 | Repayment | 1180.0 | 1000.0 | 30.0 | 50.0 | 100.0 | 2000.0 | + 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 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 15 January 2023 | 2000.0 | 1000.0 | 30.0 | 50.0 | 100.0 | 1180.0 | 1180.0 | 1180.0 | 0.0 | 0.0 | + | 2 | 28 | 01 March 2023 | | 1000.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 90 | 50 | 100 | 3240 | 1180 | 1180 | 0 | 2060 | + When Customer undo "1"th transaction made on "15 January 2023" + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 3000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | + | 15 January 2023 | Repayment | 1180.0 | 1000.0 | 30.0 | 50.0 | 100.0 | 2000.0 | + 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 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 2000.0 | 1000.0 | 30.0 | 50.0 | 100.0 | 1180.0 | 0.0 | 0.0 | 0.0 | 1180.0 | + | 2 | 28 | 01 March 2023 | | 1000.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 90 | 50 | 100 | 3240 | 0 | 0 | 0 | 3240 | + + @TestRailId:C2668 @PaymentStrategyDueInAdvance + Scenario: Verify the due-penalty-fee-interest-principal-in-advance-principal-penalty-fee-interest-strategy payment strategy - merchant issued refund + reversal + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE_INTEREST_FLAT | 01 January 2023 | 3000 | 12 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_FEE_INTEREST_PRINCIPAL_IN_ADVANCE_PRINCIPAL_PENALTY_FEE_INTEREST | + And Admin successfully approves the loan on "01 January 2023" with "3000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "3000" EUR transaction amount + When Admin sets the business date to "15 January 2023" + When Admin adds "LOAN_NSF_FEE" due date charge with "15 January 2023" due date and 50 EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "20 January 2023" due date and 50 EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "20 January 2023" due date and 50 EUR transaction amount + When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "15 January 2023" with 1180 EUR transaction amount and system-generated Idempotency key + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 3000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | + | 15 January 2023 | Merchant Issued Refund | 1180.0 | 1000.0 | 30.0 | 50.0 | 100.0 | 2000.0 | + 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 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 15 January 2023 | 2000.0 | 1000.0 | 30.0 | 50.0 | 100.0 | 1180.0 | 1180.0 | 1180.0 | 0.0 | 0.0 | + | 2 | 28 | 01 March 2023 | | 1000.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 90 | 50 | 100 | 3240 | 1180 | 1180 | 0 | 2060 | + When Customer undo "1"th transaction made on "15 January 2023" + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 3000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | + | 15 January 2023 | Merchant Issued Refund | 1180.0 | 1000.0 | 30.0 | 50.0 | 100.0 | 2000.0 | + 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 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 2000.0 | 1000.0 | 30.0 | 50.0 | 100.0 | 1180.0 | 0.0 | 0.0 | 0.0 | 1180.0 | + | 2 | 28 | 01 March 2023 | | 1000.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 90 | 50 | 100 | 3240 | 0 | 0 | 0 | 3240 | + + @TestRailId:C2669 @PaymentStrategyDueInAdvance + Scenario: Verify the due-penalty-fee-interest-principal-in-advance-principal-penalty-fee-interest-strategy payment strategy - payout refund + reversal + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE_INTEREST_FLAT | 01 January 2023 | 3000 | 12 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_FEE_INTEREST_PRINCIPAL_IN_ADVANCE_PRINCIPAL_PENALTY_FEE_INTEREST | + And Admin successfully approves the loan on "01 January 2023" with "3000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "3000" EUR transaction amount + When Admin sets the business date to "15 January 2023" + When Admin adds "LOAN_NSF_FEE" due date charge with "15 January 2023" due date and 50 EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "20 January 2023" due date and 50 EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "20 January 2023" due date and 50 EUR transaction amount + When Customer makes "PAYOUT_REFUND" transaction with "AUTOPAY" payment type on "15 January 2023" with 1180 EUR transaction amount and system-generated Idempotency key + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 3000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | + | 15 January 2023 | Payout Refund | 1180.0 | 1000.0 | 30.0 | 50.0 | 100.0 | 2000.0 | + 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 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 15 January 2023 | 2000.0 | 1000.0 | 30.0 | 50.0 | 100.0 | 1180.0 | 1180.0 | 1180.0 | 0.0 | 0.0 | + | 2 | 28 | 01 March 2023 | | 1000.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 90 | 50 | 100 | 3240 | 1180 | 1180 | 0 | 2060 | + When Customer undo "1"th transaction made on "15 January 2023" + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 3000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | + | 15 January 2023 | Payout Refund | 1180.0 | 1000.0 | 30.0 | 50.0 | 100.0 | 2000.0 | + 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 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 2000.0 | 1000.0 | 30.0 | 50.0 | 100.0 | 1180.0 | 0.0 | 0.0 | 0.0 | 1180.0 | + | 2 | 28 | 01 March 2023 | | 1000.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 90 | 50 | 100 | 3240 | 0 | 0 | 0 | 3240 | + + @TestRailId:C2670 @PaymentStrategyDueInAdvance + Scenario: Verify the due-penalty-fee-interest-principal-in-advance-principal-penalty-fee-interest-strategy payment strategy - goodwill credit transaction + reversal + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE_INTEREST_FLAT | 01 January 2023 | 3000 | 12 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_FEE_INTEREST_PRINCIPAL_IN_ADVANCE_PRINCIPAL_PENALTY_FEE_INTEREST | + And Admin successfully approves the loan on "01 January 2023" with "3000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "3000" EUR transaction amount + When Admin sets the business date to "15 January 2023" + When Admin adds "LOAN_NSF_FEE" due date charge with "15 January 2023" due date and 50 EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "20 January 2023" due date and 50 EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "20 January 2023" due date and 50 EUR transaction amount + When Customer makes "GOODWILL_CREDIT" transaction with "AUTOPAY" payment type on "15 January 2023" with 1180 EUR transaction amount and system-generated Idempotency key + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 3000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | + | 15 January 2023 | Goodwill Credit | 1180.0 | 1000.0 | 30.0 | 50.0 | 100.0 | 2000.0 | + 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 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 15 January 2023 | 2000.0 | 1000.0 | 30.0 | 50.0 | 100.0 | 1180.0 | 1180.0 | 1180.0 | 0.0 | 0.0 | + | 2 | 28 | 01 March 2023 | | 1000.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 90 | 50 | 100 | 3240 | 1180 | 1180 | 0 | 2060 | + When Customer undo "1"th transaction made on "15 January 2023" + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 3000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | + | 15 January 2023 | Goodwill Credit | 1180.0 | 1000.0 | 30.0 | 50.0 | 100.0 | 2000.0 | + 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 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 2000.0 | 1000.0 | 30.0 | 50.0 | 100.0 | 1180.0 | 0.0 | 0.0 | 0.0 | 1180.0 | + | 2 | 28 | 01 March 2023 | | 1000.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 90 | 50 | 100 | 3240 | 0 | 0 | 0 | 3240 | + + @TestRailId:C2671 @PaymentStrategyDueInAdvance + Scenario: Verify the due-penalty-fee-interest-principal-in-advance-principal-penalty-fee-interest-strategy payment strategy - repayment + charge adjustment + charge adjustment reversal + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE_INTEREST_FLAT | 01 January 2023 | 3000 | 12 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | DUE_PENALTY_FEE_INTEREST_PRINCIPAL_IN_ADVANCE_PRINCIPAL_PENALTY_FEE_INTEREST | + And Admin successfully approves the loan on "01 January 2023" with "3000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "3000" EUR transaction amount + When Admin sets the business date to "15 January 2023" + When Admin adds "LOAN_NSF_FEE" due date charge with "15 January 2023" due date and 50 EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "20 January 2023" due date and 50 EUR transaction amount + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "20 January 2023" due date and 50 EUR transaction amount + And Customer makes "AUTOPAY" repayment on "15 January 2023" with 1180 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 3000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | + | 15 January 2023 | Repayment | 1180.0 | 1000.0 | 30.0 | 50.0 | 100.0 | 2000.0 | + 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 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 15 January 2023 | 2000.0 | 1000.0 | 30.0 | 50.0 | 100.0 | 1180.0 | 1180.0 | 1180.0 | 0.0 | 0.0 | + | 2 | 28 | 01 March 2023 | | 1000.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 90 | 50 | 100 | 3240 | 1180 | 1180 | 0 | 2060 | + When Admin sets the business date to "27 January 2023" + When Admin makes a charge adjustment for the last "LOAN_NSF_FEE" type charge which is due on "20 January 2023" with 50 EUR transaction amount and externalId "" + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 3000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | + | 15 January 2023 | Repayment | 1180.0 | 1000.0 | 30.0 | 50.0 | 100.0 | 2000.0 | + | 27 January 2023 | Charge Adjustment | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 1950.0 | + 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 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 15 January 2023 | 2000.0 | 1000.0 | 30.0 | 50.0 | 100.0 | 1180.0 | 1180.0 | 1180.0 | 0.0 | 0.0 | + | 2 | 28 | 01 March 2023 | | 1000.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 50.0 | 50.0 | 0.0 | 980.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 90 | 50 | 100 | 3240 | 1230 | 1230 | 0 | 2010 | + When Admin sets the business date to "30 January 2023" + When Admin reverts the charge adjustment which was raised on "27 January 2023" 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 2023 | Disbursement | 3000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 3000.0 | false | + | 15 January 2023 | Repayment | 1180.0 | 1000.0 | 30.0 | 50.0 | 100.0 | 2000.0 | false | + | 27 January 2023 | Charge Adjustment | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 1950.0 | true | + 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 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 15 January 2023 | 2000.0 | 1000.0 | 30.0 | 50.0 | 100.0 | 1180.0 | 1180.0 | 1180.0 | 0.0 | 0.0 | + | 2 | 28 | 01 March 2023 | | 1000.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | + | 3 | 31 | 01 April 2023 | | 0.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 90 | 50 | 100 | 3240 | 1180 | 1180 | 0 | 2060 | + + + @TestRailId:C2682 @PaymentStrategyDueInAdvance + Scenario: Verify the due-penalty-fee-interest-principal-in-advance-principal-penalty-fee-interest-strategy payment strategy - fee - repayment - nsffee - chargeback - repayment + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE | 01 January 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 1 | MONTHS | 1 | MONTHS | 1 | 0 | 0 | 0 | DUE_PENALTY_FEE_INTEREST_PRINCIPAL_IN_ADVANCE_PRINCIPAL_PENALTY_FEE_INTEREST | + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "10 January 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "10 January 2023" due date and 10 EUR transaction amount + When Admin sets the business date to "15 January 2023" + And Customer makes "AUTOPAY" repayment on "15 January 2023" with 500 EUR transaction amount + When Admin sets the business date to "18 January 2023" + When Admin adds "LOAN_NSF_FEE" due date charge with "18 January 2023" due date and 25 EUR transaction amount + And Admin makes "REPAYMENT_ADJUSTMENT_CHARGEBACK" chargeback with 500 EUR transaction amount for Payment nr. 1 + When Admin sets the business date to "21 January 2023" + And Customer makes "AUTOPAY" repayment on "21 January 2023" with 500 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 15 January 2023 | Repayment | 500.0 | 490.0 | 0.0 | 10.0 | 0.0 | 510.0 | + | 18 January 2023 | Chargeback | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 1010.0 | + | 21 January 2023 | Repayment | 500.0 | 475.0 | 0.0 | 0.0 | 25.0 | 535.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 0.0 | 1500.0 | 0.0 | 10.0 | 25.0 | 1535.0 | 1000.0 | 1000.0 | 0.0 | 535.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1500 | 0 | 10 | 25 | 1535 | 1000 | 1000 | 0 | 535 | + + @Skip @TestRailId:C2799 @PaymentStrategyDueInAdvance + Scenario: Verify the due-penalty-fee-interest-principal-in-advance-principal-penalty-fee-interest-strategy payment strategy: Same day transaction + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE | 1 January 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 1 | MONTHS | 1 | MONTHS | 1 | 0 | 0 | 0 | DUE_PENALTY_FEE_INTEREST_PRINCIPAL_IN_ADVANCE_PRINCIPAL_PENALTY_FEE_INTEREST | + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "04 January 2023" + And Customer makes "AUTOPAY" repayment on "04 January 2023" with 200 EUR transaction amount + When Admin sets the business date to "12 January 2023" + And Customer makes "AUTOPAY" repayment on "12 January 2023" with 300 EUR transaction amount + And Admin adds a 1 % Processing charge to the loan with "en" locale on date: "12 January 2023" + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 04 January 2023 | Repayment | 200.0 | 200.0 | 0.0 | 0.0 | 0.0 | 800.0 | + | 12 January 2023 | Repayment | 300.0 | 300.0 | 0.0 | 0.0 | 0.0 | 500.0 | + And Customer makes "AUTOPAY" repayment on "12 January 2023" with 510 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 04 January 2023 | Repayment | 200.0 | 200.0 | 0.0 | 0.0 | 0.0 | 800.0 | + | 12 January 2023 | Repayment | 300.0 | 300.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 12 January 2023 | Accrual | 10.0 | 0.0 | 0.0 | 10.0 | 0.0 | 0.0 | + | 12 January 2023 | Repayment | 510.0 | 500.0 | 0.0 | 10.0 | 0.0 | 0.0 | + + @TestRailId:C2694 @PaymentStrategyDueInAdvancePenaltyInterestPrincipalFee + Scenario: Verify the due-penalty-interest-principal-fee-in-advance-penalty-interest-principal-fee-strategy payment strategy: UC1 - no fees or penalties, due payment + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | 01 January 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 1 | MONTHS | 1 | MONTHS | 1 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "01 February 2023" + And Customer makes "AUTOPAY" repayment on "01 February 2023" with 1000 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 February 2023 | Repayment | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 01 February 2023 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 0 | 1000 | 1000 | 0 | 0 | 0 | + + @TestRailId:C2695 @PaymentStrategyDueInAdvancePenaltyInterestPrincipalFee + Scenario: Verify the due-penalty-interest-principal-fee-in-advance-penalty-interest-principal-fee-strategy payment strategy: UC2 - due principal, fee + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | 01 January 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 1 | MONTHS | 1 | MONTHS | 1 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "25 January 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "01 February 2023" due date and 20 EUR transaction amount + When Admin sets the business date to "01 February 2023" + And Customer makes "AUTOPAY" repayment on "01 February 2023" with 1020 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 01 February 2023 | Repayment | 1020.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 01 February 2023 | Accrual | 20.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 01 February 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 01 February 2023 | 0.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 1020.0 | 1020.0 | 0.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20 | 0 | 1020 | 1020 | 0 | 0 | 0 | + + @TestRailId:C2696 @PaymentStrategyDueInAdvancePenaltyInterestPrincipalFee + Scenario: Verify the due-penalty-interest-principal-fee-in-advance-penalty-interest-principal-fee-strategy payment strategy: UC3 - in advance principal, reverted, due penalty, principal + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | 01 January 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 1 | MONTHS | 1 | MONTHS | 1 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + + When Admin sets the business date to "25 January 2023" + And Customer makes "AUTOPAY" repayment on "25 January 2023" with 1000 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 25 January 2023 | Repayment | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | + + When Admin sets the business date to "28 January 2023" + When Customer undo "1"th "Repayment" transaction made on "25 January 2023" + When Admin adds "LOAN_NSF_FEE" due date charge with "28 January 2023" due date and 20 EUR transaction amount + Then Loan status will be "ACTIVE" + Then On Loan Transactions tab the "Repayment" Transaction with date "25 January 2023" is reverted + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 25 January 2023 | Repayment | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 28 January 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + + When Admin sets the business date to "01 February 2023" + And Customer makes "AUTOPAY" repayment on "01 February 2023" with 1020 EUR transaction amount + Then On Loan Transactions tab the "Repayment" Transaction with date "25 January 2023" is reverted + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 25 January 2023 | Repayment | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 01 February 2023 | Repayment | 1020.0 | 1000.0 | 0.0 | 0.0 | 20.0 | 0.0 | + | 01 February 2023 | Accrual | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 28 January 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 01 February 2023 | 0.0 | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 1020.0 | 0.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 20 | 1020 | 1020 | 0 | 0 | 0 | + + @TestRailId:C2697 @PaymentStrategyDueInAdvancePenaltyInterestPrincipalFee + Scenario: Verify the due-penalty-interest-principal-fee-in-advance-penalty-interest-principal-fee-strategy payment strategy: UC4 - in advance principal, fee, reverted, due penalty, principal, fee + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | 01 January 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 1 | MONTHS | 1 | MONTHS | 1 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + + When Admin sets the business date to "10 January 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "01 February 2023" due date and 20 EUR transaction amount + + When Admin sets the business date to "25 January 2023" + And Customer makes "AUTOPAY" repayment on "25 January 2023" with 1020 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 25 January 2023 | Repayment | 1020.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 25 January 2023 | Accrual | 20.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 01 February 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 25 January 2023 | 0.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 1020.0 | 1020.0 | 1020.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20 | 0 | 1020 | 1020 | 1020 | 0 | 0 | + + When Admin sets the business date to "28 January 2023" + When Customer undo "1"th "Repayment" transaction made on "25 January 2023" + When Admin adds "LOAN_NSF_FEE" due date charge with "01 February 2023" due date and 20 EUR transaction amount + Then On Loan Transactions tab the "Repayment" Transaction with date "25 January 2023" is reverted + 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 | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 25 January 2023 | Repayment | 1020.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 25 January 2023 | Accrual | 20.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 01 February 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 01 February 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + + When Admin sets the business date to "01 February 2023" + And Customer makes "AUTOPAY" repayment on "01 February 2023" with 1040 EUR transaction amount + Then On Loan Transactions tab the "Repayment" Transaction with date "25 January 2023" is reverted + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 25 January 2023 | Repayment | 1020.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 25 January 2023 | Accrual | 20.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 01 February 2023 | Repayment | 1040.0 | 1000.0 | 0.0 | 20.0 | 20.0 | 0.0 | + | 01 February 2023 | Accrual | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 01 February 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + | NSF fee | true | Specified due date | 01 February 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 01 February 2023 | 0.0 | 1000.0 | 0.0 | 20.0 | 20.0 | 1040.0 | 1040.0 | 0.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20 | 20 | 1040 | 1040 | 0 | 0 | 0 | + + @TestRailId:C2698 @PaymentStrategyDueInAdvancePenaltyInterestPrincipalFee + Scenario: Verify the due-penalty-interest-principal-fee-in-advance-penalty-interest-principal-fee-strategy payment strategy: UC5 - in advance principal, fee, reverted, multiple due penalty, principal + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | 01 January 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 1 | MONTHS | 1 | MONTHS | 1 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + + When Admin sets the business date to "10 January 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "01 February 2023" due date and 20 EUR transaction amount + + When Admin sets the business date to "25 January 2023" + And Customer makes "AUTOPAY" repayment on "25 January 2023" with 1020 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 25 January 2023 | Repayment | 1020.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 25 January 2023 | Accrual | 20.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 01 February 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 25 January 2023 | 0.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 1020.0 | 1020.0 | 1020.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20 | 0 | 1020 | 1020 | 1020 | 0 | 0 | + + When Admin sets the business date to "28 January 2023" + When Customer undo "1"th "Repayment" transaction made on "25 January 2023" + When Admin adds "LOAN_NSF_FEE" due date charge with "01 February 2023" due date and 20 EUR transaction amount + Then On Loan Transactions tab the "Repayment" Transaction with date "25 January 2023" is reverted + 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 | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 25 January 2023 | Repayment | 1020.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 25 January 2023 | Accrual | 20.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 01 February 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 01 February 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + + When Admin sets the business date to "01 February 2023" + And Customer makes "AUTOPAY" repayment on "01 February 2023" with 1040 EUR transaction amount + Then On Loan Transactions tab the "Repayment" Transaction with date "25 January 2023" is reverted + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 25 January 2023 | Repayment | 1020.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 25 January 2023 | Accrual | 20.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 01 February 2023 | Repayment | 1040.0 | 1000.0 | 0.0 | 20.0 | 20.0 | 0.0 | + | 01 February 2023 | Accrual | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 01 February 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + | NSF fee | true | Specified due date | 01 February 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 01 February 2023 | 0.0 | 1000.0 | 0.0 | 20.0 | 20.0 | 1040.0 | 1040.0 | 0.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20 | 20 | 1040 | 1040 | 0 | 0 | 0 | + + When Admin sets the business date to "05 February 2023" + When Customer undo "1"th "Repayment" transaction made on "01 February 2023" + When Admin adds "LOAN_NSF_FEE" due date charge with "08 February 2023" due date and 20 EUR transaction amount + Then On Loan Transactions tab the "Repayment" Transaction with date "25 January 2023" is reverted + Then On Loan Transactions tab the "Repayment" Transaction with date "01 February 2023" is reverted + 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 | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 25 January 2023 | Repayment | 1020.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 25 January 2023 | Accrual | 20.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 01 February 2023 | Repayment | 1040.0 | 1000.0 | 0.0 | 20.0 | 20.0 | 0.0 | + | 01 February 2023 | Accrual | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 08 February 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | Snooze fee | false | Specified due date | 01 February 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 01 February 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + + When Admin sets the business date to "08 February 2023" + And Customer makes "AUTOPAY" repayment on "08 February 2023" with 1060 EUR transaction amount + Then On Loan Transactions tab the "Repayment" Transaction with date "01 February 2023" is reverted + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 25 January 2023 | Repayment | 1020.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 25 January 2023 | Accrual | 20.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 01 February 2023 | Repayment | 1040.0 | 1000.0 | 0.0 | 20.0 | 20.0 | 0.0 | + | 01 February 2023 | Accrual | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | 0.0 | + | 08 February 2023 | Repayment | 1060.0 | 1000.0 | 0.0 | 20.0 | 40.0 | 0.0 | + | 08 February 2023 | Accrual | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 08 February 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + | Snooze fee | false | Specified due date | 01 February 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + | NSF fee | true | Specified due date | 01 February 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has 2 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 08 February 2023 | 0.0 | 1000.0 | 0.0 | 20.0 | 20.0 | 1040.0 | 1040.0 | 0.0 | 1040.0 | 0.0 | + | 2 | 7 | 08 February 2023 | 08 February 2023 | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20 | 40 | 1060 | 1060 | 0 | 1040 | 0 | + + + @TestRailId:C2699 @PaymentStrategyDueInAdvancePenaltyInterestPrincipalFee + Scenario: Verify the due-penalty-interest-principal-fee-in-advance-penalty-interest-principal-fee-strategy payment strategy: UC6 - partial payment + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | 01 January 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 1 | MONTHS | 1 | MONTHS | 1 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "25 January 2023" + And Customer makes "AUTOPAY" repayment on "25 January 2023" with 500 EUR transaction amount + When Admin sets the business date to "01 February 2023" + And Customer makes "AUTOPAY" repayment on "01 February 2023" with 500 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 25 January 2023 | Repayment | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 February 2023 | Repayment | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 01 February 2023 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 1000.0 | 500.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 0 | 1000 | 1000 | 500 | 0 | 0 | + + @TestRailId:C2700 @PaymentStrategyDueInAdvancePenaltyInterestPrincipalFee + Scenario: Verify the due-penalty-interest-principal-fee-in-advance-penalty-interest-principal-fee-strategy payment strategy: UC7 - partial payment, in advance principal, due principal, fee + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | 01 January 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 1 | MONTHS | 1 | MONTHS | 1 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + + When Admin sets the business date to "10 January 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "01 February 2023" due date and 20 EUR transaction amount + + When Admin sets the business date to "25 January 2023" + And Customer makes "AUTOPAY" repayment on "25 January 2023" with 500 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 25 January 2023 | Repayment | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 0.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 1020.0 | 500.0 | 500.0 | 0.0 | 520.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20 | 0 | 1020 | 500 | 500 | 0 | 520 | + + When Admin sets the business date to "01 February 2023" + And Customer makes "AUTOPAY" repayment on "01 February 2023" with 520 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 25 January 2023 | Repayment | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 01 February 2023 | Repayment | 520.0 | 500.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 01 February 2023 | Accrual | 20.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 01 February 2023 | 0.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 1020.0 | 1020.0 | 500.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20 | 0 | 1020 | 1020 | 500 | 0 | 0 | + + @TestRailId:C2701 @PaymentStrategyDueInAdvancePenaltyInterestPrincipalFee + Scenario: Verify the due-penalty-interest-principal-fee-in-advance-penalty-interest-principal-fee-strategy payment strategy: UC8 - partial payment, in advance principal, due penalty, principal + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | 01 January 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 1 | MONTHS | 1 | MONTHS | 1 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + + When Admin sets the business date to "10 January 2023" + And Customer makes "AUTOPAY" repayment on "10 January 2023" with 1000 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + + When Admin sets the business date to "25 January 2023" + When Customer undo "1"th "Repayment" transaction made on "10 January 2023" + When Admin adds "LOAN_NSF_FEE" due date charge with "01 February 2023" due date and 20 EUR transaction amount + Then Loan status will be "ACTIVE" + Then On Loan Transactions tab the "Repayment" Transaction with date "10 January 2023" is reverted + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 January 2023 | Repayment | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 01 February 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + + When Admin sets the business date to "28 January 2023" + And Customer makes "AUTOPAY" repayment on "28 January 2023" with 520 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 January 2023 | Repayment | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 28 January 2023 | Repayment | 520.0 | 500.0 | 0.0 | 0.0 | 20.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 01 February 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 520.0 | 520.0 | 0.0 | 500.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 20 | 1020 | 520 | 520 | 0 | 500 | + + When Admin sets the business date to "01 February 2023" + And Customer makes "AUTOPAY" repayment on "01 February 2023" with 500 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 January 2023 | Repayment | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 28 January 2023 | Repayment | 520.0 | 500.0 | 0.0 | 0.0 | 20.0 | 500.0 | + | 01 February 2023 | Repayment | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 01 February 2023 | Accrual | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 01 February 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 01 February 2023 | 0.0 | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 1020.0 | 520.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 20 | 1020 | 1020 | 520 | 0 | 0 | + + @TestRailId:C2702 @PaymentStrategyDueInAdvancePenaltyInterestPrincipalFee + Scenario: Verify the due-penalty-interest-principal-fee-in-advance-penalty-interest-principal-fee-strategy payment strategy: UC9 - partial payment, in advance principal, fee, due penalty, principal + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | 01 January 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 1 | MONTHS | 1 | MONTHS | 1 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + + When Admin sets the business date to "10 January 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "01 February 2023" due date and 20 EUR transaction amount + + When Admin sets the business date to "10 January 2023" + And Customer makes "AUTOPAY" repayment on "10 January 2023" with 1020 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 January 2023 | Accrual | 20.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 10 January 2023 | Repayment | 1020.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 01 February 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 10 January 2023 | 0.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 1020.0 | 1020.0 | 1020.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20 | 0 | 1020 | 1020 | 1020 | 0 | 0 | + + When Admin sets the business date to "25 January 2023" + When Customer undo "1"th "Repayment" transaction made on "10 January 2023" + When Admin adds "LOAN_NSF_FEE" due date charge with "01 February 2023" due date and 20 EUR transaction amount + Then Loan status will be "ACTIVE" + Then On Loan Transactions tab the "Repayment" Transaction with date "10 January 2023" is reverted + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 January 2023 | Accrual | 20.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 10 January 2023 | Repayment | 1020.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 01 February 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | Snooze fee | false | Specified due date | 01 February 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + + When Admin sets the business date to "28 January 2023" + And Customer makes "AUTOPAY" repayment on "28 January 2023" with 520 EUR transaction amount + Then On Loan Transactions tab the "Repayment" Transaction with date "10 January 2023" is reverted + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 January 2023 | Repayment | 1020.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 10 January 2023 | Accrual | 20.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 28 January 2023 | Repayment | 520.0 | 500.0 | 0.0 | 0.0 | 20.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 01 February 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 01 February 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 0.0 | 1000.0 | 0.0 | 20.0 | 20.0 | 1040.0 | 520.0 | 520.0 | 0.0 | 520.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20 | 20 | 1040 | 520 | 520 | 0 | 520 | + + When Admin sets the business date to "01 February 2023" + And Customer makes "AUTOPAY" repayment on "01 February 2023" with 500 EUR transaction amount + Then On Loan Transactions tab the "Repayment" Transaction with date "10 January 2023" is reverted + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 January 2023 | Repayment | 1020.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 10 January 2023 | Accrual | 20.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 28 January 2023 | Repayment | 520.0 | 500.0 | 0.0 | 0.0 | 20.0 | 500.0 | + | 01 February 2023 | Repayment | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 01 February 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 01 February 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 0.0 | 1000.0 | 0.0 | 20.0 | 20.0 | 1040.0 | 1020.0 | 520.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20 | 20 | 1040 | 1020 | 520 | 0 | 20 | + + When Admin sets the business date to "05 February 2023" + And Customer makes "AUTOPAY" repayment on "05 February 2023" with 20 EUR transaction amount + Then On Loan Transactions tab the "Repayment" Transaction with date "10 January 2023" is reverted + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 January 2023 | Repayment | 1020.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 10 January 2023 | Accrual | 20.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 28 January 2023 | Repayment | 520.0 | 500.0 | 0.0 | 0.0 | 20.0 | 500.0 | + | 01 February 2023 | Repayment | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 05 February 2023 | Repayment | 20.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 05 February 2023 | Accrual | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 01 February 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + | NSF fee | true | Specified due date | 01 February 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 05 February 2023 | 0.0 | 1000.0 | 0.0 | 20.0 | 20.0 | 1040.0 | 1040.0 | 520.0 | 20.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20 | 20 | 1040 | 1040 | 520 | 20 | 0 | + + @TestRailId:C2703 @PaymentStrategyDueInAdvancePenaltyInterestPrincipalFee + Scenario: Verify the due-penalty-interest-principal-fee-in-advance-penalty-interest-principal-fee-strategy payment strategy: UC10 - partial payment, in advance principal, fee, due penalty + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | 01 January 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 1 | MONTHS | 1 | MONTHS | 1 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + + When Admin sets the business date to "10 January 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "01 February 2023" due date and 20 EUR transaction amount + + When Admin sets the business date to "10 January 2023" + And Customer makes "AUTOPAY" repayment on "10 January 2023" with 1020 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 January 2023 | Accrual | 20.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 10 January 2023 | Repayment | 1020.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 01 February 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 10 January 2023 | 0.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 1020.0 | 1020.0 | 1020.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20 | 0 | 1020 | 1020 | 1020 | 0 | 0 | + + When Admin sets the business date to "25 January 2023" + When Customer undo "1"th "Repayment" transaction made on "10 January 2023" + When Admin adds "LOAN_NSF_FEE" due date charge with "28 January 2023" due date and 20 EUR transaction amount + Then Loan status will be "ACTIVE" + Then On Loan Transactions tab the "Repayment" Transaction with date "10 January 2023" is reverted + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 January 2023 | Accrual | 20.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 10 January 2023 | Repayment | 1020.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 28 January 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | Snooze fee | false | Specified due date | 01 February 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + + When Admin sets the business date to "28 January 2023" + And Customer makes "AUTOPAY" repayment on "28 January 2023" with 520 EUR transaction amount + Then On Loan Transactions tab the "Repayment" Transaction with date "10 January 2023" is reverted + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 January 2023 | Repayment | 1020.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 10 January 2023 | Accrual | 20.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 28 January 2023 | Repayment | 520.0 | 500.0 | 0.0 | 0.0 | 20.0 | 500.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 01 February 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 28 January 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 0.0 | 1000.0 | 0.0 | 20.0 | 20.0 | 1040.0 | 520.0 | 520.0 | 0.0 | 520.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20 | 20 | 1040 | 520 | 520 | 0 | 520 | + + When Admin sets the business date to "30 January 2023" + And Customer makes "AUTOPAY" repayment on "30 January 2023" with 520 EUR transaction amount + Then On Loan Transactions tab the "Repayment" Transaction with date "10 January 2023" is reverted + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 January 2023 | Repayment | 1020.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 10 January 2023 | Accrual | 20.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 28 January 2023 | Repayment | 520.0 | 500.0 | 0.0 | 0.0 | 20.0 | 500.0 | + | 30 January 2023 | Repayment | 520.0 | 500.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 30 January 2023 | Accrual | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 01 February 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + | NSF fee | true | Specified due date | 28 January 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 30 January 2023 | 0.0 | 1000.0 | 0.0 | 20.0 | 20.0 | 1040.0 | 1040.0 | 1040.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20 | 20 | 1040 | 1040 | 1040 | 0 | 0 | + + @TestRailId:C2704 @PaymentStrategyDueInAdvancePenaltyInterestPrincipalFee + Scenario: Verify the due-penalty-interest-principal-fee-in-advance-penalty-interest-principal-fee-strategy payment strategy: UC11 - partial payment, in advance principal, fee, due penalty, principal, fee + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | 01 January 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 1 | MONTHS | 1 | MONTHS | 1 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + + When Admin sets the business date to "05 January 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "01 February 2023" due date and 20 EUR transaction amount + + When Admin sets the business date to "10 January 2023" + And Customer makes "AUTOPAY" repayment on "10 January 2023" with 1020 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 January 2023 | Accrual | 20.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 10 January 2023 | Repayment | 1020.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | Snooze fee | false | Specified due date | 01 February 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 10 January 2023 | 0.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 1020.0 | 1020.0 | 1020.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20 | 0 | 1020 | 1020 | 1020 | 0 | 0 | + + When Admin sets the business date to "25 January 2023" + When Customer undo "1"th "Repayment" transaction made on "10 January 2023" + When Admin adds "LOAN_NSF_FEE" due date charge with "28 January 2023" due date and 20 EUR transaction amount + Then Loan status will be "ACTIVE" + Then On Loan Transactions tab the "Repayment" Transaction with date "10 January 2023" is reverted + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 January 2023 | Accrual | 20.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 10 January 2023 | Repayment | 1020.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 28 January 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | Snooze fee | false | Specified due date | 01 February 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + + When Admin sets the business date to "28 January 2023" + And Customer makes "AUTOPAY" repayment on "28 January 2023" with 1040 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 January 2023 | Repayment | 1020.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 10 January 2023 | Accrual | 20.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 28 January 2023 | Repayment | 1040.0 | 1000.0 | 0.0 | 20.0 | 20.0 | 0.0 | + | 28 January 2023 | Accrual | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 28 January 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + | Snooze fee | false | Specified due date | 01 February 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 28 January 2023 | 0.0 | 1000.0 | 0.0 | 20.0 | 20.0 | 1040.0 | 1040.0 | 1040.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20 | 20 | 1040 | 1040 | 1040 | 0 | 0 | + + When Admin sets the business date to "30 January 2023" + When Customer undo "1"th "Repayment" transaction made on "28 January 2023" + When Admin adds "LOAN_NSF_FEE" due date charge with "01 February 2023" due date and 20 EUR transaction amount + Then Loan status will be "ACTIVE" + Then On Loan Transactions tab the "Repayment" Transaction with date "10 January 2023" is reverted + Then On Loan Transactions tab the "Repayment" Transaction with date "28 January 2023" is reverted + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 January 2023 | Repayment | 1020.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 10 January 2023 | Accrual | 20.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 28 January 2023 | Repayment | 1040.0 | 1000.0 | 0.0 | 20.0 | 20.0 | 0.0 | + | 28 January 2023 | Accrual | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 01 February 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 28 January 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | Snooze fee | false | Specified due date | 01 February 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + + When Admin sets the business date to "01 February 2023" + And Customer makes "AUTOPAY" repayment on "01 February 2023" with 20 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 | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 January 2023 | Repayment | 1020.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 10 January 2023 | Accrual | 20.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 28 January 2023 | Repayment | 1040.0 | 1000.0 | 0.0 | 20.0 | 20.0 | 0.0 | + | 28 January 2023 | Accrual | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | 0.0 | + | 01 February 2023 | Repayment | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | 1000.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 01 February 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + | NSF fee | true | Specified due date | 28 January 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + | Snooze fee | false | Specified due date | 01 February 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 0.0 | 1000.0 | 0.0 | 20.0 | 40.0 | 1060.0 | 20.0 | 0.0 | 0.0 | 1040.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20 | 40 | 1060 | 20 | 0 | 0 | 1040 | + + When Admin sets the business date to "05 February 2023" + And Customer makes "AUTOPAY" repayment on "05 February 2023" with 1040 EUR transaction amount + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 January 2023 | Repayment | 1020.0 | 1000.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 10 January 2023 | Accrual | 20.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 28 January 2023 | Repayment | 1040.0 | 1000.0 | 0.0 | 20.0 | 20.0 | 0.0 | + | 28 January 2023 | Accrual | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | 0.0 | + | 01 February 2023 | Repayment | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | 1000.0 | + | 05 February 2023 | Repayment | 1040.0 | 1000.0 | 0.0 | 20.0 | 20.0 | 0.0 | + | 05 February 2023 | Accrual | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 01 February 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + | NSF fee | true | Specified due date | 28 January 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + | Snooze fee | false | Specified due date | 01 February 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 05 February 2023 | 0.0 | 1000.0 | 0.0 | 20.0 | 40.0 | 1060.0 | 1060.0 | 0.0 | 1040.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 20 | 40 | 1060 | 1060 | 0 | 1040 | 0 | + + + @TestRailId:C2705 @PaymentStrategyDueInAdvancePenaltyInterestPrincipalFee + Scenario: Verify the due-penalty-interest-principal-fee-in-advance-penalty-interest-principal-fee-strategy payment strategy: UC12 - partial payment, in advance penalty, interest, principal, fee due penalty, interest, principal, fee + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE_INTEREST_FLAT | 01 January 2023 | 1000 | 12 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 1 | MONTHS | 1 | MONTHS | 1 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + + When Admin sets the business date to "05 January 2023" + When Admin adds "LOAN_SNOOZE_FEE" due date charge with "01 February 2023" due date and 20 EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "01 February 2023" due date and 20 EUR transaction amount + + When Admin sets the business date to "10 January 2023" + And Customer makes "AUTOPAY" repayment on "10 January 2023" with 20 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 January 2023 | Repayment | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | 1000.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 01 February 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + | Snooze fee | false | Specified due date | 01 February 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 0.0 | 1000.0 | 10.0 | 20.0 | 20.0 | 1050.0 | 20.0 | 20.0 | 0.0 | 1030.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 10 | 20 | 20 | 1050 | 20 | 20 | 0 | 1030 | + + When Admin sets the business date to "15 January 2023" + And Customer makes "AUTOPAY" repayment on "15 January 2023" with 500 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 January 2023 | Repayment | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | 1000.0 | + | 15 January 2023 | Repayment | 500.0 | 490.0 | 10.0 | 0.0 | 0.0 | 510.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 01 February 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + | Snooze fee | false | Specified due date | 01 February 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 0.0 | 1000.0 | 10.0 | 20.0 | 20.0 | 1050.0 | 520.0 | 520.0 | 0.0 | 530.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 10 | 20 | 20 | 1050 | 520 | 520 | 0 | 530 | + + When Admin sets the business date to "25 January 2023" + And Customer makes "AUTOPAY" repayment on "25 January 2023" with 530 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 January 2023 | Repayment | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | 1000.0 | + | 15 January 2023 | Repayment | 500.0 | 490.0 | 10.0 | 0.0 | 0.0 | 510.0 | + | 25 January 2023 | Repayment | 530.0 | 510.0 | 0.0 | 20.0 | 0.0 | 0.0 | + | 25 January 2023 | Accrual | 50.0 | 0.0 | 10.0 | 20.0 | 20.0 | 0.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 01 February 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + | Snooze fee | false | Specified due date | 01 February 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 25 January 2023 | 0.0 | 1000.0 | 10.0 | 20.0 | 20.0 | 1050.0 | 1050.0 | 1050.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 10 | 20 | 20 | 1050 | 1050 | 1050 | 0 | 0 | + + When Admin sets the business date to "30 January 2023" + When Customer undo "1"th "Repayment" transaction made on "10 January 2023" + When Customer undo "1"th "Repayment" transaction made on "15 January 2023" + When Customer undo "1"th "Repayment" transaction made on "25 January 2023" + Then Loan status will be "ACTIVE" + Then On Loan Transactions tab the "Repayment" Transaction with date "10 January 2023" is reverted + Then On Loan Transactions tab the "Repayment" Transaction with date "15 January 2023" is reverted + Then On Loan Transactions tab the "Repayment" Transaction with date "25 January 2023" is reverted + + When Admin sets the business date to "01 February 2023" + And Customer makes "AUTOPAY" repayment on "01 February 2023" with 20 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 January 2023 | Repayment | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | 1000.0 | + | 15 January 2023 | Repayment | 500.0 | 470.0 | 10.0 | 0.0 | 20.0 | 530.0 | + | 25 January 2023 | Repayment | 530.0 | 500.0 | 10.0 | 0.0 | 20.0 | 500.0 | + | 25 January 2023 | Accrual | 50.0 | 0.0 | 10.0 | 20.0 | 20.0 | 0.0 | + | 01 February 2023 | Repayment | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | 1000.0 | + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 01 February 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + | Snooze fee | false | Specified due date | 01 February 2023 | Flat | 20.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | | 0.0 | 1000.0 | 10.0 | 20.0 | 20.0 | 1050.0 | 20.0 | 0.0 | 0.0 | 1030.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 10 | 20 | 20 | 1050 | 20 | 0 | 0 | 1030 | + And Customer makes "AUTOPAY" repayment on "01 February 2023" with 10 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 January 2023 | Repayment | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | 1000.0 | + | 15 January 2023 | Repayment | 500.0 | 470.0 | 10.0 | 0.0 | 20.0 | 530.0 | + | 25 January 2023 | Repayment | 530.0 | 500.0 | 10.0 | 0.0 | 20.0 | 500.0 | + | 25 January 2023 | Accrual | 50.0 | 0.0 | 10.0 | 20.0 | 20.0 | 0.0 | + | 01 February 2023 | Repayment | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | 1000.0 | + | 01 February 2023 | Repayment | 10.0 | 0.0 | 10.0 | 0.0 | 0.0 | 1000.0 | + And Customer makes "AUTOPAY" repayment on "01 February 2023" with 1000 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 January 2023 | Repayment | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | 1000.0 | + | 15 January 2023 | Repayment | 500.0 | 470.0 | 10.0 | 0.0 | 20.0 | 530.0 | + | 25 January 2023 | Repayment | 530.0 | 500.0 | 10.0 | 0.0 | 20.0 | 500.0 | + | 25 January 2023 | Accrual | 50.0 | 0.0 | 10.0 | 20.0 | 20.0 | 0.0 | + | 01 February 2023 | Repayment | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | 1000.0 | + | 01 February 2023 | Repayment | 10.0 | 0.0 | 10.0 | 0.0 | 0.0 | 1000.0 | + | 01 February 2023 | Repayment | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | + And Customer makes "AUTOPAY" repayment on "01 February 2023" with 20 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 10 January 2023 | Repayment | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | 1000.0 | + | 15 January 2023 | Repayment | 500.0 | 470.0 | 10.0 | 0.0 | 20.0 | 530.0 | + | 25 January 2023 | Repayment | 530.0 | 500.0 | 10.0 | 0.0 | 20.0 | 500.0 | + | 25 January 2023 | Accrual | 50.0 | 0.0 | 10.0 | 20.0 | 20.0 | 0.0 | + | 01 February 2023 | Repayment | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | 1000.0 | + | 01 February 2023 | Repayment | 10.0 | 0.0 | 10.0 | 0.0 | 0.0 | 1000.0 | + | 01 February 2023 | Repayment | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 01 February 2023 | Repayment | 20.0 | 0.0 | 0.0 | 20.0 | 0.0 | 0.0 | + Then On Loan Transactions tab the "Repayment" Transaction with date "10 January 2023" is reverted + Then On Loan Transactions tab the "Repayment" Transaction with date "15 January 2023" is reverted + Then On Loan Transactions tab the "Repayment" Transaction with date "25 January 2023" is reverted + Then Loan Charges tab has the following data: + | Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding | + | NSF fee | true | Specified due date | 01 February 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + | Snooze fee | false | Specified due date | 01 February 2023 | Flat | 20.0 | 20.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has 1 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 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2023 | 01 February 2023 | 0.0 | 1000.0 | 10.0 | 20.0 | 20.0 | 1050.0 | 1050.0 | 0.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 10 | 20 | 20 | 1050 | 1050 | 0 | 0 | 0 | + + @Skip @TestRailId:C2800 @PaymentStrategyDueInAdvancePenaltyInterestPrincipalFee + Scenario: Verify the due-penalty-interest-principal-fee-in-advance-penalty-interest-principal-fee-strategy payment strategy: Same day transaction + When Admin sets the business date to "01 January 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 | + | PIN30_PAYMENT_STRATEGY_DUE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE_INTEREST_FLAT | 01 January 2023 | 1000 | 12 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 1 | MONTHS | 1 | MONTHS | 1 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 January 2023" with "1000" amount and expected disbursement date on "01 January 2023" + When Admin successfully disburse the loan on "01 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "04 January 2023" + And Customer makes "AUTOPAY" repayment on "04 January 2023" with 200 EUR transaction amount + When Admin sets the business date to "12 January 2023" + And Customer makes "AUTOPAY" repayment on "12 January 2023" with 300 EUR transaction amount + And Admin adds a 1 % Processing charge to the loan with "en" locale on date: "12 January 2023" + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 04 January 2023 | Repayment | 200.0 | 190.0 | 10.0 | 0.0 | 0.0 | 810.0 | + | 12 January 2023 | Repayment | 300.0 | 300.0 | 0.0 | 0.0 | 0.0 | 510.0 | + And Customer makes "AUTOPAY" repayment on "12 January 2023" with 520.10 EUR transaction amount + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | 01 January 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 04 January 2023 | Repayment | 200.0 | 190.0 | 10.0 | 0.0 | 0.0 | 810.0 | + | 12 January 2023 | Repayment | 300.0 | 300.0 | 0.0 | 0.0 | 0.0 | 510.0 | + | 12 January 2023 | Accrual | 20.1 | 0.0 | 10.0 | 10.1 | 0.0 | 0.0 | + | 12 January 2023 | Repayment | 520.1 | 510.0 | 0.0 | 10.1 | 0.0 | 0.0 | + + @TestRailId:C2810 + Scenario: As a user I would like to adjust an existing repayment and validate the event + When Admin sets the business date to "01 November 2022" + 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 | + | PIN30 | 01 November 2022 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 30 | DAYS | 30 | DAYS | 1 | 0 | 0 | 0 | DUE_PENALTY_FEE_INTEREST_PRINCIPAL_IN_ADVANCE_PRINCIPAL_PENALTY_FEE_INTEREST | + And Admin successfully approves the loan on "01 November 2022" with "1000" amount and expected disbursement date on "01 November 2022" + When Admin successfully disburse the loan on "01 November 2022" with "1000" EUR transaction amount + Then Loan has 1000 outstanding amount + When Admin sets the business date to "02 November 2022" + And Customer makes "AUTOPAY" repayment on "02 November 2022" with 9 EUR transaction amount + Then Loan Transactions tab has a transaction with date: "02 November 2022", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Repayment | 9.0 | 9.0 | 0.0 | 0.0 | 0.0 | 991.0 | + When Customer adjust "1"th repayment on "02 November 2022" with amount "10" + Then Loan Transactions tab has a transaction with date: "02 November 2022", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Repayment | 9.0 | 9.0 | 0.0 | 0.0 | 0.0 | 991.0 | + | Repayment | 10.0 | 0.0 | 0.0 | 0.0 | 0.0 | 990.0 | + + @TestRailId:C2898 + Scenario: Verify that in case of non/disbursed loan LoanRepaymentDueBusinessEvent is not sent - PIN30 product + When Admin sets the business date to "01 October 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 October 2023" + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + Then Loan Repayment schedule has 1 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 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | | | | 0.0 | + | 1 | 30 | 31 October 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 0 | 1000 | 0 | 0 | 0 | 1000 | + When Admin sets the business date to "31 October 2023" + When Admin runs inline COB job for Loan + Then No new event with type "LoanRepaymentDueEvent" has been raised for the loan + + @TestRailId:C2899 + Scenario: Verify that in case of non/disbursed loan LoanRepaymentDueBusinessEvent is not sent - PIN4 auto payment enabled + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | | | | 0.0 | + | 1 | 0 | 01 October 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 October 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 31 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 15 November 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 0.0 | 0 | 0 | 1000 | + When Admin sets the business date to "16 October 2023" + When Admin runs inline COB job for Loan + Then No new event with type "LoanRepaymentDueEvent" has been raised for the loan + + @TestRailId:C2900 + Scenario: Verify that in case of non/disbursed loan LoanRepaymentDueBusinessEvent is not sent - PIN4 auto payment disabled + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | | | | 0.0 | + | 1 | 0 | 01 October 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 October 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 31 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 15 November 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 0.0 | 0 | 0 | 1000 | + When Admin sets the business date to "16 October 2023" + When Admin runs inline COB job for Loan + Then No new event with type "LoanRepaymentDueEvent" has been raised for the loan + + @TestRailId:C2901 @AdvancedPaymentAllocation + Scenario: Verify that in case of non/disbursed loan LoanRepaymentDueBusinessEvent is not sent - PIN4 advanced payment allocation product + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | | | | 0.0 | + | 1 | 0 | 01 October 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 October 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 31 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 15 November 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 0.0 | 0 | 0 | 1000 | + When Admin sets the business date to "16 October 2023" + When Admin runs inline COB job for Loan + Then No new event with type "LoanRepaymentDueEvent" has been raised for the loan + + @TestRailId:C2902 + Scenario: Verify that in case of pre-payed installment LoanRepaymentDueBusinessEvent is not sent - PIN30 product + When Admin sets the business date to "01 October 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 October 2023" + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "01 October 2023" with 1000 EUR transaction amount and system-generated Idempotency key + Then Loan Repayment schedule has 1 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 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 October 2023 | 01 October 2023 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 1000.0 | 1000.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 0 | 1000 | 1000 | 1000 | 0 | 0 | + Then Loan status will be "CLOSED_OBLIGATIONS_MET" + Then Loan has 0 outstanding amount + When Admin sets the business date to "31 October 2023" + When Admin runs inline COB job for Loan + Then No new event with type "LoanRepaymentDueEvent" has been raised for the loan + + @TestRailId:C2903 + Scenario: Verify that in case of pre-payed installment LoanRepaymentDueBusinessEvent is not sent - PIN4 auto payment enabled + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "01 October 2023" with 250 EUR transaction amount and system-generated Idempotency key + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 October 2023 | 01 October 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 3 | 15 | 31 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 15 November 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 500.0 | 250 | 0 | 500 | + When Admin sets the business date to "16 October 2023" + When Admin runs inline COB job for Loan + Then No new event with type "LoanRepaymentDueEvent" has been raised for the loan + + @TestRailId:C2904 + Scenario: Verify that in case of pre-payed installment LoanRepaymentDueBusinessEvent is not sent - PIN4 auto payment disabled + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "01 October 2023" with 500 EUR transaction amount and system-generated Idempotency key + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 October 2023 | 01 October 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 3 | 15 | 31 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 15 November 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 500.0 | 250 | 0 | 500 | + When Admin sets the business date to "16 October 2023" + When Admin runs inline COB job for Loan + Then No new event with type "LoanRepaymentDueEvent" has been raised for the loan + + @TestRailId:C2905 @AdvancedPaymentAllocation + Scenario: Verify that in case of pre-payed installment LoanRepaymentDueBusinessEvent is not sent - PIN4 advanced payment allocation product + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "01 October 2023" with 250 EUR transaction amount and system-generated Idempotency key + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 October 2023 | 01 October 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 3 | 15 | 31 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 15 November 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 500.0 | 250 | 0 | 500 | + When Admin sets the business date to "16 October 2023" + When Admin runs inline COB job for Loan + Then No new event with type "LoanRepaymentDueEvent" has been raised for the loan + + @TestRailId:C2906 + Scenario: Verify that in case of pre-payed installments for total amount (loan balance is 0) LoanRepaymentDueBusinessEvent is not sent - PIN4 auto payment enabled + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "01 October 2023" with 750 EUR transaction amount and system-generated Idempotency key + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 October 2023 | 01 October 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 3 | 15 | 31 October 2023 | 01 October 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 4 | 15 | 15 November 2023 | 01 October 2023 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 1000.0 | 750 | 0 | 0 | + When Admin sets the business date to "16 October 2023" + When Admin runs inline COB job for Loan + Then No new event with type "LoanRepaymentDueEvent" has been raised for the loan + When Admin sets the business date to "31 October 2023" + When Admin runs inline COB job for Loan + Then No new event with type "LoanRepaymentDueEvent" has been raised for the loan + When Admin sets the business date to "15 November 2023" + When Admin runs inline COB job for Loan + Then No new event with type "LoanRepaymentDueEvent" has been raised for the loan + + @TestRailId:C2907 + Scenario: Verify that in case of pre-payed installments for total amount (loan balance is 0) LoanRepaymentDueBusinessEvent is not sent - PIN4 auto payment disabled + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "01 October 2023" with 1000 EUR transaction amount and system-generated Idempotency key + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 October 2023 | 01 October 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 3 | 15 | 31 October 2023 | 01 October 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 4 | 15 | 15 November 2023 | 01 October 2023 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 1000.0 | 750 | 0 | 0 | + When Admin sets the business date to "16 October 2023" + When Admin runs inline COB job for Loan + Then No new event with type "LoanRepaymentDueEvent" has been raised for the loan + When Admin sets the business date to "31 October 2023" + When Admin runs inline COB job for Loan + Then No new event with type "LoanRepaymentDueEvent" has been raised for the loan + When Admin sets the business date to "15 November 2023" + When Admin runs inline COB job for Loan + Then No new event with type "LoanRepaymentDueEvent" has been raised for the loan + + @TestRailId:C2908 @AdvancedPaymentAllocation + Scenario: Verify that in case of pre-payed installments for total amount (loan balance is 0) LoanRepaymentDueBusinessEvent is not sent - PIN4 advanced payment allocation product + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "01 October 2023" with 750 EUR transaction amount and system-generated Idempotency key + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 October 2023 | 01 October 2023 | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 3 | 15 | 31 October 2023 | 01 October 2023 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + | 4 | 15 | 15 November 2023 | 01 October 2023 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 250.0 | 0.0 | 0.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0 | 0 | 0 | 1000.0 | 1000.0 | 750 | 0 | 0 | + When Admin sets the business date to "16 October 2023" + When Admin runs inline COB job for Loan + Then No new event with type "LoanRepaymentDueEvent" has been raised for the loan + When Admin sets the business date to "31 October 2023" + When Admin runs inline COB job for Loan + Then No new event with type "LoanRepaymentDueEvent" has been raised for the loan + When Admin sets the business date to "15 November 2023" + When Admin runs inline COB job for Loan + Then No new event with type "LoanRepaymentDueEvent" has been raised for the loan + + @TestRailId:C2961 + Scenario: Verify that outstanding amounts are rounded correctly in case of: installmentAmountInMultiplesOf=1, interestType: FLAT, amortizationType: EQUAL_INSTALLMENTS + When Admin sets the business date to "01 September 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 | + | PIN30_INTEREST_FLAT | 01 September 2023 | 1250 | 15 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 4 | MONTHS | 1 | MONTHS | 4 | 0 | 0 | 0 | DUE_PENALTY_FEE_INTEREST_PRINCIPAL_IN_ADVANCE_PRINCIPAL_PENALTY_FEE_INTEREST | + And Admin successfully approves the loan on "01 September 2023" with "1250" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1250" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1250.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 01 October 2023 | | 936.62 | 313.38 | 15.62 | 0.0 | 0.0 | 329.0 | 0.0 | 0.0 | 0.0 | 329.0 | + | 2 | 31 | 01 November 2023 | | 623.24 | 313.38 | 15.62 | 0.0 | 0.0 | 329.0 | 0.0 | 0.0 | 0.0 | 329.0 | + | 3 | 30 | 01 December 2023 | | 309.86 | 313.38 | 15.62 | 0.0 | 0.0 | 329.0 | 0.0 | 0.0 | 0.0 | 329.0 | + | 4 | 31 | 01 January 2024 | | 0.0 | 309.86 | 15.64 | 0.0 | 0.0 | 325.5 | 0.0 | 0.0 | 0.0 | 325.5 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1250.0 | 62.50 | 0.0 | 0.0 | 1312.50 | 0.0 | 0.0 | 0.0 | 1312.50 | + + @TestRailId:C2962 + Scenario: Verify that outstanding amounts are rounded correctly in case of: installmentAmountInMultiplesOf=1, interestType: DECLINING_BALANCE, amortizationType: EQUAL_INSTALLMENTS + When Admin sets the business date to "01 September 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 | + | PIN30_INTEREST_DECLINING_BALANCE_PERIOD_SAME_AS_PAYMENT | 01 September 2023 | 1250 | 15 | DECLINING_BALANCE | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 4 | MONTHS | 1 | MONTHS | 4 | 0 | 0 | 0 | DUE_PENALTY_FEE_INTEREST_PRINCIPAL_IN_ADVANCE_PRINCIPAL_PENALTY_FEE_INTEREST | + And Admin successfully approves the loan on "01 September 2023" with "1250" amount and expected disbursement date on "01 September 2023" + When Admin successfully disburse the loan on "01 September 2023" with "1250" EUR transaction amount + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 September 2023 | | 1250.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 01 October 2023 | | 943.62 | 306.38 | 15.62 | 0.0 | 0.0 | 322.0 | 0.0 | 0.0 | 0.0 | 322.0 | + | 2 | 31 | 01 November 2023 | | 633.42 | 310.2 | 11.8 | 0.0 | 0.0 | 322.0 | 0.0 | 0.0 | 0.0 | 322.0 | + | 3 | 30 | 01 December 2023 | | 319.34 | 314.08 | 7.92 | 0.0 | 0.0 | 322.0 | 0.0 | 0.0 | 0.0 | 322.0 | + | 4 | 31 | 01 January 2024 | | 0.0 | 319.34 | 3.99 | 0.0 | 0.0 | 323.33 | 0.0 | 0.0 | 0.0 | 323.33 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1250.0 | 39.33 | 0.0 | 0.0 | 1289.33 | 0.0 | 0.0 | 0.0 | 1289.33 | diff --git a/fineract-e2e-tests-runner/src/test/resources/features/LoanReschedule.feature b/fineract-e2e-tests-runner/src/test/resources/features/LoanReschedule.feature new file mode 100644 index 00000000000..345986c2def --- /dev/null +++ b/fineract-e2e-tests-runner/src/test/resources/features/LoanReschedule.feature @@ -0,0 +1,681 @@ +@LoanRescheduleFeature +Feature: LoanReschedule + + @TestRailId:C2680 + Scenario: As a user I would like to see a loan changed event was triggered when the loan got rescheduled + When Admin sets the business date to "1 July 2022" + When Admin creates a client with random data + And Admin successfully creates a new customised Loan submitted on date: "1 July 2022", with Principal: "5000", a loanTermFrequency: 1 months, and numberOfRepayments: 1 + And Admin successfully approves the loan on "1 July 2022" with "5000" amount and expected disbursement date on "1 July 2022" + When Admin successfully disburse the loan on "1 July 2022" with "5000" EUR transaction amount + When Batch API call with steps: rescheduleLoan from "1 August 2022" to "31 August 2022" submitted on date: "1 July 2022", approveReschedule on date: "1 July 2022" runs with enclosingTransaction: "true" + Then Loan Repayment schedule has 1 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 July 2022 | | 5000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 61 | 31 August 2022 | | 0.0 | 5000.0 | 0.0 | 0.0 | 0.0 | 5000.0 | 0.0 | 0.0 | 0.0 | 5000.0 | + + @TestRailId:C2801 + Scenario: Verify that loan is rescheduled properly in case of: undo disbursement + When Admin sets the business date to "01 July 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 July 2023" + And Admin successfully approves the loan on "01 July 2023" with "1000" amount and expected disbursement date on "01 July 2023" + And Admin successfully disburse the loan on "01 July 2023" with "1000" EUR transaction amount + Then Loan Repayment schedule has 1 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 July 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 July 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 0 | 1000 | 0 | 0 | 0 | 1000 | + When Admin sets the business date to "02 July 2023" + When Admin successfully undo disbursal + Then Loan Repayment schedule has 1 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 July 2023 | | 1000.0 | | | 0.0 | | 0.0 | | | | 0.0 | + | 1 | 30 | 31 July 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 0 | 1000 | 0 | 0 | 0 | 1000 | + + @TestRailId:C2802 + Scenario: Verify that loan is rescheduled properly in case of: multiple disbursement, second disbursement placed within payment period + When Admin sets the business date to "01 July 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 July 2023" + And Admin successfully approves the loan on "01 July 2023" with "1000" amount and expected disbursement date on "01 July 2023" + And Admin successfully disburse the loan on "01 July 2023" with "500" EUR transaction amount + Then Loan Repayment schedule has 1 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 July 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 July 2023 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500 | 0 | 0 | 0 | 500 | 0 | 0 | 0 | 500 | + When Admin sets the business date to "10 July 2023" + And Admin successfully disburse the loan on "10 July 2023" with "500" EUR transaction amount + Then Loan Repayment schedule has 1 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 July 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | | | 10 July 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 July 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 0 | 1000 | 0 | 0 | 0 | 1000 | + + @TestRailId:C2803 + Scenario: Verify that loan is rescheduled properly in case of: multiple disbursement, second disbursement placed after payment period + When Admin sets the business date to "01 July 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 July 2023" + And Admin successfully approves the loan on "01 July 2023" with "1000" amount and expected disbursement date on "01 July 2023" + And Admin successfully disburse the loan on "01 July 2023" with "500" EUR transaction amount + Then Loan Repayment schedule has 1 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 July 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 July 2023 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500 | 0 | 0 | 0 | 500 | 0 | 0 | 0 | 500 | + When Admin sets the business date to "10 August 2023" + And Admin successfully disburse the loan on "10 August 2023" with "500" EUR transaction amount + Then Loan Repayment schedule has 2 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 July 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 July 2023 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | | | 10 August 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 30 | 30 August 2023 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 0 | 1000 | 0 | 0 | 0 | 1000 | + When Admin successfully undo last disbursal + Then Loan Repayment schedule has 1 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 July 2023 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 July 2023 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 500 | 0 | 0 | 0 | 500 | 0 | 0 | 0 | 500 | + + @TestRailId:C2804 + Scenario: Verify that loan is rescheduled properly in case of: single installment, changing installment date + When Admin sets the business date to "01 July 2023" + When Admin creates a client with random data + When Admin creates a new default Loan with date: "01 July 2023" + And Admin successfully approves the loan on "01 July 2023" with "1000" amount and expected disbursement date on "01 July 2023" + And Admin successfully disburse the loan on "01 July 2023" with "1000" EUR transaction amount + Then Loan Repayment schedule has 1 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 July 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 30 | 31 July 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 0 | 1000 | 0 | 0 | 0 | 1000 | + When Admin sets the business date to "05 July 2023" + When Admin creates and approves Loan reschedule with the following data: + | rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate | + | 31 July 2023 | 05 July 2023 | 31 August 2023 | 0 | 0 | 0 | 0 | + Then Loan Repayment schedule has 1 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 July 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 61 | 31 August 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000 | 0 | 0 | 0 | 1000 | 0 | 0 | 0 | 1000 | + + @TestRailId:C2805 + Scenario: Verify that loan is rescheduled properly in case of: multiple installments, changing installment date + When Admin sets the business date to "01 July 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 | + | PIN30 | 01 July 2023 | 3000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "01 July 2023" with "3000" amount and expected disbursement date on "01 July 2023" + And Admin successfully disburse the loan on "01 July 2023" with "3000" 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 July 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 August 2023 | | 2000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 2 | 31 | 01 September 2023 | | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 3 | 30 | 01 October 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 0 | 0 | 0 | 3000 | 0 | 0 | 0 | 3000 | + When Admin sets the business date to "05 July 2023" + When Admin creates and approves Loan reschedule with the following data: + | rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate | + | 01 September 2023 | 05 July 2023 | 15 September 2023 | 0 | 0 | 0 | 0 | + 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 July 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 August 2023 | | 2000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 2 | 45 | 15 September 2023 | | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 3 | 30 | 15 October 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 0 | 0 | 0 | 3000 | 0 | 0 | 0 | 3000 | + + @TestRailId:C2806 + Scenario: Verify that loan is rescheduled properly in case of: multiple installments, extending repayment schedule + When Admin sets the business date to "01 July 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 | + | PIN30 | 01 July 2023 | 3000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "01 July 2023" with "3000" amount and expected disbursement date on "01 July 2023" + And Admin successfully disburse the loan on "01 July 2023" with "3000" 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 July 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 August 2023 | | 2000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 2 | 31 | 01 September 2023 | | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 3 | 30 | 01 October 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 0 | 0 | 0 | 3000 | 0 | 0 | 0 | 3000 | + When Admin sets the business date to "05 July 2023" + When Admin creates and approves Loan reschedule with the following data: + | rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate | + | 01 September 2023 | 05 July 2023 | | 0 | 0 | 2 | 0 | + Then Loan Repayment schedule has 5 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 July 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 August 2023 | | 2000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 2 | 31 | 01 September 2023 | | 1500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 3 | 30 | 01 October 2023 | | 1000.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 4 | 31 | 01 November 2023 | | 500.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + | 5 | 30 | 01 December 2023 | | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | 0.0 | 0.0 | 0.0 | 500.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 0 | 0 | 0 | 3000 | 0 | 0 | 0 | 3000 | + + @TestRailId:C2807 + Scenario: Verify that loan is rescheduled properly in case of: multiple installments, mid-term grace period on principal + When Admin sets the business date to "01 July 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 | + | PIN30 | 01 July 2023 | 3000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "01 July 2023" with "3000" amount and expected disbursement date on "01 July 2023" + And Admin successfully disburse the loan on "01 July 2023" with "3000" 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 July 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 August 2023 | | 2000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 2 | 31 | 01 September 2023 | | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 3 | 30 | 01 October 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 0 | 0 | 0 | 3000 | 0 | 0 | 0 | 3000 | + When Admin sets the business date to "05 July 2023" + When Admin creates and approves Loan reschedule with the following data: + | rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate | + | 01 September 2023 | 05 July 2023 | | 1 | 0 | 0 | 0 | + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 July 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 August 2023 | | 2000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 2 | 31 | 01 September 2023 | 01 July 2023 | 2000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 3 | 30 | 01 October 2023 | | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + | 4 | 31 | 01 November 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 0 | 0 | 0 | 3000 | 0 | 0 | 0 | 3000 | + +# TODO check and fix after Loan reschedule with graceOnInterest deletes all future interest portions when called from API was fixed (periods back to 3 or 5) + @Skip @TestRailId:C2808 + Scenario: Verify that loan is rescheduled properly in case of: multiple installments, mid-term grace period on interest + When Admin sets the business date to "01 July 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 | + | PIN30_INTEREST_FLAT | 01 July 2023 | 3000 | 12 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 10 | MONTHS | 1 | MONTHS | 10 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "01 July 2023" with "3000" amount and expected disbursement date on "01 July 2023" + And Admin successfully disburse the loan on "01 July 2023" with "3000" 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 July 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | +# | 1 | 31 | 01 August 2023 | | 2000.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | +# | 2 | 31 | 01 September 2023 | | 1000.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | +# | 3 | 30 | 01 October 2023 | | 0.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | +# Then Loan Repayment schedule has the following data in Total row: +# | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | +# | 3000 | 90 | 0 | 0 | 3090 | 0 | 0 | 0 | 3090 | + When Admin sets the business date to "05 July 2023" + When Admin creates and approves Loan reschedule with the following data: + | rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate | + | 01 September 2023 | 05 July 2023 | | 0 | 2 | 0 | 0 | +# 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 July 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | +# | 1 | 31 | 01 August 2023 | | 2000.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | +# | 2 | 31 | 01 September 2023 | | 1000.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | +# | 3 | 30 | 01 October 2023 | | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | +# Then Loan Repayment schedule has the following data in Total row: +# | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | +# | 3000 | 30 | 0 | 0 | 3030 | 0 | 0 | 0 | 3030 | + + @TestRailId:C2809 + Scenario: Verify that loan is rescheduled properly in case of: multiple installments, new interest rate + When Admin sets the business date to "01 July 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 | + | PIN30_INTEREST_FLAT | 01 July 2023 | 3000 | 12 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | PENALTIES_FEES_INTEREST_PRINCIPAL_ORDER | + And Admin successfully approves the loan on "01 July 2023" with "3000" amount and expected disbursement date on "01 July 2023" + And Admin successfully disburse the loan on "01 July 2023" with "3000" 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 July 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 August 2023 | | 2000.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | + | 2 | 31 | 01 September 2023 | | 1000.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | + | 3 | 30 | 01 October 2023 | | 0.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 90 | 0 | 0 | 3090 | 0 | 0 | 0 | 3090 | + When Admin sets the business date to "05 July 2023" + When Admin creates and approves Loan reschedule with the following data: + | rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate | + | 01 September 2023 | 05 July 2023 | | 0 | 0 | 0 | 6 | + 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 July 2023 | | 3000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 August 2023 | | 2000.0 | 1000.0 | 30.0 | 0.0 | 0.0 | 1030.0 | 0.0 | 0.0 | 0.0 | 1030.0 | + | 2 | 31 | 01 September 2023 | | 1000.0 | 1000.0 | 15.0 | 0.0 | 0.0 | 1015.0 | 0.0 | 0.0 | 0.0 | 1015.0 | + | 3 | 30 | 01 October 2023 | | 0.0 | 1000.0 | 15.0 | 0.0 | 0.0 | 1015.0 | 0.0 | 0.0 | 0.0 | 1015.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 3000 | 60 | 0 | 0 | 3060 | 0 | 0 | 0 | 3060 | + + @TestRailId:C2996 + Scenario: Verify that reschedule: add extra terms working properly with auto downpayment + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin creates and approves Loan reschedule with the following data: + | rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate | + | 16 October 2023 | 01 October 2023 | | 0 | 0 | 2 | 0 | + 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 | + | | | 01 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 October 2023 | | 600.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | + | 3 | 15 | 31 October 2023 | | 450.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | + | 4 | 15 | 15 November 2023 | | 300.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | + | 5 | 15 | 30 November 2023 | | 150.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | + | 6 | 15 | 15 December 2023 | | 0.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 250.0 | 0.0 | 0.0 | 750.0 | + + @TestRailId:C2997 + Scenario: Verify that reschedule: add extra terms working properly with auto downpayment and 2nd disbursement before reschedule + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "10 October 2023" + When Admin successfully disburse the loan on "10 October 2023" with "400" EUR transaction amount + When Admin sets the business date to "11 October 2023" + When Admin creates and approves Loan reschedule with the following data: + | rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate | + | 16 October 2023 | 01 October 2023 | | 0 | 0 | 2 | 0 | + Then Loan Repayment schedule has 7 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 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 10 October 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 10 October 2023 | 10 October 2023 | 1050.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 16 October 2023 | | 840.0 | 210.0 | 0.0 | 0.0 | 0.0 | 210.0 | 0.0 | 0.0 | 0.0 | 210.0 | + | 4 | 15 | 31 October 2023 | | 630.0 | 210.0 | 0.0 | 0.0 | 0.0 | 210.0 | 0.0 | 0.0 | 0.0 | 210.0 | + | 5 | 15 | 15 November 2023 | | 420.0 | 210.0 | 0.0 | 0.0 | 0.0 | 210.0 | 0.0 | 0.0 | 0.0 | 210.0 | + | 6 | 15 | 30 November 2023 | | 210.0 | 210.0 | 0.0 | 0.0 | 0.0 | 210.0 | 0.0 | 0.0 | 0.0 | 210.0 | + | 7 | 15 | 15 December 2023 | | 0.0 | 210.0 | 0.0 | 0.0 | 0.0 | 210.0 | 0.0 | 0.0 | 0.0 | 210.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1400.0 | 0.0 | 0.0 | 0.0 | 1400.0 | 350.0 | 0.0 | 0.0 | 1050.0 | + +# TODO remove Skip when Reschedule does not work properly in case of PIN4_DOWNPAYMENT_AUTO and with 2nd disbursement after reschedule and first installment is fixed + @Skip + @TestRailId:C2998 + Scenario: Verify that reschedule: add extra terms working properly with auto downpayment and 2nd disbursement after reschedule and first installment + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "11 October 2023" + When Admin creates and approves Loan reschedule with the following data: + | rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate | + | 16 October 2023 | 01 October 2023 | | 0 | 0 | 2 | 0 | + When Admin sets the business date to "20 October 2023" + When Admin successfully disburse the loan on "20 October 2023" with "400" EUR transaction amount + Then Loan Repayment schedule has 7 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 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 15 | 16 October 2023 | | 600.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | 100.0 | 0.0 | 100.0 | 50.0 | + | | | 20 October 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 3 | 0 | 20 October 2023 | | 900.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | + | 4 | 15 | 31 October 2023 | | 675.0 | 225.0 | 0.0 | 0.0 | 0.0 | 225.0 | 0.0 | 0.0 | 0.0 | 225.0 | + | 5 | 15 | 15 November 2023 | | 450.0 | 225.0 | 0.0 | 0.0 | 0.0 | 225.0 | 0.0 | 0.0 | 0.0 | 225.0 | + | 6 | 15 | 30 November 2023 | | 225.0 | 225.0 | 0.0 | 0.0 | 0.0 | 225.0 | 0.0 | 0.0 | 0.0 | 225.0 | + | 7 | 15 | 15 December 2023 | | 0.0 | 225.0 | 0.0 | 0.0 | 0.0 | 225.0 | 0.0 | 0.0 | 0.0 | 225.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1400.0 | 0.0 | 0.0 | 0.0 | 1400.0 | 350.0 | 0.0 | 100.0 | 1050.0 | + + @TestRailId:C3022 + Scenario: Verify that Payment Holiday (Reschedule with adjustedDueDate) works properly in case of loan schedule adjusted by 1 installment period after successful downpayment + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "05 October 2023" + When Admin creates and approves Loan reschedule with the following data: + | rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate | + | 16 October 2023 | 05 October 2023 | 31 October 2023 | 0 | 0 | 0 | 0 | + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 30 | 31 October 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 15 November 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 30 November 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 250.0 | 0.0 | 0.0 | 750.0 | + + @TestRailId:C3023 + Scenario: Verify that Payment Holiday (Reschedule with adjustedDueDate) works properly in case of loan schedule adjusted by 2 installment period after successful downpayment + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "05 October 2023" + When Admin creates and approves Loan reschedule with the following data: + | rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate | + | 16 October 2023 | 05 October 2023 | 15 November 2023 | 0 | 0 | 0 | 0 | + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 45 | 15 November 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 30 November 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 15 December 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 250.0 | 0.0 | 0.0 | 750.0 | + + @TestRailId:C3024 + Scenario: Verify that Payment Holiday (Reschedule with adjustedDueDate) works properly in case of loan schedule adjusted by 2 installment period while downpayment is still due + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "05 October 2023" + When Admin creates and approves Loan reschedule with the following data: + | rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate | + | 16 October 2023 | 05 October 2023 | 15 November 2023 | 0 | 0 | 0 | 0 | + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 45 | 15 November 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 30 November 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 15 December 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | + + @TestRailId:C3025 + Scenario: Verify that Payment Holiday (Reschedule with adjustedDueDate) works properly in case of loan schedule adjusted by 1 installment period after downpayment was reverted, fee added and downpayment paid by autopayment + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + And Customer makes "AUTOPAY" repayment on "01 October 2023" with 250 EUR transaction amount + When Admin sets the business date to "02 October 2023" + When Customer undo "1"th repayment on "01 October 2023" + When Admin adds "LOAN_NSF_FEE" due date charge with "16 October 2023" due date and 15 EUR transaction amount + When Admin sets the business date to "03 October 2023" + And Customer makes "AUTOPAY" repayment on "03 October 2023" with 250 EUR transaction amount + When Admin sets the business date to "05 October 2023" + When Admin creates and approves Loan reschedule with the following data: + | rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate | + | 16 October 2023 | 05 October 2023 | 31 October 2023 | 0 | 0 | 0 | 0 | + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 03 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 250.0 | 0.0 | + | 2 | 30 | 31 October 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 15.0 | 265.0 | 0.0 | 0.0 | 0.0 | 265.0 | + | 3 | 15 | 15 November 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 30 November 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 15.0 | 1015.0 | 250.0 | 0.0 | 250.0 | 765.0 | + Then Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | + | 01 October 2023 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | + | 01 October 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | true | + | 03 October 2023 | Repayment | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 750.0 | false | + + @TestRailId:C3026 + Scenario: Verify that Payment Holiday (Reschedule with adjustedDueDate) works properly in case of auto downpayment + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin creates and approves Loan reschedule with the following data: + | rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate | + | 16 October 2023 | 01 October 2023 | 31 October 2023 | 0 | 0 | 0 | 0 | + Then Loan Repayment schedule has 4 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 30 | 31 October 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 15 November 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 30 November 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 250.0 | 0.0 | 0.0 | 750.0 | + + @TestRailId:C3027 + Scenario: Verify that Payment Holiday (Reschedule with adjustedDueDate) works properly in case of auto downpayment and 2nd disbursement before reschedule + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "10 October 2023" + When Admin successfully disburse the loan on "10 October 2023" with "400" EUR transaction amount + When Admin sets the business date to "11 October 2023" + When Admin creates and approves Loan reschedule with the following data: + | rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate | + | 16 October 2023 | 01 October 2023 | 31 October 2023 | 0 | 0 | 0 | 0 | + Then Loan Repayment schedule has 5 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 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | | | 10 October 2023 | | 400.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 2 | 0 | 10 October 2023 | 10 October 2023 | 1050.0 | 100.0 | 0.0 | 0.0 | 0.0 | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 3 | 30 | 31 October 2023 | | 700.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | + | 4 | 15 | 15 November 2023 | | 350.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | + | 5 | 15 | 30 November 2023 | | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | 0.0 | 0.0 | 0.0 | 350.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1400.0 | 0.0 | 0.0 | 0.0 | 1400.0 | 350.0 | 0.0 | 0.0 | 1050.0 | + + @TestRailId:C3028 + Scenario: Verify that Payment Holiday (Reschedule with adjustedDueDate) works properly in case of loan schedule adjusted by 1 installment period and 2 extra terms + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "05 October 2023" + When Admin creates and approves Loan reschedule with the following data: + | rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate | + | 16 October 2023 | 05 October 2023 | 31 October 2023 | 0 | 0 | 2 | 0 | + 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 | + | | | 01 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 30 | 31 October 2023 | | 600.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | + | 3 | 15 | 15 November 2023 | | 450.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | + | 4 | 15 | 30 November 2023 | | 300.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | + | 5 | 15 | 15 December 2023 | | 150.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | + | 6 | 15 | 30 December 2023 | | 0.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 250.0 | 0.0 | 0.0 | 750.0 | + + @TestRailId:C3029 + Scenario: Verify that Payment Holiday (Reschedule with adjustedDueDate) works properly in case of loan schedule adjusted by 1 installment period and 1 grace on principal + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "05 October 2023" + When Admin creates and approves Loan reschedule with the following data: + | rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate | + | 16 October 2023 | 05 October 2023 | 31 October 2023 | 1 | 0 | 0 | 0 | + Then Loan Repayment schedule has 5 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 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | 01 October 2023 | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | + | 2 | 30 | 31 October 2023 | 01 October 2023 | 750.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | + | 3 | 15 | 15 November 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 30 November 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 15 | 15 December 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 250.0 | 0.0 | 0.0 | 750.0 | + + @TestRailId:C3030 + Scenario: Verify that Payment Holiday (Reschedule with adjustedDueDate) gives error in case of charged-off loan + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT_AUTO | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin sets the business date to "03 October 2023" + And Admin does charge-off the loan on "03 October 2023" + When Admin sets the business date to "05 October 2023" + Then Loan reschedule with the following data results a 403 error and "LOAN_CHARGED_OFF" error message + | rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate | + | 16 October 2023 | 05 October 2023 | 31 October 2023 | 0 | 0 | 0 | 0 | + + @TestRailId:C3033 + Scenario: Verify that reschedule keeps the N+1 installment + When Admin sets the business date to "01 October 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 | + | PIN4_DOWNPAYMENT | 01 October 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE | + And Admin successfully approves the loan on "01 October 2023" with "1000" amount and expected disbursement date on "01 October 2023" + When Admin successfully disburse the loan on "01 October 2023" with "1000" EUR transaction amount + When Admin adds "LOAN_NSF_FEE" due date charge with "17 December 2023" due date and 20 EUR transaction amount + Then Loan Repayment schedule has 5 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 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 15 | 16 October 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 31 October 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 15 November 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 32 | 17 December 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 0.0 | 0.0 | 0.0 | 1020.0 | + When Admin sets the business date to "05 October 2023" + When Admin creates and approves Loan reschedule with the following data: + | rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate | + | 16 October 2023 | 05 October 2023 | 31 October 2023 | 0 | 0 | 0 | 0 | + Then Loan Repayment schedule has 5 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 October 2023 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 0 | 01 October 2023 | | 750.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 2 | 30 | 31 October 2023 | | 500.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 3 | 15 | 15 November 2023 | | 250.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 4 | 15 | 30 November 2023 | | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | 0.0 | 0.0 | 0.0 | 250.0 | + | 5 | 17 | 17 December 2023 | | 0.0 | 0.0 | 0.0 | 0.0 | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 20.0 | + Then Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 1000.0 | 0.0 | 0.0 | 20.0 | 1020.0 | 0.0 | 0.0 | 0.0 | 1020.0 | + + @TestRailId:C3045 @AdvancedPaymentAllocation + Scenario: Verify that inline COB execution is taking place in case of a BatchAPI request of Loan reschedule creation and approval + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "1000" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "1000" EUR transaction amount + When Admin sets the business date to "02 January 2024" + When Admin runs inline COB job for Loan + When Admin creates new user with "NO_BYPASS_AUTOTEST" username, "NO_BYPASS_AUTOTEST_ROLE" role name and given permissions: + | APPROVE_RESCHEDULELOAN | + | CREATE_RESCHEDULELOAN | + | READ_RESCHEDULELOAN | + | REJECT_RESCHEDULELOAN | + When Admin sets the business date to "10 January 2024" + When Batch API call with created user and with steps: rescheduleLoan from "16 January 2024" to "31 January 2024" submitted on date: "10 January 2024", approveReschedule on date: "10 January 2024" runs with enclosingTransaction: "true" + Then Admin checks that last closed business date of loan is "09 January 2024" + + @TestRailId:C3048 @AdvancedPaymentAllocation + Scenario: Verify that in case of Loan is hard locked for COB execution, BatchAPI request of Loan reschedule creation and approval will result a 409 error and a LOAN_LOCKED_BY_COB error message + When Admin sets the business date to "01 January 2024" + When Admin creates a client with random data + When Admin set "PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION" loan product "DEFAULT" transaction type to "NEXT_INSTALLMENT" future installment allocation rule + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "01 January 2024" with "1000" amount and expected disbursement date on "01 January 2024" + When Admin successfully disburse the loan on "01 January 2024" with "1000" EUR transaction amount + When Admin sets the business date to "02 January 2024" + When Admin runs inline COB job for Loan + When Admin sets the business date to "10 January 2024" + When Admin places a lock on loan account with an error message + When Admin creates new user with "NO_BYPASS_AUTOTEST" username, "NO_BYPASS_AUTOTEST_ROLE" role name and given permissions: + | APPROVE_RESCHEDULELOAN | + | CREATE_RESCHEDULELOAN | + | READ_RESCHEDULELOAN | + | REJECT_RESCHEDULELOAN | + When Batch API call with created user and the following data results a 409 error and a "LOAN_LOCKED_BY_COB" error message: + | rescheduleFromDate | submittedOnDate | adjustedDueDate | approvedOnDate | enclosingTransaction | + | 16 January 2024 | 10 January 2024 | 31 January 2024 | 10 January 2024 | true | diff --git a/fineract-e2e-tests-runner/src/test/resources/features/LoanWriteOff.feature b/fineract-e2e-tests-runner/src/test/resources/features/LoanWriteOff.feature new file mode 100644 index 00000000000..cd767271850 --- /dev/null +++ b/fineract-e2e-tests-runner/src/test/resources/features/LoanWriteOff.feature @@ -0,0 +1,67 @@ +@WriteOffFeature + Feature: Write-off + + @TestRailId:C2934 + Scenario: As a user I want to do Write-off a loan and verify that undo repayment post write-off results in error + When Admin sets the business date to "1 January 2023" + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "22 January 2023" + And Customer makes "AUTOPAY" repayment on "22 January 2023" with 100 EUR transaction amount + When Admin sets the business date to "29 January 2023" + And Admin does write-off the loan on "29 January 2023" + Then Loan status will be "CLOSED_WRITTEN_OFF" + Then Loan Transactions tab has a transaction with date: "29 January 2023", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Close (as written-off) | 650.0 | 650.0 | 0.0 | 0.0 | 0.0 | 0.0 | + Then Admin fails to undo "1"th transaction made on "22 January 2023" + + + @TestRailId:C2935 + Scenario: As a user I want to do Write-off a loan and verify that backdate repayment post write-off results in error + When Admin sets the business date to "1 January 2023" + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "22 January 2023" + And Customer makes "AUTOPAY" repayment on "22 January 2023" with 100 EUR transaction amount + When Admin sets the business date to "29 January 2023" + And Admin does write-off the loan on "29 January 2023" + Then Loan status will be "CLOSED_WRITTEN_OFF" + Then Loan Transactions tab has a transaction with date: "29 January 2023", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Close (as written-off) | 650.0 | 650.0 | 0.0 | 0.0 | 0.0 | 0.0 | + Then Loan "AUTOPAY" repayment transaction on "26 January 2023" with 50 EUR transaction amount results in error + + + @TestRailId:C2936 + Scenario: As a user I want to do Write-off a loan and verify that undo write-off results in error + When Admin sets the business date to "1 January 2023" + 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 | + | PIN4_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 01 January 2023 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "1 January 2023" with "1000" amount and expected disbursement date on "1 January 2023" + And Admin successfully disburse the loan on "1 January 2023" with "1000" EUR transaction amount + When Admin sets the business date to "22 January 2023" + And Customer makes "AUTOPAY" repayment on "22 January 2023" with 100 EUR transaction amount + When Admin sets the business date to "29 January 2023" + And Admin does write-off the loan on "29 January 2023" + Then Loan status will be "CLOSED_WRITTEN_OFF" + Then Loan Transactions tab has a transaction with date: "29 January 2023", and with the following data: + | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | + | Close (as written-off) | 650.0 | 650.0 | 0.0 | 0.0 | 0.0 | 0.0 | + Then Admin fails to undo "1"th transaction made on "29 January 2023" + + + + + +