FINERACT-1971: N plus one installment loan reschedule
This commit is contained in:
committed by
Adam Saghy
parent
7d7669f570
commit
89c3dc34f1
+42
@@ -49,6 +49,7 @@ import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionType;
|
|||||||
import org.apache.fineract.portfolio.loanaccount.domain.transactionprocessor.impl.CreocoreLoanRepaymentScheduleTransactionProcessor;
|
import org.apache.fineract.portfolio.loanaccount.domain.transactionprocessor.impl.CreocoreLoanRepaymentScheduleTransactionProcessor;
|
||||||
import org.apache.fineract.portfolio.loanaccount.domain.transactionprocessor.impl.HeavensFamilyLoanRepaymentScheduleTransactionProcessor;
|
import org.apache.fineract.portfolio.loanaccount.domain.transactionprocessor.impl.HeavensFamilyLoanRepaymentScheduleTransactionProcessor;
|
||||||
import org.apache.fineract.portfolio.loanaccount.domain.transactionprocessor.impl.InterestPrincipalPenaltyFeesOrderLoanRepaymentScheduleTransactionProcessor;
|
import org.apache.fineract.portfolio.loanaccount.domain.transactionprocessor.impl.InterestPrincipalPenaltyFeesOrderLoanRepaymentScheduleTransactionProcessor;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract implementation of {@link LoanRepaymentScheduleTransactionProcessor} which is more convenient for concrete
|
* Abstract implementation of {@link LoanRepaymentScheduleTransactionProcessor} which is more convenient for concrete
|
||||||
@@ -78,6 +79,7 @@ public abstract class AbstractLoanRepaymentScheduleTransactionProcessor implemen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
addChargeOnlyRepaymentInstallmentIfRequired(charges, installments);
|
||||||
|
|
||||||
for (final LoanRepaymentScheduleInstallment currentInstallment : installments) {
|
for (final LoanRepaymentScheduleInstallment currentInstallment : installments) {
|
||||||
currentInstallment.resetDerivedComponents();
|
currentInstallment.resetDerivedComponents();
|
||||||
@@ -871,4 +873,44 @@ public abstract class AbstractLoanRepaymentScheduleTransactionProcessor implemen
|
|||||||
|
|
||||||
return latestPaidCharge;
|
return latestPaidCharge;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void addChargeOnlyRepaymentInstallmentIfRequired(Set<LoanCharge> charges,
|
||||||
|
List<LoanRepaymentScheduleInstallment> installments) {
|
||||||
|
if (!CollectionUtils.isEmpty(charges) && !CollectionUtils.isEmpty(installments)) {
|
||||||
|
LoanRepaymentScheduleInstallment latestRepaymentScheduleInstalment = installments.get(installments.size() - 1);
|
||||||
|
LocalDate installmentDueDate = null;
|
||||||
|
|
||||||
|
LoanCharge latestCharge = getLatestLoanChargeWithSpecificDueDate(charges);
|
||||||
|
if (latestCharge != null
|
||||||
|
&& DateUtils.isAfter(latestCharge.getEffectiveDueDate(), latestRepaymentScheduleInstalment.getDueDate())) {
|
||||||
|
installmentDueDate = latestCharge.getEffectiveDueDate();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (installmentDueDate != null) {
|
||||||
|
if (latestRepaymentScheduleInstalment.isAdditional()) {
|
||||||
|
latestRepaymentScheduleInstalment.updateDueDate(installmentDueDate);
|
||||||
|
} else {
|
||||||
|
Loan loan = latestCharge.getLoan();
|
||||||
|
final LoanRepaymentScheduleInstallment installment = new LoanRepaymentScheduleInstallment(loan,
|
||||||
|
(installments.size() + 1), latestRepaymentScheduleInstalment.getDueDate(), installmentDueDate, BigDecimal.ZERO,
|
||||||
|
BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, false, null);
|
||||||
|
installment.markAsAdditional();
|
||||||
|
loan.addLoanRepaymentScheduleInstallment(installment);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private LoanCharge getLatestLoanChargeWithSpecificDueDate(Set<LoanCharge> charges) {
|
||||||
|
LoanCharge latestCharge = null;
|
||||||
|
List<LoanCharge> chargesWithSpecificDueDate = new ArrayList<>();
|
||||||
|
chargesWithSpecificDueDate.addAll(charges.stream().filter(charge -> charge.isSpecifiedDueDate()).toList());
|
||||||
|
if (!CollectionUtils.isEmpty(chargesWithSpecificDueDate)) {
|
||||||
|
Collections.sort(chargesWithSpecificDueDate,
|
||||||
|
(charge1, charge2) -> DateUtils.compare(charge1.getEffectiveDueDate(), charge2.getEffectiveDueDate()));
|
||||||
|
latestCharge = chargesWithSpecificDueDate.get(chargesWithSpecificDueDate.size() - 1);
|
||||||
|
}
|
||||||
|
return latestCharge;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -126,6 +126,8 @@ public class AdvancedPaymentScheduleTransactionProcessor extends AbstractLoanRep
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addChargeOnlyRepaymentInstallmentIfRequired(charges, installments);
|
||||||
|
|
||||||
for (final LoanRepaymentScheduleInstallment currentInstallment : installments) {
|
for (final LoanRepaymentScheduleInstallment currentInstallment : installments) {
|
||||||
currentInstallment.resetBalances();
|
currentInstallment.resetBalances();
|
||||||
currentInstallment.updateDerivedFields(currency, disbursementDate);
|
currentInstallment.updateDerivedFields(currency, disbursementDate);
|
||||||
|
|||||||
+341
@@ -0,0 +1,341 @@
|
|||||||
|
/**
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.apache.fineract.integrationtests;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import org.apache.fineract.client.models.GetLoanProductsProductIdResponse;
|
||||||
|
import org.apache.fineract.client.models.PostLoanProductsRequest;
|
||||||
|
import org.apache.fineract.client.models.PostLoanProductsResponse;
|
||||||
|
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||||
|
import org.apache.fineract.integrationtests.common.LoanRescheduleRequestHelper;
|
||||||
|
import org.apache.fineract.integrationtests.common.loans.LoanRescheduleRequestTestBuilder;
|
||||||
|
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleProcessingType;
|
||||||
|
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleType;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
public class LoanRepaymentScheduleForChargesAfterMaturityTest extends BaseLoanIntegrationTest {
|
||||||
|
|
||||||
|
private final LoanRescheduleRequestHelper loanRescheduleRequestHelper = new LoanRescheduleRequestHelper(this.requestSpec,
|
||||||
|
this.responseSpec);
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void loanNPlusOneInstallmentIsRetainedAfterLoanRescheduleTest() {
|
||||||
|
runAt("03 March 2023", () -> {
|
||||||
|
// Create Client
|
||||||
|
Long clientId = clientHelper.createClient(ClientHelper.defaultClientCreationRequest()).getClientId();
|
||||||
|
// Create Loan Product
|
||||||
|
Long loanProductId = createLoanProductWithMultiDisbursalAndRepayments();
|
||||||
|
|
||||||
|
// Apply and Approve Loan
|
||||||
|
Long loanId = applyAndApproveLoan(clientId, loanProductId, "01 March 2023", 1500.0, 4, req -> {
|
||||||
|
req.setRepaymentEvery(15);
|
||||||
|
req.setLoanTermFrequency(60);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Disburse Loan
|
||||||
|
disburseLoan(loanId, BigDecimal.valueOf(1000.00), "01 March 2023");
|
||||||
|
|
||||||
|
// verify repayment schedule
|
||||||
|
verifyRepaymentSchedule(loanId, //
|
||||||
|
installment(0, null, "01 March 2023"), //
|
||||||
|
installment(250.0, false, "16 March 2023"), //
|
||||||
|
installment(250.0, false, "31 March 2023"), //
|
||||||
|
installment(250.0, false, "15 April 2023"), //
|
||||||
|
installment(250.0, false, "30 April 2023")//
|
||||||
|
);
|
||||||
|
|
||||||
|
// add charge with due date after loan maturity date
|
||||||
|
Long loanChargeId = addCharge(loanId, false, 50, "23 May 2023");
|
||||||
|
|
||||||
|
// verify repayment schedule
|
||||||
|
verifyRepaymentSchedule(loanId, //
|
||||||
|
installment(0, null, "01 March 2023"), //
|
||||||
|
installment(250.0, false, "16 March 2023"), //
|
||||||
|
installment(250.0, false, "31 March 2023"), //
|
||||||
|
installment(250.0, false, "15 April 2023"), //
|
||||||
|
installment(250.0, false, "30 April 2023"), //
|
||||||
|
installment(0.0, 0.0, 50.0, 50.0, false, "23 May 2023")//
|
||||||
|
);
|
||||||
|
|
||||||
|
// reschedule installment date
|
||||||
|
String requestJSON = new LoanRescheduleRequestTestBuilder().updateGraceOnInterest(null).updateGraceOnPrincipal(null)
|
||||||
|
.updateExtraTerms(null).updateNewInterestRate(null).updateRescheduleFromDate("15 April 2023")
|
||||||
|
.updateAdjustedDueDate("30 April 2023").updateSubmittedOnDate("03 March 2023").updateRescheduleReasonId("1")
|
||||||
|
.build(loanId.toString());
|
||||||
|
|
||||||
|
Integer loanRescheduleRequest = loanRescheduleRequestHelper.createLoanRescheduleRequest(requestJSON);
|
||||||
|
requestJSON = new LoanRescheduleRequestTestBuilder().updateSubmittedOnDate("03 March 2023")
|
||||||
|
.getApproveLoanRescheduleRequestJSON();
|
||||||
|
Integer approveLoanRescheduleRequest = loanRescheduleRequestHelper.approveLoanRescheduleRequest(loanRescheduleRequest,
|
||||||
|
requestJSON);
|
||||||
|
|
||||||
|
// verify repayment schedule
|
||||||
|
verifyRepaymentSchedule(loanId, //
|
||||||
|
installment(0, null, "01 March 2023"), //
|
||||||
|
installment(250.0, false, "16 March 2023"), //
|
||||||
|
installment(250.0, false, "31 March 2023"), //
|
||||||
|
installment(250.0, false, "30 April 2023"), //
|
||||||
|
installment(250.0, false, "15 May 2023"), //
|
||||||
|
installment(0.0, 0.0, 50.0, 50.0, false, "23 May 2023")//
|
||||||
|
);
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void loanNPlusOneInstallmentIsAdjustedAfterRescheduleIfDateFallBeforeMaturityDateTest() {
|
||||||
|
runAt("03 March 2023", () -> {
|
||||||
|
// Create Client
|
||||||
|
Long clientId = clientHelper.createClient(ClientHelper.defaultClientCreationRequest()).getClientId();
|
||||||
|
// Create Loan Product
|
||||||
|
Long loanProductId = createLoanProductWithMultiDisbursalAndRepayments();
|
||||||
|
|
||||||
|
// Apply and Approve Loan
|
||||||
|
Long loanId = applyAndApproveLoan(clientId, loanProductId, "01 March 2023", 1500.0, 4, req -> {
|
||||||
|
req.setRepaymentEvery(15);
|
||||||
|
req.setLoanTermFrequency(60);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Disburse Loan
|
||||||
|
disburseLoan(loanId, BigDecimal.valueOf(1000.00), "01 March 2023");
|
||||||
|
|
||||||
|
// verify repayment schedule
|
||||||
|
verifyRepaymentSchedule(loanId, //
|
||||||
|
installment(0, null, "01 March 2023"), //
|
||||||
|
installment(250.0, false, "16 March 2023"), //
|
||||||
|
installment(250.0, false, "31 March 2023"), //
|
||||||
|
installment(250.0, false, "15 April 2023"), //
|
||||||
|
installment(250.0, false, "30 April 2023")//
|
||||||
|
);
|
||||||
|
|
||||||
|
// add charge with due date after loan maturity date but date which is with in installment date after
|
||||||
|
// reschedule
|
||||||
|
Long loanChargeId = addCharge(loanId, false, 50, "13 May 2023");
|
||||||
|
|
||||||
|
// verify repayment schedule
|
||||||
|
verifyRepaymentSchedule(loanId, //
|
||||||
|
installment(0, null, "01 March 2023"), //
|
||||||
|
installment(250.0, false, "16 March 2023"), //
|
||||||
|
installment(250.0, false, "31 March 2023"), //
|
||||||
|
installment(250.0, false, "15 April 2023"), //
|
||||||
|
installment(250.0, false, "30 April 2023"), //
|
||||||
|
installment(0.0, 0.0, 50.0, 50.0, false, "13 May 2023")//
|
||||||
|
);
|
||||||
|
|
||||||
|
// reschedule installment date
|
||||||
|
String requestJSON = new LoanRescheduleRequestTestBuilder().updateGraceOnInterest(null).updateGraceOnPrincipal(null)
|
||||||
|
.updateExtraTerms(null).updateNewInterestRate(null).updateRescheduleFromDate("15 April 2023")
|
||||||
|
.updateAdjustedDueDate("30 April 2023").updateSubmittedOnDate("03 March 2023").updateRescheduleReasonId("1")
|
||||||
|
.build(loanId.toString());
|
||||||
|
|
||||||
|
Integer loanRescheduleRequest = loanRescheduleRequestHelper.createLoanRescheduleRequest(requestJSON);
|
||||||
|
requestJSON = new LoanRescheduleRequestTestBuilder().updateSubmittedOnDate("03 March 2023")
|
||||||
|
.getApproveLoanRescheduleRequestJSON();
|
||||||
|
Integer approveLoanRescheduleRequest = loanRescheduleRequestHelper.approveLoanRescheduleRequest(loanRescheduleRequest,
|
||||||
|
requestJSON);
|
||||||
|
|
||||||
|
// verify repayment schedule
|
||||||
|
verifyRepaymentSchedule(loanId, //
|
||||||
|
installment(0, null, "01 March 2023"), //
|
||||||
|
installment(250.0, false, "16 March 2023"), //
|
||||||
|
installment(250.0, false, "31 March 2023"), //
|
||||||
|
installment(250.0, false, "30 April 2023"), //
|
||||||
|
installment(250.0, 0.0, 50.0, 300.0, false, "15 May 2023")//
|
||||||
|
);
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void loanNPlusOneInstallmentIsRetainedAfterLoanRescheduleForAdvancedPaymentAllocationTest() {
|
||||||
|
runAt("03 March 2023", () -> {
|
||||||
|
// Create Client
|
||||||
|
Long clientId = clientHelper.createClient(ClientHelper.defaultClientCreationRequest()).getClientId();
|
||||||
|
// Create Loan Product
|
||||||
|
Long loanProductId = createLoanProductWithMultiDisbursalAndRepaymentsWithAdvancedPaymentAllocationStrategy();
|
||||||
|
|
||||||
|
// Apply and Approve Loan
|
||||||
|
Long loanId = applyAndApproveLoan(clientId, loanProductId, "01 March 2023", 1500.0, 4, req -> {
|
||||||
|
req.setRepaymentEvery(15);
|
||||||
|
req.setLoanTermFrequency(60);
|
||||||
|
req.setTransactionProcessingStrategyCode("advanced-payment-allocation-strategy");
|
||||||
|
req.setLoanScheduleProcessingType(LoanScheduleType.PROGRESSIVE.toString());
|
||||||
|
req.setLoanScheduleProcessingType(LoanScheduleProcessingType.HORIZONTAL.toString());
|
||||||
|
});
|
||||||
|
|
||||||
|
// Disburse Loan
|
||||||
|
disburseLoan(loanId, BigDecimal.valueOf(1000.00), "01 March 2023");
|
||||||
|
|
||||||
|
// verify repayment schedule
|
||||||
|
verifyRepaymentSchedule(loanId, //
|
||||||
|
installment(0, null, "01 March 2023"), //
|
||||||
|
installment(250.0, false, "16 March 2023"), //
|
||||||
|
installment(250.0, false, "31 March 2023"), //
|
||||||
|
installment(250.0, false, "15 April 2023"), //
|
||||||
|
installment(250.0, false, "30 April 2023")//
|
||||||
|
);
|
||||||
|
|
||||||
|
// add charge with due date after loan maturity date
|
||||||
|
Long loanChargeId = addCharge(loanId, false, 50, "23 May 2023");
|
||||||
|
|
||||||
|
// verify repayment schedule
|
||||||
|
verifyRepaymentSchedule(loanId, //
|
||||||
|
installment(0, null, "01 March 2023"), //
|
||||||
|
installment(250.0, false, "16 March 2023"), //
|
||||||
|
installment(250.0, false, "31 March 2023"), //
|
||||||
|
installment(250.0, false, "15 April 2023"), //
|
||||||
|
installment(250.0, false, "30 April 2023"), //
|
||||||
|
installment(0.0, 0.0, 50.0, 50.0, false, "23 May 2023")//
|
||||||
|
);
|
||||||
|
|
||||||
|
// reschedule installment date
|
||||||
|
String requestJSON = new LoanRescheduleRequestTestBuilder().updateGraceOnInterest(null).updateGraceOnPrincipal(null)
|
||||||
|
.updateExtraTerms(null).updateNewInterestRate(null).updateRescheduleFromDate("15 April 2023")
|
||||||
|
.updateAdjustedDueDate("30 April 2023").updateSubmittedOnDate("03 March 2023").updateRescheduleReasonId("1")
|
||||||
|
.build(loanId.toString());
|
||||||
|
|
||||||
|
Integer loanRescheduleRequest = loanRescheduleRequestHelper.createLoanRescheduleRequest(requestJSON);
|
||||||
|
requestJSON = new LoanRescheduleRequestTestBuilder().updateSubmittedOnDate("03 March 2023")
|
||||||
|
.getApproveLoanRescheduleRequestJSON();
|
||||||
|
Integer approveLoanRescheduleRequest = loanRescheduleRequestHelper.approveLoanRescheduleRequest(loanRescheduleRequest,
|
||||||
|
requestJSON);
|
||||||
|
|
||||||
|
// verify repayment schedule
|
||||||
|
verifyRepaymentSchedule(loanId, //
|
||||||
|
installment(0, null, "01 March 2023"), //
|
||||||
|
installment(250.0, false, "16 March 2023"), //
|
||||||
|
installment(250.0, false, "31 March 2023"), //
|
||||||
|
installment(250.0, false, "30 April 2023"), //
|
||||||
|
installment(250.0, false, "15 May 2023"), //
|
||||||
|
installment(0.0, 0.0, 50.0, 50.0, false, "23 May 2023")//
|
||||||
|
);
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void loanNPlusOneInstallmentIsAdjustedAfterRescheduleIfDateFallBeforeMaturityDateForAdvancedPaymentAllocationTest() {
|
||||||
|
runAt("03 March 2023", () -> {
|
||||||
|
// Create Client
|
||||||
|
Long clientId = clientHelper.createClient(ClientHelper.defaultClientCreationRequest()).getClientId();
|
||||||
|
// Create Loan Product
|
||||||
|
Long loanProductId = createLoanProductWithMultiDisbursalAndRepaymentsWithAdvancedPaymentAllocationStrategy();
|
||||||
|
|
||||||
|
// Apply and Approve Loan
|
||||||
|
Long loanId = applyAndApproveLoan(clientId, loanProductId, "01 March 2023", 1500.0, 4, req -> {
|
||||||
|
req.setRepaymentEvery(15);
|
||||||
|
req.setLoanTermFrequency(60);
|
||||||
|
req.setTransactionProcessingStrategyCode("advanced-payment-allocation-strategy");
|
||||||
|
});
|
||||||
|
|
||||||
|
// Disburse Loan
|
||||||
|
disburseLoan(loanId, BigDecimal.valueOf(1000.00), "01 March 2023");
|
||||||
|
|
||||||
|
// verify repayment schedule
|
||||||
|
verifyRepaymentSchedule(loanId, //
|
||||||
|
installment(0, null, "01 March 2023"), //
|
||||||
|
installment(250.0, false, "16 March 2023"), //
|
||||||
|
installment(250.0, false, "31 March 2023"), //
|
||||||
|
installment(250.0, false, "15 April 2023"), //
|
||||||
|
installment(250.0, false, "30 April 2023")//
|
||||||
|
);
|
||||||
|
|
||||||
|
// add charge with due date after loan maturity date but date which is with in installment date after
|
||||||
|
// reschedule
|
||||||
|
Long loanChargeId = addCharge(loanId, false, 50, "13 May 2023");
|
||||||
|
|
||||||
|
// verify repayment schedule
|
||||||
|
verifyRepaymentSchedule(loanId, //
|
||||||
|
installment(0, null, "01 March 2023"), //
|
||||||
|
installment(250.0, false, "16 March 2023"), //
|
||||||
|
installment(250.0, false, "31 March 2023"), //
|
||||||
|
installment(250.0, false, "15 April 2023"), //
|
||||||
|
installment(250.0, false, "30 April 2023"), //
|
||||||
|
installment(0.0, 0.0, 50.0, 50.0, false, "13 May 2023")//
|
||||||
|
);
|
||||||
|
|
||||||
|
// reschedule installment date
|
||||||
|
String requestJSON = new LoanRescheduleRequestTestBuilder().updateGraceOnInterest(null).updateGraceOnPrincipal(null)
|
||||||
|
.updateExtraTerms(null).updateNewInterestRate(null).updateRescheduleFromDate("15 April 2023")
|
||||||
|
.updateAdjustedDueDate("30 April 2023").updateSubmittedOnDate("03 March 2023").updateRescheduleReasonId("1")
|
||||||
|
.build(loanId.toString());
|
||||||
|
|
||||||
|
Integer loanRescheduleRequest = loanRescheduleRequestHelper.createLoanRescheduleRequest(requestJSON);
|
||||||
|
requestJSON = new LoanRescheduleRequestTestBuilder().updateSubmittedOnDate("03 March 2023")
|
||||||
|
.getApproveLoanRescheduleRequestJSON();
|
||||||
|
Integer approveLoanRescheduleRequest = loanRescheduleRequestHelper.approveLoanRescheduleRequest(loanRescheduleRequest,
|
||||||
|
requestJSON);
|
||||||
|
|
||||||
|
// verify repayment schedule
|
||||||
|
verifyRepaymentSchedule(loanId, //
|
||||||
|
installment(0, null, "01 March 2023"), //
|
||||||
|
installment(250.0, false, "16 March 2023"), //
|
||||||
|
installment(250.0, false, "31 March 2023"), //
|
||||||
|
installment(250.0, false, "30 April 2023"), //
|
||||||
|
installment(250.0, 0.0, 50.0, 300.0, false, "15 May 2023")//
|
||||||
|
);
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private Long createLoanProductWithMultiDisbursalAndRepayments() {
|
||||||
|
boolean multiDisburseEnabled = true;
|
||||||
|
PostLoanProductsRequest product = createOnePeriod30DaysLongNoInterestPeriodicAccrualProduct();
|
||||||
|
product.setMultiDisburseLoan(multiDisburseEnabled);
|
||||||
|
product.setNumberOfRepayments(4);
|
||||||
|
product.setRepaymentEvery(15);
|
||||||
|
|
||||||
|
if (!multiDisburseEnabled) {
|
||||||
|
product.disallowExpectedDisbursements(null);
|
||||||
|
product.setAllowApprovedDisbursedAmountsOverApplied(null);
|
||||||
|
product.overAppliedCalculationType(null);
|
||||||
|
product.overAppliedNumber(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
PostLoanProductsResponse loanProductResponse = loanProductHelper.createLoanProduct(product);
|
||||||
|
GetLoanProductsProductIdResponse getLoanProductsProductIdResponse = loanProductHelper
|
||||||
|
.retrieveLoanProductById(loanProductResponse.getResourceId());
|
||||||
|
assertNotNull(getLoanProductsProductIdResponse);
|
||||||
|
return loanProductResponse.getResourceId();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private Long createLoanProductWithMultiDisbursalAndRepaymentsWithAdvancedPaymentAllocationStrategy() {
|
||||||
|
boolean multiDisburseEnabled = true;
|
||||||
|
PostLoanProductsRequest product = createOnePeriod30DaysLongNoInterestPeriodicAccrualProductWithAdvancedPaymentAllocation();
|
||||||
|
product.setMultiDisburseLoan(multiDisburseEnabled);
|
||||||
|
product.setNumberOfRepayments(4);
|
||||||
|
product.setRepaymentEvery(15);
|
||||||
|
|
||||||
|
if (!multiDisburseEnabled) {
|
||||||
|
product.disallowExpectedDisbursements(null);
|
||||||
|
product.setAllowApprovedDisbursedAmountsOverApplied(null);
|
||||||
|
product.overAppliedCalculationType(null);
|
||||||
|
product.overAppliedNumber(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
PostLoanProductsResponse loanProductResponse = loanProductHelper.createLoanProduct(product);
|
||||||
|
GetLoanProductsProductIdResponse getLoanProductsProductIdResponse = loanProductHelper
|
||||||
|
.retrieveLoanProductById(loanProductResponse.getResourceId());
|
||||||
|
assertNotNull(getLoanProductsProductIdResponse);
|
||||||
|
return loanProductResponse.getResourceId();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user