FINERACT-2181: added e2e automation tests for expected tranches with disbursements fix

This commit is contained in:
mdmytriv
2025-05-13 09:39:42 +02:00
committed by Adam Saghy
parent e7b6722e54
commit d1154c59ba
7 changed files with 1024 additions and 69 deletions
@@ -41,6 +41,7 @@ import org.apache.fineract.client.services.JournalEntriesApi;
import org.apache.fineract.client.services.LoanAccountLockApi;
import org.apache.fineract.client.services.LoanChargesApi;
import org.apache.fineract.client.services.LoanCobCatchUpApi;
import org.apache.fineract.client.services.LoanDisbursementDetailsApi;
import org.apache.fineract.client.services.LoanInterestPauseApi;
import org.apache.fineract.client.services.LoanProductsApi;
import org.apache.fineract.client.services.LoanTransactionsApi;
@@ -250,4 +251,9 @@ public class ApiConfiguration {
public LoanInterestPauseApi loanInterestPauseApi() {
return fineractClient.createService(LoanInterestPauseApi.class);
}
@Bean
public LoanDisbursementDetailsApi loanDisbursementDetailsApi() {
return fineractClient.createService(LoanDisbursementDetailsApi.class);
}
}
@@ -21,8 +21,11 @@ package org.apache.fineract.test.factory;
import java.math.BigDecimal;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.client.models.DisbursementDetail;
import org.apache.fineract.client.models.InterestPauseRequestDto;
import org.apache.fineract.client.models.PostAddAndDeleteDisbursementDetailRequest;
import org.apache.fineract.client.models.PostCreateRescheduleLoansRequest;
import org.apache.fineract.client.models.PostLoansLoanIdChargesChargeIdRequest;
import org.apache.fineract.client.models.PostLoansLoanIdRequest;
@@ -183,6 +186,12 @@ public class LoanRequestFactory {
.paymentTypeId(Math.toIntExact(DEFAULT_PAYMENT_TYPE_ID)).dateFormat(DATE_FORMAT).locale(DEFAULT_LOCALE);
}
public static PostAddAndDeleteDisbursementDetailRequest defaultLoanDisbursementDetailRequest(
List<DisbursementDetail> disbursementData) {
return new PostAddAndDeleteDisbursementDetailRequest().disbursementData(disbursementData).dateFormat(DATE_FORMAT)
.locale(DEFAULT_LOCALE);
}
public static PostLoansLoanIdTransactionsRequest defaultPaymentTransactionRequest() {
return new PostLoansLoanIdTransactionsRequest().transactionDate(DEFAULT_TRANSACTION_DATE)
.transactionAmount(DEFAULT_PAYMENT_TRANSACTION_AMOUNT).paymentTypeId(DEFAULT_PAYMENT_TYPE_ID).dateFormat(DATE_FORMAT)
@@ -24,6 +24,7 @@ import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.client.models.BatchResponse;
@@ -75,6 +76,10 @@ public final class ErrorMessageHelper {
return "Loan: [0-9]* disbursement is not allowed on charged-off loan.";
}
public static String disburseIsNotAllowedFailure() {
return "Loan Disbursal is not allowed. Loan Account is not in approved and not disbursed state.";
}
public static String loanSubmitDateInFutureFailureMsg() {
return "The date on which a loan is submitted cannot be in the future.";
}
@@ -910,4 +915,18 @@ public final class ErrorMessageHelper {
public static String wrongValueInTotalPages(Integer actual, Integer expected) {
return String.format("Wrong value for Total pages. %nActual value is: %s %nExpected value is: %s", actual, expected);
}
public static String wrongValueInLineInDisbursementDetailsTab(String resourceId, int line, Set<List<String>> actualList,
List<String> expected) {
String actual = actualList.stream().map(Object::toString).collect(Collectors.joining(System.lineSeparator()));
return String.format("%nWrong value in Loan Tranche Details tab of resource %s line %s." //
+ "%nActual values in line (with the same date) are: %n%s %nExpected values in line: %n%s", resourceId, line, actual,
expected);
}
public static String nrOfLinesWrongInLoanTrancheDetailsTab(String resourceId, int actual, int expected) {
return String.format("%nNumber of lines does not match in Loan Tranche Details tab and expected datatable of resource %s." //
+ "%nNumber of disbursement details tab lines: %s %nNumber of expected datatable lines: %s%n", resourceId, actual,
expected);
}
}
@@ -63,11 +63,13 @@ import org.apache.fineract.avro.loan.v1.LoanTransactionDataV1;
import org.apache.fineract.client.models.AdvancedPaymentData;
import org.apache.fineract.client.models.CommandProcessingResult;
import org.apache.fineract.client.models.DeleteLoansLoanIdResponse;
import org.apache.fineract.client.models.DisbursementDetail;
import org.apache.fineract.client.models.GetLoanProductsChargeOffReasonOptions;
import org.apache.fineract.client.models.GetLoanProductsProductIdResponse;
import org.apache.fineract.client.models.GetLoanProductsResponse;
import org.apache.fineract.client.models.GetLoanProductsTemplateResponse;
import org.apache.fineract.client.models.GetLoansLoanIdDelinquencySummary;
import org.apache.fineract.client.models.GetLoansLoanIdDisbursementDetails;
import org.apache.fineract.client.models.GetLoansLoanIdLoanChargeData;
import org.apache.fineract.client.models.GetLoansLoanIdLoanChargePaidByData;
import org.apache.fineract.client.models.GetLoansLoanIdLoanTermVariations;
@@ -82,6 +84,7 @@ import org.apache.fineract.client.models.GetLoansLoanIdTransactionsTransactionId
import org.apache.fineract.client.models.InterestPauseRequestDto;
import org.apache.fineract.client.models.IsCatchUpRunningDTO;
import org.apache.fineract.client.models.PaymentAllocationOrder;
import org.apache.fineract.client.models.PostAddAndDeleteDisbursementDetailRequest;
import org.apache.fineract.client.models.PostClientsResponse;
import org.apache.fineract.client.models.PostLoansDisbursementData;
import org.apache.fineract.client.models.PostLoansLoanIdRequest;
@@ -97,6 +100,7 @@ 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.LoanDisbursementDetailsApi;
import org.apache.fineract.client.services.LoanInterestPauseApi;
import org.apache.fineract.client.services.LoanProductsApi;
import org.apache.fineract.client.services.LoanTransactionsApi;
@@ -205,6 +209,9 @@ public class LoanStepDef extends AbstractStepDef {
@Autowired
private EventProperties eventProperties;
@Autowired
private LoanDisbursementDetailsApi loanDisbursementDetailsApi;
@When("Admin creates a new Loan")
public void createLoan() throws IOException {
Response<PostClientsResponse> clientResponse = testContext().get(TestContextKey.CLIENT_CREATE_RESPONSE);
@@ -470,6 +477,18 @@ public class LoanStepDef extends AbstractStepDef {
createFullyCustomizedLoanWithChargesAndExpectedTrancheDisbursementsDetails(data.get(1));
}
@When("Admin creates a fully customized loan with disbursement details and following data:")
public void createFullyCustomizedLoanWithDisbursementDetails(final DataTable table) throws IOException {
final List<List<String>> data = table.asLists();
createFullyCustomizedLoanWithExpectedTrancheDisbursementDetails(data.get(1));
}
@When("Admin creates a fully customized loan with disbursements details and following data:")
public void createFullyCustomizedLoanWithDisbursementsDetails(final DataTable table) throws IOException {
final List<List<String>> data = table.asLists();
createFullyCustomizedLoanWithExpectedTrancheDisbursementsDetails(data.get(1));
}
@When("Admin creates a fully customized loan with forced disabled downpayment with the following data:")
public void createFullyCustomizedLoanWithForcedDisabledDownpayment(DataTable table) throws IOException {
List<List<String>> data = table.asLists();
@@ -1375,6 +1394,71 @@ public class LoanStepDef extends AbstractStepDef {
eventCheckHelper.loanDisbursalTransactionEventCheck(loanDisburseResponse);
}
@And("Admin successfully add disbursement detail to the loan on {string} with {double} EUR transaction amount")
public void addDisbursementDetailToLoan(String expectedDisbursementDate, Double disbursementAmount) throws IOException {
Response<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
long loanId = loanResponse.body().getLoanId();
Response<GetLoansLoanIdResponse> loanDetails = loansApi.retrieveLoan(loanId, false, "all", "", "").execute();
Set<GetLoansLoanIdDisbursementDetails> disbursementDetailsList = loanDetails.body().getDisbursementDetails();
List<DisbursementDetail> disbursementData = new ArrayList<>();
// get and add already existing entries - just do not delete them
if (disbursementDetailsList != null) {
disbursementDetailsList.stream().forEach(disbursementDetail -> {
LocalDate expectedDisbursementDateExisting = disbursementDetail.getExpectedDisbursementDate();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DATE_FORMAT);
String formatted = expectedDisbursementDateExisting.format(formatter);
DisbursementDetail disbursementDetailEntryExisting = new DisbursementDetail().id(disbursementDetail.getId())
.expectedDisbursementDate(formatted).principal(disbursementDetail.getPrincipal());
disbursementData.add(disbursementDetailEntryExisting);
});
}
// add new entry with expected disbursement detail
DisbursementDetail disbursementDetailsEntryNew = new DisbursementDetail().principal(disbursementAmount)
.expectedDisbursementDate(expectedDisbursementDate);
disbursementData.add(disbursementDetailsEntryNew);
PostAddAndDeleteDisbursementDetailRequest disbursementDetailRequest = LoanRequestFactory
.defaultLoanDisbursementDetailRequest(disbursementData);
Response<String> loanDisburseResponse = loanDisbursementDetailsApi.addAndDeleteDisbursementDetail(loanId, disbursementDetailRequest)
.execute();
testContext().set(TestContextKey.LOAN_DISBURSEMENT_DETAIL_RESPONSE, loanDisburseResponse);
ErrorHelper.checkSuccessfulApiCall(loanDisburseResponse);
}
@Then("Loan Tranche Details tab has the following data:")
public void loanTrancheDetailsTabCheck(DataTable table) throws IOException {
Response<PostLoansResponse> loanCreateResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
long loanId = loanCreateResponse.body().getLoanId();
String resourceId = String.valueOf(loanId);
Response<GetLoansLoanIdResponse> loanDetailsResponse = loansApi.retrieveLoan(loanId, false, "all", "", "").execute();
ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse);
Set<GetLoansLoanIdDisbursementDetails> disbursementDetails = loanDetailsResponse.body().getDisbursementDetails();
List<List<String>> data = table.asLists();
for (int i = 1; i < data.size(); i++) {
List<String> expectedValues = data.get(i);
String expectedDisbursementDateExpected = expectedValues.get(0);
Set<List<String>> actualValuesList = disbursementDetails.stream()//
.filter(t -> expectedDisbursementDateExpected.equals(FORMATTER.format(t.getExpectedDisbursementDate())))//
.map(t -> fetchValuesOfDisbursementDetails(table.row(0), t))//
.collect(Collectors.toSet());//
boolean containsExpectedValues = actualValuesList.stream()//
.anyMatch(actualValues -> actualValues.equals(expectedValues));//
assertThat(containsExpectedValues)
.as(ErrorMessageHelper.wrongValueInLineInDisbursementDetailsTab(resourceId, i, actualValuesList, expectedValues))
.isTrue();
}
assertThat(disbursementDetails.size())
.as(ErrorMessageHelper.nrOfLinesWrongInTransactionsTab(resourceId, disbursementDetails.size(), data.size() - 1))
.isEqualTo(data.size() - 1);
}
@And("Admin successfully disburse the loan without auto downpayment on {string} with {string} EUR transaction amount")
public void disburseLoanWithoutAutoDownpayment(String actualDisbursementDate, String transactionAmount) throws IOException {
Response<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
@@ -1440,6 +1524,85 @@ public class LoanStepDef extends AbstractStepDef {
eventCheckHelper.loanDisbursalTransactionEventCheck(loanDisburseResponse);
}
@When("Admin successfully undo disbursal")
public void undoDisbursal() throws IOException {
Response<PostLoansLoanIdResponse> loanApproveResponse = testContext().get(TestContextKey.LOAN_APPROVAL_RESPONSE);
long loanId = loanApproveResponse.body().getLoanId();
PostLoansLoanIdRequest undoDisbursalRequest = new PostLoansLoanIdRequest().note("");
Response<PostLoansLoanIdResponse> undoLastDisbursalResponse = loansApi
.stateTransitions(loanId, undoDisbursalRequest, "undodisbursal").execute();
ErrorHelper.checkSuccessfulApiCall(undoLastDisbursalResponse);
}
@When("Admin successfully undo last disbursal")
public void undoLastDisbursal() throws IOException {
Response<PostLoansLoanIdResponse> loanApproveResponse = testContext().get(TestContextKey.LOAN_APPROVAL_RESPONSE);
long loanId = loanApproveResponse.body().getLoanId();
PostLoansLoanIdRequest undoDisbursalRequest = new PostLoansLoanIdRequest().note("");
Response<PostLoansLoanIdResponse> undoLastDisbursalResponse = loansApi
.stateTransitions(loanId, undoDisbursalRequest, "undolastdisbursal").execute();
ErrorHelper.checkSuccessfulApiCall(undoLastDisbursalResponse);
}
@Then("Admin can successfully undone the loan disbursal")
public void checkUndoLoanDisbursal() throws IOException {
Response<PostLoansLoanIdResponse> loanApproveResponse = testContext().get(TestContextKey.LOAN_APPROVAL_RESPONSE);
long loanId = loanApproveResponse.body().getLoanId();
PostLoansLoanIdRequest undoDisbursalRequest = new PostLoansLoanIdRequest().note("");
Response<PostLoansLoanIdResponse> 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<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
long loanId = loanResponse.body().getLoanId();
PostLoansLoanIdRequest disburseRequest = LoanRequestFactory.defaultLoanDisburseRequest()
.actualDisbursementDate(actualDisbursementDate).transactionAmount(new BigDecimal(transactionAmount));
Response<PostLoansLoanIdResponse> 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<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
long loanId = loanResponse.body().getLoanId();
PostLoansLoanIdRequest disburseRequest = LoanRequestFactory.defaultLoanDisburseRequest()
.actualDisbursementDate(actualDisbursementDate).transactionAmount(new BigDecimal(transactionAmount));
Response<PostLoansLoanIdResponse> 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.debug("Error message: {}", developerMessage);
}
@Then("Admin fails to disburse the loan on {string} with {string} amount")
public void disburseLoanFailureIsNotAllowed(String disbursementDate, String disbursementAmount) throws IOException {
Response<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
long loanId = loanResponse.body().getLoanId();
PostLoansLoanIdRequest disburseRequest = LoanRequestFactory.defaultLoanDisburseRequest().actualDisbursementDate(disbursementDate)
.transactionAmount(new BigDecimal(disbursementAmount));
Response<PostLoansLoanIdResponse> loanDisburseResponse = loansApi.stateTransitions(loanId, disburseRequest, "disburse").execute();
ErrorResponse errorDetails = ErrorResponse.from(loanDisburseResponse);
assertThat(errorDetails.getHttpStatusCode()).as(ErrorMessageHelper.dateFailureErrorCodeMsg()).isEqualTo(400);
assertThat(errorDetails.getSingleError().getDeveloperMessage()).isEqualTo(ErrorMessageHelper.disburseIsNotAllowedFailure());
}
@And("Admin does charge-off the loan on {string}")
public void chargeOffLoan(String transactionDate) throws IOException {
Response<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
@@ -1616,72 +1779,6 @@ public class LoanStepDef extends AbstractStepDef {
assertThat(errorDetails.getSingleError().getDeveloperMessage()).isEqualTo(ErrorMessageHelper.notChargedOffFailure(loanId));
}
@When("Admin successfully undo disbursal")
public void undoDisbursal() throws IOException {
Response<PostLoansLoanIdResponse> loanApproveResponse = testContext().get(TestContextKey.LOAN_APPROVAL_RESPONSE);
long loanId = loanApproveResponse.body().getLoanId();
PostLoansLoanIdRequest undoDisbursalRequest = new PostLoansLoanIdRequest().note("");
Response<PostLoansLoanIdResponse> undoLastDisbursalResponse = loansApi
.stateTransitions(loanId, undoDisbursalRequest, "undodisbursal").execute();
ErrorHelper.checkSuccessfulApiCall(undoLastDisbursalResponse);
}
@When("Admin successfully undo last disbursal")
public void undoLastDisbursal() throws IOException {
Response<PostLoansLoanIdResponse> loanApproveResponse = testContext().get(TestContextKey.LOAN_APPROVAL_RESPONSE);
long loanId = loanApproveResponse.body().getLoanId();
PostLoansLoanIdRequest undoDisbursalRequest = new PostLoansLoanIdRequest().note("");
Response<PostLoansLoanIdResponse> undoLastDisbursalResponse = loansApi
.stateTransitions(loanId, undoDisbursalRequest, "undolastdisbursal").execute();
ErrorHelper.checkSuccessfulApiCall(undoLastDisbursalResponse);
}
@Then("Admin can successfully undone the loan disbursal")
public void checkUndoLoanDisbursal() throws IOException {
Response<PostLoansLoanIdResponse> loanApproveResponse = testContext().get(TestContextKey.LOAN_APPROVAL_RESPONSE);
long loanId = loanApproveResponse.body().getLoanId();
PostLoansLoanIdRequest undoDisbursalRequest = new PostLoansLoanIdRequest().note("");
Response<PostLoansLoanIdResponse> 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<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
long loanId = loanResponse.body().getLoanId();
PostLoansLoanIdRequest disburseRequest = LoanRequestFactory.defaultLoanDisburseRequest()
.actualDisbursementDate(actualDisbursementDate).transactionAmount(new BigDecimal(transactionAmount));
Response<PostLoansLoanIdResponse> 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<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
long loanId = loanResponse.body().getLoanId();
PostLoansLoanIdRequest disburseRequest = LoanRequestFactory.defaultLoanDisburseRequest()
.actualDisbursementDate(actualDisbursementDate).transactionAmount(new BigDecimal(transactionAmount));
Response<PostLoansLoanIdResponse> 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.debug("Error message: {}", developerMessage);
}
@Then("Admin fails to disburse the loan on {string} with {string} EUR transaction amount because of charge-off that was performed for the loan")
public void disburseChargedOffLoanFailure(String actualDisbursementDate, String transactionAmount) throws IOException {
Response<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
@@ -3308,7 +3405,107 @@ public class LoanStepDef extends AbstractStepDef {
.graceOnInterestPayment(graceOnInterestPayment)//
.graceOnInterestPayment(graceOnInterestCharged)//
.transactionProcessingStrategyCode(transactionProcessingStrategyCodeValue)//
.disbursementData(disbursementDetail).charges(charges);//
.disbursementData(disbursementDetail)//
.charges(charges);//
final Response<PostLoansResponse> response = loansApi.calculateLoanScheduleOrSubmitLoanApplication(loansRequest, "").execute();
testContext().set(TestContextKey.LOAN_CREATE_RESPONSE, response);
ErrorHelper.checkSuccessfulApiCall(response);
eventCheckHelper.createLoanEventCheck(response);
}
public void createFullyCustomizedLoanWithExpectedTrancheDisbursementDetails(final List<String> loanData) throws IOException {
final String expectedDisbursementDate = loanData.get(16);
final Double disbursementPrincipalAmount = Double.valueOf(loanData.get(17));
List<PostLoansDisbursementData> disbursementDetail = new ArrayList<>();
disbursementDetail.add(
new PostLoansDisbursementData().expectedDisbursementDate(expectedDisbursementDate).principal(disbursementPrincipalAmount));
createFullyCustomizedLoanExpectsTrancheDisbursementDetails(loanData, disbursementDetail);
}
public void createFullyCustomizedLoanWithExpectedTrancheDisbursementsDetails(final List<String> loanData) throws IOException {
final String expectedDisbursementDateFirstDisbursal = loanData.get(16);
final Double disbursementPrincipalAmountFirstDisbursal = Double.valueOf(loanData.get(17));
final String expectedDisbursementDateSecondDisbursal = loanData.get(18);
final Double disbursementPrincipalAmountSecondDisbursal = Double.valueOf(loanData.get(19));
List<PostLoansDisbursementData> disbursementDetail = new ArrayList<>();
disbursementDetail.add(new PostLoansDisbursementData().expectedDisbursementDate(expectedDisbursementDateFirstDisbursal)
.principal(disbursementPrincipalAmountFirstDisbursal));
disbursementDetail.add(new PostLoansDisbursementData().expectedDisbursementDate(expectedDisbursementDateSecondDisbursal)
.principal(disbursementPrincipalAmountSecondDisbursal));
createFullyCustomizedLoanExpectsTrancheDisbursementDetails(loanData, disbursementDetail);
}
public void createFullyCustomizedLoanExpectsTrancheDisbursementDetails(final List<String> loanData,
List<PostLoansDisbursementData> disbursementDetail) throws IOException {
final String loanProduct = loanData.get(0);
final String submitDate = loanData.get(1);
final String principal = loanData.get(2);
final BigDecimal interestRate = new BigDecimal(loanData.get(3));
final String interestTypeStr = loanData.get(4);
final String interestCalculationPeriodStr = loanData.get(5);
final String amortizationTypeStr = loanData.get(6);
final Integer loanTermFrequency = Integer.valueOf(loanData.get(7));
final String loanTermFrequencyType = loanData.get(8);
final Integer repaymentFrequency = Integer.valueOf(loanData.get(9));
final String repaymentFrequencyTypeStr = loanData.get(10);
final Integer numberOfRepayments = Integer.valueOf(loanData.get(11));
final Integer graceOnPrincipalPayment = Integer.valueOf(loanData.get(12));
final Integer graceOnInterestPayment = Integer.valueOf(loanData.get(13));
final Integer graceOnInterestCharged = Integer.valueOf(loanData.get(14));
final String transactionProcessingStrategyCode = loanData.get(15);
final Response<PostClientsResponse> clientResponse = testContext().get(TestContextKey.CLIENT_CREATE_RESPONSE);
final Long clientId = clientResponse.body().getClientId();
final DefaultLoanProduct product = DefaultLoanProduct.valueOf(loanProduct);
final Long loanProductId = loanProductResolver.resolve(product);
final LoanTermFrequencyType termFrequencyType = LoanTermFrequencyType.valueOf(loanTermFrequencyType);
final Integer loanTermFrequencyTypeValue = termFrequencyType.getValue();
final RepaymentFrequencyType repaymentFrequencyType = RepaymentFrequencyType.valueOf(repaymentFrequencyTypeStr);
final Integer repaymentFrequencyTypeValue = repaymentFrequencyType.getValue();
final InterestType interestType = InterestType.valueOf(interestTypeStr);
final Integer interestTypeValue = interestType.getValue();
final InterestCalculationPeriodTime interestCalculationPeriod = InterestCalculationPeriodTime.valueOf(interestCalculationPeriodStr);
final Integer interestCalculationPeriodValue = interestCalculationPeriod.getValue();
final AmortizationType amortizationType = AmortizationType.valueOf(amortizationTypeStr);
final Integer amortizationTypeValue = amortizationType.getValue();
final TransactionProcessingStrategyCode processingStrategyCode = TransactionProcessingStrategyCode
.valueOf(transactionProcessingStrategyCode);
final String transactionProcessingStrategyCodeValue = processingStrategyCode.getValue();
final 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)//
.disbursementData(disbursementDetail);//
final Response<PostLoansResponse> response = loansApi.calculateLoanScheduleOrSubmitLoanApplication(loansRequest, "").execute();
testContext().set(TestContextKey.LOAN_CREATE_RESPONSE, response);
@@ -3524,6 +3721,23 @@ public class LoanStepDef extends AbstractStepDef {
return actualValues;
}
private List<String> fetchValuesOfDisbursementDetails(List<String> header, GetLoansLoanIdDisbursementDetails t) {
List<String> actualValues = new ArrayList<>();
for (String headerName : header) {
switch (headerName) {
case "Expected Disbursement On" ->
actualValues.add(t.getExpectedDisbursementDate() == null ? null : FORMATTER.format(t.getExpectedDisbursementDate()));
case "Disbursed On" ->
actualValues.add(t.getActualDisbursementDate() == null ? null : FORMATTER.format(t.getActualDisbursementDate()));
case "Principal" -> actualValues.add(t.getPrincipal() == null ? null : String.valueOf(t.getPrincipal()));
case "Net Disbursal Amount" ->
actualValues.add(t.getNetDisbursalAmount() == null ? null : String.valueOf(t.getNetDisbursalAmount()));
default -> throw new IllegalStateException(String.format("Header name %s cannot be found", headerName));
}
}
return actualValues;
}
private List<String> fetchValuesOfRepaymentSchedule(List<String> header, GetLoansLoanIdRepaymentPeriod repaymentPeriod) {
List<String> actualValues = new ArrayList<>();
for (String headerName : header) {
@@ -207,4 +207,5 @@ public abstract class TestContextKey {
public static final String LOAN_DELINQUENCY_ACTION_RESPONSE = "loanDelinquencyActionResponse";
public static final String LOAN_TRANSACTION_RESPONSE = "loanTransactionResponse";
public static final String LOAN_CAPITALIZED_INCOME_RESPONSE = "loanCapitalizedIncomeResponse";
public static final String LOAN_DISBURSEMENT_DETAIL_RESPONSE = "loanDisbursementDetailResponse";
}
@@ -7891,6 +7891,712 @@ Feature: EMI calculation and repayment schedule checks for interest bearing loan
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 8000.0 | 3456.78 | 0.0 | 0.0 | 11456.78 | 0.05 | 0.0 | 0.04 | 11456.73 |
@TestRailId:C3657
Scenario: Verify tranche interest bearing progressive loan that expects two tranches with repayment and undo last disbursement - UC1
When Admin sets the business date to "01 January 2025"
When Admin creates a client with random data
When Admin creates a fully customized loan with disbursements details and following data:
| LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy | 1st_tranche_disb_expected_date | 1st_tranche_disb_principal | 2nd_tranche_disb_expected_date | 2nd_tranche_disb_principal |
| LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_MULTIDISBURSE_EXPECT_TRANCHE | 01 January 2025 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | 01 January 2025 | 600.0 | 01 February 2025 | 200.0 |
And Admin successfully approves the loan on "01 January 2025" with "1000" amount and expected disbursement date on "01 January 2025"
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 2025 | | 600.0 | | | 0.0 | | 0.0 | | | | 0.0 |
| 1 | 31 | 01 February 2025 | | 501.45 | 98.55 | 3.5 | 0.0 | 0.0 | 102.05 | 0.0 | 0.0 | 0.0 | 102.05 |
| | | 01 February 2025 | | 200.0 | | | 0.0 | | 0.0 | | | | 0.0 |
| 2 | 28 | 01 March 2025 | | 562.79 | 138.66 | 4.09 | 0.0 | 0.0 | 142.75 | 0.0 | 0.0 | 0.0 | 142.75 |
| 3 | 31 | 01 April 2025 | | 423.32 | 139.47 | 3.28 | 0.0 | 0.0 | 142.75 | 0.0 | 0.0 | 0.0 | 142.75 |
| 4 | 30 | 01 May 2025 | | 283.04 | 140.28 | 2.47 | 0.0 | 0.0 | 142.75 | 0.0 | 0.0 | 0.0 | 142.75 |
| 5 | 31 | 01 June 2025 | | 141.94 | 141.1 | 1.65 | 0.0 | 0.0 | 142.75 | 0.0 | 0.0 | 0.0 | 142.75 |
| 6 | 30 | 01 July 2025 | | 0.0 | 141.94 | 0.83 | 0.0 | 0.0 | 142.77 | 0.0 | 0.0 | 0.0 | 142.77 |
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 800.0 | 15.82 | 0.0 | 0.0 | 815.82 | 0.0 | 0.0 | 0.0 | 815.82 |
Then Loan Tranche Details tab has the following data:
| Expected Disbursement On | Disbursed On | Principal | Net Disbursal Amount |
| 01 January 2025 | | 600.0 | |
| 01 February 2025 | | 200.0 | |
# --- 1st disbursement - 1 January, 2025 ---
When Admin successfully disburse the loan on "01 January 2025" with "700" EUR transaction amount
Then Loan Tranche Details tab has the following data:
| Expected Disbursement On | Disbursed On | Principal | Net Disbursal Amount |
| 01 January 2025 | 01 January 2025 | 700.0 | |
| 01 February 2025 | | 200.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 January 2025 | | 700.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2025 | | 585.02 | 114.98 | 4.08 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| | | 01 February 2025 | | 200.0 | | | 0.0 | | 0.0 | | | | 0.0 |
| 2 | 28 | 01 March 2025 | | 669.37 | 115.65 | 3.41 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 3 | 31 | 01 April 2025 | | 553.05 | 116.32 | 2.74 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 4 | 30 | 01 May 2025 | | 436.05 | 117.0 | 2.06 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 5 | 31 | 01 June 2025 | | 318.37 | 117.68 | 1.38 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 6 | 30 | 01 July 2025 | | 200.0 | 118.37 | 0.69 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 700.0 | 14.36 | 0.0 | 0.0 | 714.36 | 0.0 | 0.0 | 0.0 | 714.36 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 01 January 2025 | Disbursement | 700.0 | 0.0 | 0.0 | 0.0 | 0.0 | 700.0 | false | false |
# --- 1st repayment - 15 January, 2025 ---
When Admin sets the business date to "15 January 2025"
When Admin runs inline COB job for Loan
And Customer makes "AUTOPAY" repayment on "15 January 2025" with 119.06 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 2025 | | 700.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2025 | 15 January 2025 | 582.78 | 117.22 | 1.84 | 0.0 | 0.0 | 119.06 | 119.06 | 119.06 | 0.0 | 0.0 |
| | | 01 February 2025 | | 200.0 | | | 0.0 | | 0.0 | | | | 0.0 |
| 2 | 28 | 01 March 2025 | | 668.99 | 113.79 | 5.27 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 3 | 31 | 01 April 2025 | | 552.67 | 116.32 | 2.74 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 4 | 30 | 01 May 2025 | | 435.67 | 117.0 | 2.06 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 5 | 31 | 01 June 2025 | | 317.98 | 117.69 | 1.37 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 6 | 30 | 01 July 2025 | | 200.0 | 117.98 | 0.69 | 0.0 | 0.0 | 118.67 | 0.0 | 0.0 | 0.0 | 118.67 |
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 700.0 | 13.97 | 0.0 | 0.0 | 713.97 | 119.06 | 119.06 | 0.0 | 594.91 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 01 January 2025 | Disbursement | 700.0 | 0.0 | 0.0 | 0.0 | 0.0 | 700.0 | false | false |
| 14 January 2025 | Accrual | 1.71 | 0.0 | 1.71 | 0.0 | 0.0 | 0.0 | false | false |
| 15 January 2025 | Repayment | 119.06 | 117.22 | 1.84 | 0.0 | 0.0 | 582.78 | false | false |
# --- 2nd disbursement - 1 February, 2025 ---
When Admin sets the business date to "01 February 2025"
When Admin runs inline COB job for Loan
When Admin successfully disburse the loan on "01 February 2025" with "300" EUR transaction amount
Then Loan Tranche Details tab has the following data:
| Expected Disbursement On | Disbursed On | Principal | Net Disbursal Amount |
| 01 January 2025 | 01 January 2025 | 700.0 | |
| 01 February 2025 | 01 February 2025 | 300.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 January 2025 | | 700.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2025 | 15 January 2025 | 582.78 | 117.22 | 1.84 | 0.0 | 0.0 | 119.06 | 119.06 | 119.06 | 0.0 | 0.0 |
| | | 01 February 2025 | | 300.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 2 | 28 | 01 March 2025 | | 709.69 | 173.09 | 7.02 | 0.0 | 0.0 | 180.11 | 0.0 | 0.0 | 0.0 | 180.11 |
| 3 | 31 | 01 April 2025 | | 533.72 | 175.97 | 4.14 | 0.0 | 0.0 | 180.11 | 0.0 | 0.0 | 0.0 | 180.11 |
| 4 | 30 | 01 May 2025 | | 356.72 | 177.0 | 3.11 | 0.0 | 0.0 | 180.11 | 0.0 | 0.0 | 0.0 | 180.11 |
| 5 | 31 | 01 June 2025 | | 178.69 | 178.03 | 2.08 | 0.0 | 0.0 | 180.11 | 0.0 | 0.0 | 0.0 | 180.11 |
| 6 | 30 | 01 July 2025 | | 0.0 | 178.69 | 1.04 | 0.0 | 0.0 | 179.73 | 0.0 | 0.0 | 0.0 | 179.73 |
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 1000.0 | 19.23 | 0.0 | 0.0 | 1019.23 | 119.06 | 119.06 | 0.0 | 900.17 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 01 January 2025 | Disbursement | 700.0 | 0.0 | 0.0 | 0.0 | 0.0 | 700.0 | false | false |
| 14 January 2025 | Accrual | 1.71 | 0.0 | 1.71 | 0.0 | 0.0 | 0.0 | false | false |
| 15 January 2025 | Repayment | 119.06 | 117.22 | 1.84 | 0.0 | 0.0 | 582.78 | false | false |
| 15 January 2025 | Accrual | 0.13 | 0.0 | 0.13 | 0.0 | 0.0 | 0.0 | false | false |
| 16 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 17 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 18 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 19 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 20 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 21 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 22 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 23 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 24 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 25 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 26 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 27 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 28 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 29 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 30 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 31 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 01 February 2025 | Disbursement | 300.0 | 0.0 | 0.0 | 0.0 | 0.0 | 882.78 | false | false |
Then Admin fails to disburse the loan on "01 February 2025" with "100" amount
# --- undo last disbursement --- #
When Admin successfully undo last disbursal
Then Loan Tranche Details tab has the following data:
| Expected Disbursement On | Disbursed On | Principal | Net Disbursal Amount |
| 01 January 2025 | 01 January 2025 | 700.0 | |
When Admin sets the business date to "02 February 2025"
When Admin runs inline COB job for Loan
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 2025 | | 700.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2025 | 15 January 2025 | 582.78 | 117.22 | 1.84 | 0.0 | 0.0 | 119.06 | 119.06 | 119.06 | 0.0 | 0.0 |
| 2 | 28 | 01 March 2025 | | 468.99 | 113.79 | 5.27 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 3 | 31 | 01 April 2025 | | 352.67 | 116.32 | 2.74 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 4 | 30 | 01 May 2025 | | 235.67 | 117.0 | 2.06 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 5 | 31 | 01 June 2025 | | 117.98 | 117.69 | 1.37 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 6 | 30 | 01 July 2025 | | 0.0 | 117.98 | 0.69 | 0.0 | 0.0 | 118.67 | 0.0 | 0.0 | 0.0 | 118.67 |
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 700.0 | 13.97 | 0.0 | 0.0 | 713.97 | 119.06 | 119.06 | 0.0 | 594.91 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 01 January 2025 | Disbursement | 700.0 | 0.0 | 0.0 | 0.0 | 0.0 | 700.0 | false | false |
| 14 January 2025 | Accrual | 1.71 | 0.0 | 1.71 | 0.0 | 0.0 | 0.0 | false | false |
| 15 January 2025 | Repayment | 119.06 | 117.22 | 1.84 | 0.0 | 0.0 | 582.78 | false | false |
| 15 January 2025 | Accrual | 0.13 | 0.0 | 0.13 | 0.0 | 0.0 | 0.0 | false | false |
| 16 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 17 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 18 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 19 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 20 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 21 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 22 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 23 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 24 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 25 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 26 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 27 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 28 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 29 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 30 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 31 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 01 February 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
Then Admin fails to disburse the loan on "02 February 2025" with "200" amount
@TestRailId:C3658
Scenario: Verify tranche interest bearing progressive loan that expects two tranches with two repayments and undo last disbursement - UC2
When Admin sets the business date to "01 January 2025"
When Admin creates a client with random data
When Admin creates a fully customized loan with disbursements details and following data:
| LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy | 1st_tranche_disb_expected_date |1st_tranche_disb_principal | 2nd_tranche_disb_expected_date | 2nd_tranche_disb_principal |
| LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_MULTIDISBURSE_EXPECT_TRANCHE | 01 January 2025 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 90 | DAYS | 15 | DAYS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | 01 January 2025 | 700.0 | 16 January 2025 | 300.0 |
And Admin successfully approves the loan on "01 January 2025" with "1000" amount and expected disbursement date on "01 January 2025"
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 2025 | | 700.0 | | | 0.0 | | 0.0 | | | | 0.0 |
| 1 | 15 | 16 January 2025 | | 584.18 | 115.82 | 2.04 | 0.0 | 0.0 | 117.86 | 0.0 | 0.0 | 0.0 | 117.86 |
| | | 16 January 2025 | | 300.0 | | | 0.0 | | 0.0 | | | | 0.0 |
| 2 | 15 | 31 January 2025 | | 708.37 | 175.81 | 2.58 | 0.0 | 0.0 | 178.39 | 0.0 | 0.0 | 0.0 | 178.39 |
| 3 | 15 | 15 February 2025 | | 532.05 | 176.32 | 2.07 | 0.0 | 0.0 | 178.39 | 0.0 | 0.0 | 0.0 | 178.39 |
| 4 | 15 | 02 March 2025 | | 355.21 | 176.84 | 1.55 | 0.0 | 0.0 | 178.39 | 0.0 | 0.0 | 0.0 | 178.39 |
| 5 | 15 | 17 March 2025 | | 177.86 | 177.35 | 1.04 | 0.0 | 0.0 | 178.39 | 0.0 | 0.0 | 0.0 | 178.39 |
| 6 | 15 | 01 April 2025 | | 0.0 | 177.86 | 0.52 | 0.0 | 0.0 | 178.38 | 0.0 | 0.0 | 0.0 | 178.38 |
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.8 | 0.0 | 0.0 | 1009.8 | 0.0 | 0.0 | 0.0 | 1009.8 |
# --- 1st disbursement - 1 January, 2025 ---
When Admin successfully disburse the loan on "01 January 2025" with "700" EUR transaction amount
Then Loan Tranche Details tab has the following data:
| Expected Disbursement On | Disbursed On | Principal | Net Disbursal Amount |
| 01 January 2025 | 01 January 2025 | 700.0 | |
| 16 January 2025 | | 300.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 January 2025 | | 700.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 15 | 16 January 2025 | | 584.18 | 115.82 | 2.04 | 0.0 | 0.0 | 117.86 | 0.0 | 0.0 | 0.0 | 117.86 |
| | | 16 January 2025 | | 300.0 | | | 0.0 | | 0.0 | | | | 0.0 |
| 2 | 15 | 31 January 2025 | | 768.02 | 116.16 | 1.7 | 0.0 | 0.0 | 117.86 | 0.0 | 0.0 | 0.0 | 117.86 |
| 3 | 15 | 15 February 2025 | | 651.53 | 116.49 | 1.37 | 0.0 | 0.0 | 117.86 | 0.0 | 0.0 | 0.0 | 117.86 |
| 4 | 15 | 02 March 2025 | | 534.7 | 116.83 | 1.03 | 0.0 | 0.0 | 117.86 | 0.0 | 0.0 | 0.0 | 117.86 |
| 5 | 15 | 17 March 2025 | | 417.52 | 117.18 | 0.68 | 0.0 | 0.0 | 117.86 | 0.0 | 0.0 | 0.0 | 117.86 |
| 6 | 15 | 01 April 2025 | | 300.0 | 117.52 | 0.34 | 0.0 | 0.0 | 117.86 | 0.0 | 0.0 | 0.0 | 117.86 |
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 700.0 | 7.16 | 0.0 | 0.0 | 707.16 | 0.0 | 0.0 | 0.0 | 707.16 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 01 January 2025 | Disbursement | 700.0 | 0.0 | 0.0 | 0.0 | 0.0 | 700.0 | false | false |
# --- 1st repayment - 16 January, 2025 ---
When Admin sets the business date to "16 January 2025"
When Admin runs inline COB job for Loan
And Customer makes "AUTOPAY" repayment on "16 January 2025" with 117.86 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 2025 | | 700.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 15 | 16 January 2025 | 16 January 2025 | 584.18 | 115.82 | 2.04 | 0.0 | 0.0 | 117.86 | 117.86 | 0.0 | 0.0 | 0.0 |
| | | 16 January 2025 | | 300.0 | | | 0.0 | | 0.0 | | | | 0.0 |
| 2 | 15 | 31 January 2025 | | 768.02 | 116.16 | 1.7 | 0.0 | 0.0 | 117.86 | 0.0 | 0.0 | 0.0 | 117.86 |
| 3 | 15 | 15 February 2025 | | 651.53 | 116.49 | 1.37 | 0.0 | 0.0 | 117.86 | 0.0 | 0.0 | 0.0 | 117.86 |
| 4 | 15 | 02 March 2025 | | 534.7 | 116.83 | 1.03 | 0.0 | 0.0 | 117.86 | 0.0 | 0.0 | 0.0 | 117.86 |
| 5 | 15 | 17 March 2025 | | 417.52 | 117.18 | 0.68 | 0.0 | 0.0 | 117.86 | 0.0 | 0.0 | 0.0 | 117.86 |
| 6 | 15 | 01 April 2025 | | 300.0 | 117.52 | 0.34 | 0.0 | 0.0 | 117.86 | 0.0 | 0.0 | 0.0 | 117.86 |
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 700.0 | 7.16 | 0.0 | 0.0 | 707.16 | 117.86 | 0.0 | 0.0 | 589.3 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 01 January 2025 | Disbursement | 700.0 | 0.0 | 0.0 | 0.0 | 0.0 | 700.0 | false | false |
| 15 January 2025 | Accrual | 1.91 | 0.0 | 1.91 | 0.0 | 0.0 | 0.0 | false | false |
| 16 January 2025 | Repayment | 117.86 | 115.82 | 2.04 | 0.0 | 0.0 | 584.18 | false | false |
# --- 2nd repayment - 31 January, 2025 ---
When Admin sets the business date to "31 January 2025"
When Admin runs inline COB job for Loan
And Customer makes "AUTOPAY" repayment on "31 January 2025" with 117.86 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 2025 | | 700.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 15 | 16 January 2025 | 16 January 2025 | 584.18 | 115.82 | 2.04 | 0.0 | 0.0 | 117.86 | 117.86 | 0.0 | 0.0 | 0.0 |
| 2 | 15 | 31 January 2025 | 31 January 2025 | 468.02 | 116.16 | 1.7 | 0.0 | 0.0 | 117.86 | 117.86 | 0.0 | 0.0 | 0.0 |
| 3 | 15 | 15 February 2025 | | 351.53 | 116.49 | 1.37 | 0.0 | 0.0 | 117.86 | 0.0 | 0.0 | 0.0 | 117.86 |
| 4 | 15 | 02 March 2025 | | 234.7 | 116.83 | 1.03 | 0.0 | 0.0 | 117.86 | 0.0 | 0.0 | 0.0 | 117.86 |
| 5 | 15 | 17 March 2025 | | 117.52 | 117.18 | 0.68 | 0.0 | 0.0 | 117.86 | 0.0 | 0.0 | 0.0 | 117.86 |
| 6 | 15 | 01 April 2025 | | 0.0 | 117.52 | 0.34 | 0.0 | 0.0 | 117.86 | 0.0 | 0.0 | 0.0 | 117.86 |
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 700.0 | 7.16 | 0.0 | 0.0 | 707.16 | 235.72 | 0.0 | 0.0 | 471.44 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 01 January 2025 | Disbursement | 700.0 | 0.0 | 0.0 | 0.0 | 0.0 | 700.0 | false | false |
| 15 January 2025 | Accrual | 1.91 | 0.0 | 1.91 | 0.0 | 0.0 | 0.0 | false | false |
| 16 January 2025 | Repayment | 117.86 | 115.82 | 2.04 | 0.0 | 0.0 | 584.18 | false | false |
| 16 January 2025 | Accrual | 0.13 | 0.0 | 0.13 | 0.0 | 0.0 | 0.0 | false | false |
| 17 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 18 January 2025 | Accrual | 0.12 | 0.0 | 0.12 | 0.0 | 0.0 | 0.0 | false | false |
| 19 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 20 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 21 January 2025 | Accrual | 0.12 | 0.0 | 0.12 | 0.0 | 0.0 | 0.0 | false | false |
| 22 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 23 January 2025 | Accrual | 0.12 | 0.0 | 0.12 | 0.0 | 0.0 | 0.0 | false | false |
| 24 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 25 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 26 January 2025 | Accrual | 0.12 | 0.0 | 0.12 | 0.0 | 0.0 | 0.0 | false | false |
| 27 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 28 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 29 January 2025 | Accrual | 0.12 | 0.0 | 0.12 | 0.0 | 0.0 | 0.0 | false | false |
| 30 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 31 January 2025 | Repayment | 117.86 | 116.16 | 1.7 | 0.0 | 0.0 | 468.02 | false | false |
# --- 2nd disbursement - 1 February, 2025 ---
When Admin sets the business date to "01 February 2025"
When Admin runs inline COB job for Loan
When Admin successfully disburse the loan on "01 February 2025" with "300" EUR transaction amount
Then Loan Tranche Details tab has the following data:
| Expected Disbursement On | Disbursed On | Principal | Net Disbursal Amount |
| 01 January 2025 | 01 January 2025 | 700.0 | |
| 16 January 2025 | 01 February 2025 | 300.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 January 2025 | | 700.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 15 | 16 January 2025 | 16 January 2025 | 584.18 | 115.82 | 2.04 | 0.0 | 0.0 | 117.86 | 117.86 | 0.0 | 0.0 | 0.0 |
| 2 | 15 | 31 January 2025 | 31 January 2025 | 468.02 | 116.16 | 1.7 | 0.0 | 0.0 | 117.86 | 117.86 | 0.0 | 0.0 | 0.0 |
| | | 01 February 2025 | | 300.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 3 | 15 | 15 February 2025 | | 576.81 | 191.21 | 2.18 | 0.0 | 0.0 | 193.39 | 0.0 | 0.0 | 0.0 | 193.39 |
| 4 | 15 | 02 March 2025 | | 385.1 | 191.71 | 1.68 | 0.0 | 0.0 | 193.39 | 0.0 | 0.0 | 0.0 | 193.39 |
| 5 | 15 | 17 March 2025 | | 192.83 | 192.27 | 1.12 | 0.0 | 0.0 | 193.39 | 0.0 | 0.0 | 0.0 | 193.39 |
| 6 | 15 | 01 April 2025 | | 0.0 | 192.83 | 0.56 | 0.0 | 0.0 | 193.39 | 0.0 | 0.0 | 0.0 | 193.39 |
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.28 | 0.0 | 0.0 | 1009.28 | 235.72 | 0.0 | 0.0 | 773.56 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 01 January 2025 | Disbursement | 700.0 | 0.0 | 0.0 | 0.0 | 0.0 | 700.0 | false | false |
| 15 January 2025 | Accrual | 1.91 | 0.0 | 1.91 | 0.0 | 0.0 | 0.0 | false | false |
| 16 January 2025 | Repayment | 117.86 | 115.82 | 2.04 | 0.0 | 0.0 | 584.18 | false | false |
| 16 January 2025 | Accrual | 0.13 | 0.0 | 0.13 | 0.0 | 0.0 | 0.0 | false | false |
| 17 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 18 January 2025 | Accrual | 0.12 | 0.0 | 0.12 | 0.0 | 0.0 | 0.0 | false | false |
| 19 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 20 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 21 January 2025 | Accrual | 0.12 | 0.0 | 0.12 | 0.0 | 0.0 | 0.0 | false | false |
| 22 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 23 January 2025 | Accrual | 0.12 | 0.0 | 0.12 | 0.0 | 0.0 | 0.0 | false | false |
| 24 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 25 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 26 January 2025 | Accrual | 0.12 | 0.0 | 0.12 | 0.0 | 0.0 | 0.0 | false | false |
| 27 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 28 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 29 January 2025 | Accrual | 0.12 | 0.0 | 0.12 | 0.0 | 0.0 | 0.0 | false | false |
| 30 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 31 January 2025 | Repayment | 117.86 | 116.16 | 1.7 | 0.0 | 0.0 | 468.02 | false | false |
| 31 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 01 February 2025 | Disbursement | 300.0 | 0.0 | 0.0 | 0.0 | 0.0 | 768.02 | false | false |
Then Admin fails to disburse the loan on "01 February 2025" with "100" amount
# --- undo disbursement --- #
When Admin sets the business date to "02 February 2025"
When Admin runs inline COB job for Loan
When Admin successfully undo last disbursal
Then Loan Tranche Details tab has the following data:
| Expected Disbursement On | Disbursed On | Principal | Net Disbursal Amount |
| 01 January 2025 | 01 January 2025 | 700.0 | |
When Admin sets the business date to "02 February 2025"
When Admin runs inline COB job for Loan
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 2025 | | 700.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 15 | 16 January 2025 | 16 January 2025 | 584.18 | 115.82 | 2.04 | 0.0 | 0.0 | 117.86 | 117.86 | 0.0 | 0.0 | 0.0 |
| 2 | 15 | 31 January 2025 | 31 January 2025 | 468.02 | 116.16 | 1.7 | 0.0 | 0.0 | 117.86 | 117.86 | 0.0 | 0.0 | 0.0 |
| 3 | 15 | 15 February 2025 | | 351.53 | 116.49 | 1.37 | 0.0 | 0.0 | 117.86 | 0.0 | 0.0 | 0.0 | 117.86 |
| 4 | 15 | 02 March 2025 | | 234.7 | 116.83 | 1.03 | 0.0 | 0.0 | 117.86 | 0.0 | 0.0 | 0.0 | 117.86 |
| 5 | 15 | 17 March 2025 | | 117.52 | 117.18 | 0.68 | 0.0 | 0.0 | 117.86 | 0.0 | 0.0 | 0.0 | 117.86 |
| 6 | 15 | 01 April 2025 | | 0.0 | 117.52 | 0.34 | 0.0 | 0.0 | 117.86 | 0.0 | 0.0 | 0.0 | 117.86 |
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 700.0 | 7.16 | 0.0 | 0.0 | 707.16 | 235.72 | 0.0 | 0.0 | 471.44 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 01 January 2025 | Disbursement | 700.0 | 0.0 | 0.0 | 0.0 | 0.0 | 700.0 | false | false |
| 15 January 2025 | Accrual | 1.91 | 0.0 | 1.91 | 0.0 | 0.0 | 0.0 | false | false |
| 16 January 2025 | Repayment | 117.86 | 115.82 | 2.04 | 0.0 | 0.0 | 584.18 | false | false |
| 16 January 2025 | Accrual | 0.13 | 0.0 | 0.13 | 0.0 | 0.0 | 0.0 | false | false |
| 17 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 18 January 2025 | Accrual | 0.12 | 0.0 | 0.12 | 0.0 | 0.0 | 0.0 | false | false |
| 19 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 20 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 21 January 2025 | Accrual | 0.12 | 0.0 | 0.12 | 0.0 | 0.0 | 0.0 | false | false |
| 22 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 23 January 2025 | Accrual | 0.12 | 0.0 | 0.12 | 0.0 | 0.0 | 0.0 | false | false |
| 24 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 25 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 26 January 2025 | Accrual | 0.12 | 0.0 | 0.12 | 0.0 | 0.0 | 0.0 | false | false |
| 27 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 28 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 29 January 2025 | Accrual | 0.12 | 0.0 | 0.12 | 0.0 | 0.0 | 0.0 | false | false |
| 30 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 31 January 2025 | Repayment | 117.86 | 116.16 | 1.7 | 0.0 | 0.0 | 468.02 | false | false |
| 31 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 01 February 2025 | Accrual | 0.09 | 0.0 | 0.09 | 0.0 | 0.0 | 0.0 | false | false |
Then Admin fails to disburse the loan on "02 February 2025" with "200" amount
@TestRailId:C3659
Scenario: Verify tranche interest bearing progressive loan that expects tranche with added 2 more tranches and undo last disbursement - UC3
When Admin sets the business date to "01 January 2025"
When Admin creates a client with random data
When Admin creates a fully customized loan with disbursement details and following data:
| LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy | 1st_tranche_disb_expected_date |1st_tranche_disb_principal |
| LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_MULTIDISBURSE_EXPECT_TRANCHE | 01 January 2025 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | 01 January 2025 | 700.0 |
And Admin successfully approves the loan on "01 January 2025" with "1000" amount and expected disbursement date on "01 January 2025"
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 2025 | | 700.0 | | | 0.0 | | 0.0 | | | | 0.0 |
| 1 | 31 | 01 February 2025 | | 585.02 | 114.98 | 4.08 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 2 | 28 | 01 March 2025 | | 469.37 | 115.65 | 3.41 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 3 | 31 | 01 April 2025 | | 353.05 | 116.32 | 2.74 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 4 | 30 | 01 May 2025 | | 236.05 | 117.0 | 2.06 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 5 | 31 | 01 June 2025 | | 118.37 | 117.68 | 1.38 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 6 | 30 | 01 July 2025 | | 0.0 | 118.37 | 0.69 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 700.0 | 14.36 | 0.0 | 0.0 | 714.36 | 0.0 | 0.0 | 0.0 | 714.36 |
When Admin successfully disburse the loan on "01 January 2025" with "600" EUR transaction amount
# When Admin runs inline COB job for Loan
Then Loan Tranche Details tab has the following data:
| Expected Disbursement On | Disbursed On | Principal | Net Disbursal Amount |
| 01 January 2025 | 01 January 2025 | 600.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 January 2025 | | 600.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2025 | | 501.45 | 98.55 | 3.5 | 0.0 | 0.0 | 102.05 | 0.0 | 0.0 | 0.0 | 102.05 |
| 2 | 28 | 01 March 2025 | | 402.33 | 99.12 | 2.93 | 0.0 | 0.0 | 102.05 | 0.0 | 0.0 | 0.0 | 102.05 |
| 3 | 31 | 01 April 2025 | | 302.63 | 99.7 | 2.35 | 0.0 | 0.0 | 102.05 | 0.0 | 0.0 | 0.0 | 102.05 |
| 4 | 30 | 01 May 2025 | | 202.35 | 100.28 | 1.77 | 0.0 | 0.0 | 102.05 | 0.0 | 0.0 | 0.0 | 102.05 |
| 5 | 31 | 01 June 2025 | | 101.48 | 100.87 | 1.18 | 0.0 | 0.0 | 102.05 | 0.0 | 0.0 | 0.0 | 102.05 |
| 6 | 30 | 01 July 2025 | | 0.0 | 101.48 | 0.59 | 0.0 | 0.0 | 102.07 | 0.0 | 0.0 | 0.0 | 102.07 |
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 600.0 | 12.32 | 0.0 | 0.0 | 612.32 | 0.0 | 0.0 | 0.0 | 612.32 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 01 January 2025 | Disbursement | 600.0 | 0.0 | 0.0 | 0.0 | 0.0 | 600.0 | false | false |
Then Admin fails to disburse the loan on "01 January 2025" with "200" amount
# --- add 2nd expected disbursement details with expected disbursement date - 8 Jan, 2025 --- #
And Admin successfully add disbursement detail to the loan on "08 January 2025" with 300 EUR transaction amount
Then Loan Tranche Details tab has the following data:
| Expected Disbursement On | Disbursed On | Principal | Net Disbursal Amount |
| 01 January 2025 | 01 January 2025 | 600.0 | |
| 08 January 2025 | | 300.0 | 600.0 |
When Admin sets the business date to "08 January 2025"
When Admin runs inline COB job for Loan
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 2025 | | 600.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| | | 08 January 2025 | | 300.0 | | | 0.0 | | 0.0 | | | | 0.0 |
| 1 | 31 | 01 February 2025 | | 801.45 | 98.55 | 3.5 | 0.0 | 0.0 | 102.05 | 0.0 | 0.0 | 0.0 | 102.05 |
| 2 | 28 | 01 March 2025 | | 702.33 | 99.12 | 2.93 | 0.0 | 0.0 | 102.05 | 0.0 | 0.0 | 0.0 | 102.05 |
| 3 | 31 | 01 April 2025 | | 602.63 | 99.7 | 2.35 | 0.0 | 0.0 | 102.05 | 0.0 | 0.0 | 0.0 | 102.05 |
| 4 | 30 | 01 May 2025 | | 502.35 | 100.28 | 1.77 | 0.0 | 0.0 | 102.05 | 0.0 | 0.0 | 0.0 | 102.05 |
| 5 | 31 | 01 June 2025 | | 401.48 | 100.87 | 1.18 | 0.0 | 0.0 | 102.05 | 0.0 | 0.0 | 0.0 | 102.05 |
| 6 | 30 | 01 July 2025 | | 300.0 | 101.48 | 0.59 | 0.0 | 0.0 | 102.07 | 0.0 | 0.0 | 0.0 | 102.07 |
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 600.0 | 12.32 | 0.0 | 0.0 | 612.32 | 0.0 | 0.0 | 0.0 | 612.32 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 01 January 2025 | Disbursement | 600.0 | 0.0 | 0.0 | 0.0 | 0.0 | 600.0 | false | false |
| 07 January 2025 | Accrual | 0.68 | 0.0 | 0.68 | 0.0 | 0.0 | 0.0 | false | false |
# --- 2nd disbursement partial - 8 January, 2025 --- #
When Admin successfully disburse the loan on "08 January 2025" with "300" 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 2025 | | 600.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| | | 08 January 2025 | | 300.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2025 | | 751.84 | 148.16 | 4.85 | 0.0 | 0.0 | 153.01 | 0.0 | 0.0 | 0.0 | 153.01 |
| 2 | 28 | 01 March 2025 | | 603.22 | 148.62 | 4.39 | 0.0 | 0.0 | 153.01 | 0.0 | 0.0 | 0.0 | 153.01 |
| 3 | 31 | 01 April 2025 | | 453.73 | 149.49 | 3.52 | 0.0 | 0.0 | 153.01 | 0.0 | 0.0 | 0.0 | 153.01 |
| 4 | 30 | 01 May 2025 | | 303.37 | 150.36 | 2.65 | 0.0 | 0.0 | 153.01 | 0.0 | 0.0 | 0.0 | 153.01 |
| 5 | 31 | 01 June 2025 | | 152.13 | 151.24 | 1.77 | 0.0 | 0.0 | 153.01 | 0.0 | 0.0 | 0.0 | 153.01 |
| 6 | 30 | 01 July 2025 | | 0.0 | 152.13 | 0.89 | 0.0 | 0.0 | 153.02 | 0.0 | 0.0 | 0.0 | 153.02 |
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 900.0 | 18.07 | 0.0 | 0.0 | 918.07 | 0.0 | 0.0 | 0.0 | 918.07 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 01 January 2025 | Disbursement | 600.0 | 0.0 | 0.0 | 0.0 | 0.0 | 600.0 | false | false |
| 07 January 2025 | Accrual | 0.68 | 0.0 | 0.68 | 0.0 | 0.0 | 0.0 | false | false |
| 08 January 2025 | Disbursement | 300.0 | 0.0 | 0.0 | 0.0 | 0.0 | 900.0 | false | false |
Then Admin fails to disburse the loan on "08 January 2025" with "100" amount
# --- add 3rd expected disbursement details with expected disbursement date - 15 Jan, 2025 --- #
And Admin successfully add disbursement detail to the loan on "15 January 2025" with 100 EUR transaction amount
Then Loan Tranche Details tab has the following data:
| Expected Disbursement On | Disbursed On | Principal | Net Disbursal Amount |
| 01 January 2025 | 01 January 2025 | 600.0 | |
| 08 January 2025 | 08 January 2025 | 300.0 | 600.0 |
| 15 January 2025 | | 100.0 | 300.0 |
When Admin sets the business date to "15 January 2025"
When Admin runs inline COB job for Loan
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 2025 | | 600.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| | | 08 January 2025 | | 300.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| | | 15 January 2025 | | 100.0 | | | 0.0 | | 0.0 | | | | 0.0 |
| 1 | 31 | 01 February 2025 | | 851.84 | 148.16 | 4.85 | 0.0 | 0.0 | 153.01 | 0.0 | 0.0 | 0.0 | 153.01 |
| 2 | 28 | 01 March 2025 | | 703.22 | 148.62 | 4.39 | 0.0 | 0.0 | 153.01 | 0.0 | 0.0 | 0.0 | 153.01 |
| 3 | 31 | 01 April 2025 | | 553.73 | 149.49 | 3.52 | 0.0 | 0.0 | 153.01 | 0.0 | 0.0 | 0.0 | 153.01 |
| 4 | 30 | 01 May 2025 | | 403.37 | 150.36 | 2.65 | 0.0 | 0.0 | 153.01 | 0.0 | 0.0 | 0.0 | 153.01 |
| 5 | 31 | 01 June 2025 | | 252.13 | 151.24 | 1.77 | 0.0 | 0.0 | 153.01 | 0.0 | 0.0 | 0.0 | 153.01 |
| 6 | 30 | 01 July 2025 | | 100.0 | 152.13 | 0.89 | 0.0 | 0.0 | 153.02 | 0.0 | 0.0 | 0.0 | 153.02 |
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 900.0 | 18.07 | 0.0 | 0.0 | 918.07 | 0.0 | 0.0 | 0.0 | 918.07 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 01 January 2025 | Disbursement | 600.0 | 0.0 | 0.0 | 0.0 | 0.0 | 600.0 | false | false |
| 07 January 2025 | Accrual | 0.68 | 0.0 | 0.68 | 0.0 | 0.0 | 0.0 | false | false |
| 08 January 2025 | Disbursement | 300.0 | 0.0 | 0.0 | 0.0 | 0.0 | 900.0 | false | false |
| 08 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 09 January 2025 | Accrual | 0.17 | 0.0 | 0.17 | 0.0 | 0.0 | 0.0 | false | false |
| 10 January 2025 | Accrual | 0.17 | 0.0 | 0.17 | 0.0 | 0.0 | 0.0 | false | false |
| 11 January 2025 | Accrual | 0.17 | 0.0 | 0.17 | 0.0 | 0.0 | 0.0 | false | false |
| 12 January 2025 | Accrual | 0.17 | 0.0 | 0.17 | 0.0 | 0.0 | 0.0 | false | false |
| 13 January 2025 | Accrual | 0.17 | 0.0 | 0.17 | 0.0 | 0.0 | 0.0 | false | false |
| 14 January 2025 | Accrual | 0.17 | 0.0 | 0.17 | 0.0 | 0.0 | 0.0 | false | false |
# --- 3rd disbursement partial - 15 Jan, 2025 --- #
When Admin successfully disburse the loan on "15 January 2025" with "50" 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 2025 | | 600.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| | | 08 January 2025 | | 300.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| | | 15 January 2025 | | 50.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2025 | | 793.52 | 156.48 | 5.01 | 0.0 | 0.0 | 161.49 | 0.0 | 0.0 | 0.0 | 161.49 |
| 2 | 28 | 01 March 2025 | | 636.66 | 156.86 | 4.63 | 0.0 | 0.0 | 161.49 | 0.0 | 0.0 | 0.0 | 161.49 |
| 3 | 31 | 01 April 2025 | | 478.88 | 157.78 | 3.71 | 0.0 | 0.0 | 161.49 | 0.0 | 0.0 | 0.0 | 161.49 |
| 4 | 30 | 01 May 2025 | | 320.18 | 158.7 | 2.79 | 0.0 | 0.0 | 161.49 | 0.0 | 0.0 | 0.0 | 161.49 |
| 5 | 31 | 01 June 2025 | | 160.56 | 159.62 | 1.87 | 0.0 | 0.0 | 161.49 | 0.0 | 0.0 | 0.0 | 161.49 |
| 6 | 30 | 01 July 2025 | | 0.0 | 160.56 | 0.94 | 0.0 | 0.0 | 161.5 | 0.0 | 0.0 | 0.0 | 161.5 |
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 950.0 | 18.95 | 0.0 | 0.0 | 968.95 | 0.0 | 0.0 | 0.0 | 968.95 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 01 January 2025 | Disbursement | 600.0 | 0.0 | 0.0 | 0.0 | 0.0 | 600.0 | false | false |
| 07 January 2025 | Accrual | 0.68 | 0.0 | 0.68 | 0.0 | 0.0 | 0.0 | false | false |
| 08 January 2025 | Disbursement | 300.0 | 0.0 | 0.0 | 0.0 | 0.0 | 900.0 | false | false |
| 08 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 09 January 2025 | Accrual | 0.17 | 0.0 | 0.17 | 0.0 | 0.0 | 0.0 | false | false |
| 10 January 2025 | Accrual | 0.17 | 0.0 | 0.17 | 0.0 | 0.0 | 0.0 | false | false |
| 11 January 2025 | Accrual | 0.17 | 0.0 | 0.17 | 0.0 | 0.0 | 0.0 | false | false |
| 12 January 2025 | Accrual | 0.17 | 0.0 | 0.17 | 0.0 | 0.0 | 0.0 | false | false |
| 13 January 2025 | Accrual | 0.17 | 0.0 | 0.17 | 0.0 | 0.0 | 0.0 | false | false |
| 14 January 2025 | Accrual | 0.17 | 0.0 | 0.17 | 0.0 | 0.0 | 0.0 | false | false |
| 15 January 2025 | Disbursement | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 950.0 | false | false |
# --- undo last disbursement --- #
When Admin sets the business date to "16 January 2025"
When Admin runs inline COB job for Loan
When Admin successfully undo last disbursal
Then Loan Tranche Details tab has the following data:
| Expected Disbursement On | Disbursed On | Principal | Net Disbursal Amount |
| 01 January 2025 | 01 January 2025 | 600.0 | |
| 08 January 2025 | 08 January 2025 | 300.0 | 600.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 January 2025 | | 600.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| | | 08 January 2025 | | 300.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2025 | | 751.84 | 148.16 | 4.85 | 0.0 | 0.0 | 153.01 | 0.0 | 0.0 | 0.0 | 153.01 |
| 2 | 28 | 01 March 2025 | | 603.22 | 148.62 | 4.39 | 0.0 | 0.0 | 153.01 | 0.0 | 0.0 | 0.0 | 153.01 |
| 3 | 31 | 01 April 2025 | | 453.73 | 149.49 | 3.52 | 0.0 | 0.0 | 153.01 | 0.0 | 0.0 | 0.0 | 153.01 |
| 4 | 30 | 01 May 2025 | | 303.37 | 150.36 | 2.65 | 0.0 | 0.0 | 153.01 | 0.0 | 0.0 | 0.0 | 153.01 |
| 5 | 31 | 01 June 2025 | | 152.13 | 151.24 | 1.77 | 0.0 | 0.0 | 153.01 | 0.0 | 0.0 | 0.0 | 153.01 |
| 6 | 30 | 01 July 2025 | | 0.0 | 152.13 | 0.89 | 0.0 | 0.0 | 153.02 | 0.0 | 0.0 | 0.0 | 153.02 |
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 900.0 | 18.07 | 0.0 | 0.0 | 918.07 | 0.0 | 0.0 | 0.0 | 918.07 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 01 January 2025 | Disbursement | 600.0 | 0.0 | 0.0 | 0.0 | 0.0 | 600.0 | false | false |
| 07 January 2025 | Accrual | 0.68 | 0.0 | 0.68 | 0.0 | 0.0 | 0.0 | false | false |
| 08 January 2025 | Disbursement | 300.0 | 0.0 | 0.0 | 0.0 | 0.0 | 900.0 | false | false |
| 08 January 2025 | Accrual | 0.11 | 0.0 | 0.11 | 0.0 | 0.0 | 0.0 | false | false |
| 09 January 2025 | Accrual | 0.17 | 0.0 | 0.17 | 0.0 | 0.0 | 0.0 | false | false |
| 10 January 2025 | Accrual | 0.17 | 0.0 | 0.17 | 0.0 | 0.0 | 0.0 | false | false |
| 11 January 2025 | Accrual | 0.17 | 0.0 | 0.17 | 0.0 | 0.0 | 0.0 | false | false |
| 12 January 2025 | Accrual | 0.17 | 0.0 | 0.17 | 0.0 | 0.0 | 0.0 | false | false |
| 13 January 2025 | Accrual | 0.17 | 0.0 | 0.17 | 0.0 | 0.0 | 0.0 | false | false |
| 14 January 2025 | Accrual | 0.17 | 0.0 | 0.17 | 0.0 | 0.0 | 0.0 | false | false |
| 15 January 2025 | Accrual | 0.17 | 0.0 | 0.17 | 0.0 | 0.0 | 0.0 | false | false |
Then Admin fails to disburse the loan on "16 January 2025" with "100" amount
@TestRailId:C3660
Scenario: Verify tranche interest bearing progressive loan that expects tranche with repayment and undo disbursement - UC4
When Admin sets the business date to "01 January 2025"
When Admin creates a client with random data
When Admin creates a fully customized loan with disbursement details and following data:
| LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy | 1st_tranche_disb_expected_date |1st_tranche_disb_principal |
| LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_MULTIDISBURSE_EXPECT_TRANCHE | 01 January 2025 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | 01 January 2025 | 700.0 |
And Admin successfully approves the loan on "01 January 2025" with "1000" amount and expected disbursement date on "01 January 2025"
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 2025 | | 700.0 | | | 0.0 | | 0.0 | | | | 0.0 |
| 1 | 31 | 01 February 2025 | | 585.02 | 114.98 | 4.08 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 2 | 28 | 01 March 2025 | | 469.37 | 115.65 | 3.41 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 3 | 31 | 01 April 2025 | | 353.05 | 116.32 | 2.74 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 4 | 30 | 01 May 2025 | | 236.05 | 117.0 | 2.06 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 5 | 31 | 01 June 2025 | | 118.37 | 117.68 | 1.38 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 6 | 30 | 01 July 2025 | | 0.0 | 118.37 | 0.69 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 700.0 | 14.36 | 0.0 | 0.0 | 714.36 | 0.0 | 0.0 | 0.0 | 714.36 |
When Admin successfully disburse the loan on "01 January 2025" with "700" EUR transaction amount
Then Loan Tranche Details tab has the following data:
| Expected Disbursement On | Disbursed On | Principal | Net Disbursal Amount |
| 01 January 2025 | 01 January 2025 | 700.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 January 2025 | | 700.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2025 | | 585.02 | 114.98 | 4.08 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 2 | 28 | 01 March 2025 | | 469.37 | 115.65 | 3.41 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 3 | 31 | 01 April 2025 | | 353.05 | 116.32 | 2.74 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 4 | 30 | 01 May 2025 | | 236.05 | 117.0 | 2.06 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 5 | 31 | 01 June 2025 | | 118.37 | 117.68 | 1.38 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 6 | 30 | 01 July 2025 | | 0.0 | 118.37 | 0.69 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 700.0 | 14.36 | 0.0 | 0.0 | 714.36 | 0.0 | 0.0 | 0.0 | 714.36 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 01 January 2025 | Disbursement | 700.0 | 0.0 | 0.0 | 0.0 | 0.0 | 700.0 | false | false |
# --- 1st repayment - 1 Feb, 2025 --- #
When Admin sets the business date to "01 February 2025"
When Admin runs inline COB job for Loan
And Customer makes "AUTOPAY" repayment on "01 February 2025" with 119.06 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 2025 | | 700.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2025 | 01 February 2025 | 585.02 | 114.98 | 4.08 | 0.0 | 0.0 | 119.06 | 119.06 | 0.0 | 0.0 | 0.0 |
| 2 | 28 | 01 March 2025 | | 469.37 | 115.65 | 3.41 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 3 | 31 | 01 April 2025 | | 353.05 | 116.32 | 2.74 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 4 | 30 | 01 May 2025 | | 236.05 | 117.0 | 2.06 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 5 | 31 | 01 June 2025 | | 118.37 | 117.68 | 1.38 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 6 | 30 | 01 July 2025 | | 0.0 | 118.37 | 0.69 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 700.0 | 14.36 | 0.0 | 0.0 | 714.36 | 119.06 | 0.0 | 0.0 | 595.3 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 01 January 2025 | Disbursement | 700.0 | 0.0 | 0.0 | 0.0 | 0.0 | 700.0 | false | false |
| 31 January 2025 | Accrual | 3.95 | 0.0 | 3.95 | 0.0 | 0.0 | 0.0 | false | false |
| 01 February 2025 | Repayment | 119.06 | 114.98 | 4.08 | 0.0 | 0.0 | 585.02 | false | false |
# --- add 2nd expected disbursement details with expected disbursement date - 5 Feb, 2025 --- #
And Admin successfully add disbursement detail to the loan on "05 February 2025" with 300 EUR transaction amount
Then Loan Tranche Details tab has the following data:
| Expected Disbursement On | Disbursed On | Principal | Net Disbursal Amount |
| 01 January 2025 | 01 January 2025 | 700.0 | |
| 05 February 2025 | | 300.0 | 700.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 January 2025 | | 700.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2025 | 01 February 2025 | 585.02 | 114.98 | 4.08 | 0.0 | 0.0 | 119.06 | 119.06 | 0.0 | 0.0 | 0.0 |
| | | 05 February 2025 | | 300.0 | | | 0.0 | | 0.0 | | | | 0.0 |
| 2 | 28 | 01 March 2025 | | 769.37 | 115.65 | 3.41 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 3 | 31 | 01 April 2025 | | 653.05 | 116.32 | 2.74 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 4 | 30 | 01 May 2025 | | 536.05 | 117.0 | 2.06 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 5 | 31 | 01 June 2025 | | 418.37 | 117.68 | 1.38 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| 6 | 30 | 01 July 2025 | | 300.0 | 118.37 | 0.69 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 700.0 | 14.36 | 0.0 | 0.0 | 714.36 | 119.06 | 0.0 | 0.0 | 595.3 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 01 January 2025 | Disbursement | 700.0 | 0.0 | 0.0 | 0.0 | 0.0 | 700.0 | false | false |
| 31 January 2025 | Accrual | 3.95 | 0.0 | 3.95 | 0.0 | 0.0 | 0.0 | false | false |
| 01 February 2025 | Repayment | 119.06 | 114.98 | 4.08 | 0.0 | 0.0 | 585.02 | false | false |
# --- 2nd disbursement - 5 February, 2025 ---
When Admin sets the business date to "05 February 2025"
When Admin runs inline COB job for Loan
When Admin successfully disburse the loan on "05 February 2025" with "200" EUR transaction amount
Then Loan Tranche Details tab has the following data:
| Expected Disbursement On | Disbursed On | Principal | Net Disbursal Amount |
| 01 January 2025 | 01 January 2025 | 700.0 | |
| 05 February 2025 | 05 February 2025 | 200.0 | 700.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 January 2025 | | 700.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2025 | 01 February 2025 | 585.02 | 114.98 | 4.08 | 0.0 | 0.0 | 119.06 | 119.06 | 0.0 | 0.0 | 0.0 |
| | | 05 February 2025 | | 200.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 2 | 28 | 01 March 2025 | | 629.7 | 155.32 | 4.41 | 0.0 | 0.0 | 159.73 | 0.0 | 0.0 | 0.0 | 159.73 |
| 3 | 31 | 01 April 2025 | | 473.64 | 156.06 | 3.67 | 0.0 | 0.0 | 159.73 | 0.0 | 0.0 | 0.0 | 159.73 |
| 4 | 30 | 01 May 2025 | | 316.67 | 156.97 | 2.76 | 0.0 | 0.0 | 159.73 | 0.0 | 0.0 | 0.0 | 159.73 |
| 5 | 31 | 01 June 2025 | | 158.79 | 157.88 | 1.85 | 0.0 | 0.0 | 159.73 | 0.0 | 0.0 | 0.0 | 159.73 |
| 6 | 30 | 01 July 2025 | | 0.0 | 158.79 | 0.93 | 0.0 | 0.0 | 159.72 | 0.0 | 0.0 | 0.0 | 159.72 |
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 900.0 | 17.7 | 0.0 | 0.0 | 917.7 | 119.06 | 0.0 | 0.0 | 798.64 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 01 January 2025 | Disbursement | 700.0 | 0.0 | 0.0 | 0.0 | 0.0 | 700.0 | false | false |
| 31 January 2025 | Accrual | 3.95 | 0.0 | 3.95 | 0.0 | 0.0 | 0.0 | false | false |
| 01 February 2025 | Repayment | 119.06 | 114.98 | 4.08 | 0.0 | 0.0 | 585.02 | false | false |
| 01 February 2025 | Accrual | 0.13 | 0.0 | 0.13 | 0.0 | 0.0 | 0.0 | false | false |
| 02 February 2025 | Accrual | 0.12 | 0.0 | 0.12 | 0.0 | 0.0 | 0.0 | false | false |
| 03 February 2025 | Accrual | 0.12 | 0.0 | 0.12 | 0.0 | 0.0 | 0.0 | false | false |
| 04 February 2025 | Accrual | 0.13 | 0.0 | 0.13 | 0.0 | 0.0 | 0.0 | false | false |
| 05 February 2025 | Disbursement | 200.0 | 0.0 | 0.0 | 0.0 | 0.0 | 785.02 | false | false |
Then Admin fails to disburse the loan on "05 February 2025" with "100" amount
# -- undo disbursement ----
When Admin sets the business date to "06 February 2025"
When Admin runs inline COB job for Loan
When Admin successfully undo disbursal
Then Loan status has changed to "Approved"
Then Loan Tranche Details tab has the following data:
| Expected Disbursement On | Disbursed On | Principal | Net Disbursal Amount |
| 01 January 2025 | | 700.0 | |
| 05 February 2025 | | 200.0 | 700.0 |
When Admin sets the business date to "02 February 2025"
When Admin runs inline COB job for Loan
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 2025 | | 700.0 | | | 0.0 | | 0.0 | | | | 0.0 |
| 1 | 31 | 01 February 2025 | | 585.02 | 114.98 | 4.08 | 0.0 | 0.0 | 119.06 | 0.0 | 0.0 | 0.0 | 119.06 |
| | | 05 February 2025 | | 200.0 | | | 0.0 | | 0.0 | | | | 0.0 |
| 2 | 28 | 01 March 2025 | | 629.7 | 155.32 | 4.41 | 0.0 | 0.0 | 159.73 | 0.0 | 0.0 | 0.0 | 159.73 |
| 3 | 31 | 01 April 2025 | | 473.64 | 156.06 | 3.67 | 0.0 | 0.0 | 159.73 | 0.0 | 0.0 | 0.0 | 159.73 |
| 4 | 30 | 01 May 2025 | | 316.67 | 156.97 | 2.76 | 0.0 | 0.0 | 159.73 | 0.0 | 0.0 | 0.0 | 159.73 |
| 5 | 31 | 01 June 2025 | | 158.79 | 157.88 | 1.85 | 0.0 | 0.0 | 159.73 | 0.0 | 0.0 | 0.0 | 159.73 |
| 6 | 30 | 01 July 2025 | | 0.0 | 158.79 | 0.93 | 0.0 | 0.0 | 159.72 | 0.0 | 0.0 | 0.0 | 159.72 |
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 900.0 | 17.7 | 0.0 | 0.0 | 917.7 | 0.0 | 0.0 | 0.0 | 917.7 |
Then Loan Transactions tab has none transaction
When Admin sets the business date to "02 March 2025"
When Admin runs inline COB job for Loan
When Admin successfully disburse the loan on "01 February 2025" with "750" EUR transaction amount
When Admin successfully disburse the loan on "01 March 2025" with "200" EUR transaction amount
Then Loan Tranche Details tab has the following data:
| Expected Disbursement On | Disbursed On | Principal | Net Disbursal Amount |
| 01 January 2025 | 01 February 2025 | 750.0 | |
| 05 February 2025 | 01 March 2025 | 200.0 | 700.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 February 2025 | | 750.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 28 | 01 March 2025 | | 626.81 | 123.19 | 4.37 | 0.0 | 0.0 | 127.56 | 0.0 | 0.0 | 0.0 | 127.56 |
| | | 01 March 2025 | | 200.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 2 | 31 | 01 April 2025 | | 663.39 | 163.42 | 4.85 | 0.0 | 0.0 | 168.27 | 0.0 | 0.0 | 0.0 | 168.27 |
| 3 | 30 | 01 May 2025 | | 498.99 | 164.4 | 3.87 | 0.0 | 0.0 | 168.27 | 0.0 | 0.0 | 0.0 | 168.27 |
| 4 | 31 | 01 June 2025 | | 333.63 | 165.36 | 2.91 | 0.0 | 0.0 | 168.27 | 0.0 | 0.0 | 0.0 | 168.27 |
| 5 | 30 | 01 July 2025 | | 167.31 | 166.32 | 1.95 | 0.0 | 0.0 | 168.27 | 0.0 | 0.0 | 0.0 | 168.27 |
| 6 | 31 | 01 August 2025 | | 0.0 | 167.31 | 0.98 | 0.0 | 0.0 | 168.29 | 0.0 | 0.0 | 0.0 | 168.29 |
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 950.0 | 18.93 | 0.0 | 0.0 | 968.93 | 0.0 | 0.0 | 0.0 | 968.93 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 01 February 2025 | Disbursement | 750.0 | 0.0 | 0.0 | 0.0 | 0.0 | 750.0 | false | false |
| 01 March 2025 | Disbursement | 200.0 | 0.0 | 0.0 | 0.0 | 0.0 | 950.0 | false | false |
Then Admin fails to disburse the loan on "01 March 2025" with "50" amount
@TestRailId:C3636
Scenario: Verify that no negative amount interest refund created after multiple Merchant Issued Refund
When Admin sets the business date to "05 April 2025"
@@ -4265,7 +4265,7 @@ Feature: LoanCharge
@Skip
@TestRailId:C3561
Scenario: Verify amount+interest disbursement charge for tranche interest bearing progressive loan that doesn't expects tranches with undo disbursement - UC8.2.7
Scenario: Verify amount+interest disbursement charge for tranche interest bearing progressive loan that doesn't expect tranches with undo disbursement - UC8.2.7
When Admin sets the business date to "01 January 2024"
When Admin creates a client with random data
When Admin updates charge "LOAN_DISBURSEMENT_CHARGE" with "PERCENTAGE_LOAN_AMOUNT_PLUS_INTEREST" calculation type and 2.0 % of transaction amount
@@ -4343,7 +4343,7 @@ Feature: LoanCharge
@Skip
@TestRailId:C3562
Scenario: Verify interest disbursement charge for tranche interest bearing progressive loan that doesn't expects tranches with undo last disbursement - UC8.2.8
Scenario: Verify interest disbursement charge for tranche interest bearing progressive loan that doesn't expect tranches with undo last disbursement - UC8.2.8
When Admin sets the business date to "01 January 2024"
When Admin creates a client with random data
When Admin updates charge "LOAN_DISBURSEMENT_CHARGE" with "PERCENTAGE_INTEREST" calculation type and 2.0 % of transaction amount