FINERTACT-1724: Advanced payment allocation fixes for Loan Schedule
This commit is contained in:
committed by
Adam Saghy
parent
834cfb6e27
commit
aff009c400
+15
@@ -352,6 +352,21 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
|
|||||||
this.currency = new MonetaryCurrency(currencyCode, digitsAfterDecimal, inMultiplesOf);
|
this.currency = new MonetaryCurrency(currencyCode, digitsAfterDecimal, inMultiplesOf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final String loanScheduleTypeParamName = LoanProductConstants.LOAN_SCHEDULE_TYPE;
|
||||||
|
if (command.isChangeInStringParameterNamed(loanScheduleTypeParamName, loanScheduleType.toString())) {
|
||||||
|
LoanScheduleType newLoanScheduleType = LoanScheduleType.valueOf(command.stringValueOfParameterNamed(loanScheduleTypeParamName));
|
||||||
|
actualChanges.put(loanScheduleTypeParamName, newLoanScheduleType);
|
||||||
|
loanScheduleType = newLoanScheduleType;
|
||||||
|
}
|
||||||
|
|
||||||
|
final String loanScheduleProcessingTypeParamName = LoanProductConstants.LOAN_SCHEDULE_PROCESSING_TYPE;
|
||||||
|
if (command.isChangeInStringParameterNamed(loanScheduleProcessingTypeParamName, loanScheduleProcessingType.toString())) {
|
||||||
|
LoanScheduleProcessingType newLoanScheduleProcessingType = LoanScheduleProcessingType
|
||||||
|
.valueOf(command.stringValueOfParameterNamed(loanScheduleProcessingTypeParamName));
|
||||||
|
actualChanges.put(loanScheduleProcessingTypeParamName, newLoanScheduleProcessingType);
|
||||||
|
loanScheduleProcessingType = newLoanScheduleProcessingType;
|
||||||
|
}
|
||||||
|
|
||||||
final Map<String, Object> loanApplicationAttributeChanges = updateLoanApplicationAttributes(command, aprCalculator);
|
final Map<String, Object> loanApplicationAttributeChanges = updateLoanApplicationAttributes(command, aprCalculator);
|
||||||
|
|
||||||
actualChanges.putAll(loanApplicationAttributeChanges);
|
actualChanges.putAll(loanApplicationAttributeChanges);
|
||||||
|
|||||||
+1
-5
@@ -41,7 +41,6 @@ import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
|||||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
|
||||||
import org.apache.fineract.organisation.holiday.domain.Holiday;
|
import org.apache.fineract.organisation.holiday.domain.Holiday;
|
||||||
import org.apache.fineract.organisation.holiday.domain.HolidayRepository;
|
import org.apache.fineract.organisation.holiday.domain.HolidayRepository;
|
||||||
import org.apache.fineract.organisation.holiday.domain.HolidayStatusType;
|
import org.apache.fineract.organisation.holiday.domain.HolidayStatusType;
|
||||||
@@ -137,7 +136,6 @@ public class LoanScheduleAssembler {
|
|||||||
private final FloatingRatesReadPlatformService floatingRatesReadPlatformService;
|
private final FloatingRatesReadPlatformService floatingRatesReadPlatformService;
|
||||||
private final VariableLoanScheduleFromApiJsonValidator variableLoanScheduleFromApiJsonValidator;
|
private final VariableLoanScheduleFromApiJsonValidator variableLoanScheduleFromApiJsonValidator;
|
||||||
private final CalendarInstanceRepository calendarInstanceRepository;
|
private final CalendarInstanceRepository calendarInstanceRepository;
|
||||||
private final PlatformSecurityContext context;
|
|
||||||
private final LoanUtilService loanUtilService;
|
private final LoanUtilService loanUtilService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -150,8 +148,7 @@ public class LoanScheduleAssembler {
|
|||||||
final WorkingDaysRepositoryWrapper workingDaysRepository,
|
final WorkingDaysRepositoryWrapper workingDaysRepository,
|
||||||
final FloatingRatesReadPlatformService floatingRatesReadPlatformService,
|
final FloatingRatesReadPlatformService floatingRatesReadPlatformService,
|
||||||
final VariableLoanScheduleFromApiJsonValidator variableLoanScheduleFromApiJsonValidator,
|
final VariableLoanScheduleFromApiJsonValidator variableLoanScheduleFromApiJsonValidator,
|
||||||
final CalendarInstanceRepository calendarInstanceRepository, final PlatformSecurityContext context,
|
final CalendarInstanceRepository calendarInstanceRepository, final LoanUtilService loanUtilService) {
|
||||||
final LoanUtilService loanUtilService) {
|
|
||||||
this.fromApiJsonHelper = fromApiJsonHelper;
|
this.fromApiJsonHelper = fromApiJsonHelper;
|
||||||
this.loanProductRepository = loanProductRepository;
|
this.loanProductRepository = loanProductRepository;
|
||||||
this.applicationCurrencyRepository = applicationCurrencyRepository;
|
this.applicationCurrencyRepository = applicationCurrencyRepository;
|
||||||
@@ -167,7 +164,6 @@ public class LoanScheduleAssembler {
|
|||||||
this.floatingRatesReadPlatformService = floatingRatesReadPlatformService;
|
this.floatingRatesReadPlatformService = floatingRatesReadPlatformService;
|
||||||
this.variableLoanScheduleFromApiJsonValidator = variableLoanScheduleFromApiJsonValidator;
|
this.variableLoanScheduleFromApiJsonValidator = variableLoanScheduleFromApiJsonValidator;
|
||||||
this.calendarInstanceRepository = calendarInstanceRepository;
|
this.calendarInstanceRepository = calendarInstanceRepository;
|
||||||
this.context = context;
|
|
||||||
this.loanUtilService = loanUtilService;
|
this.loanUtilService = loanUtilService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+27
-7
@@ -781,16 +781,27 @@ public final class LoanProductDataValidator {
|
|||||||
.value(enableInstallmentLevelDelinquency).ignoreIfNull().validateForBooleanValue();
|
.value(enableInstallmentLevelDelinquency).ignoreIfNull().validateForBooleanValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
final String loanScheduleType = this.fromApiJsonHelper.extractStringNamed(LoanProductConstants.LOAN_SCHEDULE_TYPE, element);
|
String loanScheduleType = LoanScheduleType.CUMULATIVE.name();
|
||||||
baseDataValidator.reset().parameter(LoanProductConstants.LOAN_SCHEDULE_TYPE).value(loanScheduleType).ignoreIfNull()
|
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.LOAN_SCHEDULE_TYPE, element)) {
|
||||||
.isOneOfEnumValues(LoanScheduleType.class);
|
loanScheduleType = this.fromApiJsonHelper.extractStringNamed(LoanProductConstants.LOAN_SCHEDULE_TYPE, element);
|
||||||
|
baseDataValidator.reset().parameter(LoanProductConstants.LOAN_SCHEDULE_TYPE).value(loanScheduleType)
|
||||||
|
.isOneOfEnumValues(LoanScheduleType.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!LoanScheduleType.PROGRESSIVE.equals(LoanScheduleType.valueOf(loanScheduleType))
|
||||||
|
&& AdvancedPaymentScheduleTransactionProcessor.ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||||
|
.equals(transactionProcessingStrategyCode)) {
|
||||||
|
baseDataValidator.reset().parameter(LoanProductConstants.LOAN_SCHEDULE_PROCESSING_TYPE).failWithCode(
|
||||||
|
"supported.only.for.progressive.loan.schedule.type",
|
||||||
|
"Progressive repayment schedule processing is only available with `Advanced payment allocation` strategy");
|
||||||
|
}
|
||||||
|
|
||||||
String loanScheduleProcessingType = LoanScheduleProcessingType.HORIZONTAL.name();
|
String loanScheduleProcessingType = LoanScheduleProcessingType.HORIZONTAL.name();
|
||||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.LOAN_SCHEDULE_PROCESSING_TYPE, element)) {
|
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.LOAN_SCHEDULE_PROCESSING_TYPE, element)) {
|
||||||
loanScheduleProcessingType = this.fromApiJsonHelper.extractStringNamed(LoanProductConstants.LOAN_SCHEDULE_PROCESSING_TYPE,
|
loanScheduleProcessingType = this.fromApiJsonHelper.extractStringNamed(LoanProductConstants.LOAN_SCHEDULE_PROCESSING_TYPE,
|
||||||
element);
|
element);
|
||||||
baseDataValidator.reset().parameter(LoanProductConstants.LOAN_SCHEDULE_PROCESSING_TYPE).value(loanScheduleProcessingType)
|
baseDataValidator.reset().parameter(LoanProductConstants.LOAN_SCHEDULE_PROCESSING_TYPE).value(loanScheduleProcessingType)
|
||||||
.ignoreIfNull().isOneOfEnumValues(LoanScheduleProcessingType.class);
|
.isOneOfEnumValues(LoanScheduleProcessingType.class);
|
||||||
|
|
||||||
if (LoanScheduleProcessingType.VERTICAL.equals(LoanScheduleProcessingType.valueOf(loanScheduleProcessingType))
|
if (LoanScheduleProcessingType.VERTICAL.equals(LoanScheduleProcessingType.valueOf(loanScheduleProcessingType))
|
||||||
&& !AdvancedPaymentScheduleTransactionProcessor.ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
&& !AdvancedPaymentScheduleTransactionProcessor.ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||||
@@ -1784,10 +1795,19 @@ public final class LoanProductDataValidator {
|
|||||||
.value(enableInstallmentLevelDelinquency).ignoreIfNull().validateForBooleanValue();
|
.value(enableInstallmentLevelDelinquency).ignoreIfNull().validateForBooleanValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String loanScheduleType = loanProduct.getLoanProductRelatedDetail().getLoanScheduleType().name();
|
||||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.LOAN_SCHEDULE_TYPE, element)) {
|
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.LOAN_SCHEDULE_TYPE, element)) {
|
||||||
final String loanScheduleType = this.fromApiJsonHelper.extractStringNamed(LoanProductConstants.LOAN_SCHEDULE_TYPE, element);
|
loanScheduleType = this.fromApiJsonHelper.extractStringNamed(LoanProductConstants.LOAN_SCHEDULE_TYPE, element);
|
||||||
baseDataValidator.reset().parameter(LoanProductConstants.LOAN_SCHEDULE_TYPE).value(loanScheduleType).ignoreIfNull()
|
baseDataValidator.reset().parameter(LoanProductConstants.LOAN_SCHEDULE_TYPE).value(loanScheduleType)
|
||||||
.isOneOfEnumValues(LoanScheduleType.class);
|
.isOneOfEnumValues(LoanScheduleType.class);
|
||||||
|
|
||||||
|
if (!LoanScheduleType.PROGRESSIVE.equals(LoanScheduleType.valueOf(loanScheduleType))
|
||||||
|
&& AdvancedPaymentScheduleTransactionProcessor.ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||||
|
.equals(transactionProcessingStrategyCode)) {
|
||||||
|
baseDataValidator.reset().parameter(LoanProductConstants.LOAN_SCHEDULE_PROCESSING_TYPE).failWithCode(
|
||||||
|
"supported.only.for.progressive.loan.schedule.type",
|
||||||
|
"Progressive repayment schedule processing is only available with `Advanced payment allocation` strategy");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String loanScheduleProcessingType = loanProduct.getLoanProductRelatedDetail().getLoanScheduleProcessingType().name();
|
String loanScheduleProcessingType = loanProduct.getLoanProductRelatedDetail().getLoanScheduleProcessingType().name();
|
||||||
@@ -1795,7 +1815,7 @@ public final class LoanProductDataValidator {
|
|||||||
loanScheduleProcessingType = this.fromApiJsonHelper.extractStringNamed(LoanProductConstants.LOAN_SCHEDULE_PROCESSING_TYPE,
|
loanScheduleProcessingType = this.fromApiJsonHelper.extractStringNamed(LoanProductConstants.LOAN_SCHEDULE_PROCESSING_TYPE,
|
||||||
element);
|
element);
|
||||||
baseDataValidator.reset().parameter(LoanProductConstants.LOAN_SCHEDULE_PROCESSING_TYPE).value(loanScheduleProcessingType)
|
baseDataValidator.reset().parameter(LoanProductConstants.LOAN_SCHEDULE_PROCESSING_TYPE).value(loanScheduleProcessingType)
|
||||||
.ignoreIfNull().isOneOfEnumValues(LoanScheduleProcessingType.class);
|
.isOneOfEnumValues(LoanScheduleProcessingType.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<LoanProductPaymentAllocationRule> allocationRules = loanProduct.getPaymentAllocationRules();
|
List<LoanProductPaymentAllocationRule> allocationRules = loanProduct.getPaymentAllocationRules();
|
||||||
|
|||||||
+2
@@ -50,6 +50,7 @@ import org.apache.fineract.integrationtests.common.savings.AccountTransferHelper
|
|||||||
import org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper;
|
import org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper;
|
||||||
import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper;
|
import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper;
|
||||||
import org.apache.fineract.integrationtests.common.savings.SavingsStatusChecker;
|
import org.apache.fineract.integrationtests.common.savings.SavingsStatusChecker;
|
||||||
|
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleType;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
@@ -479,6 +480,7 @@ public class AccountTransferTest {
|
|||||||
.withAmortizationTypeAsEqualInstallments() //
|
.withAmortizationTypeAsEqualInstallments() //
|
||||||
.withInterestTypeAsDecliningBalance() //
|
.withInterestTypeAsDecliningBalance() //
|
||||||
.withAccountingRuleAsCashBased(accounts)//
|
.withAccountingRuleAsCashBased(accounts)//
|
||||||
|
.withLoanScheduleType(LoanScheduleType.CUMULATIVE)//
|
||||||
.build(null);
|
.build(null);
|
||||||
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
||||||
}
|
}
|
||||||
|
|||||||
+25
-4
@@ -2171,7 +2171,7 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// UC109: Advanced payment allocation, cumulative loan schedule handling, rounding test
|
// UC109: Advanced payment allocation, progressive loan schedule handling, rounding test
|
||||||
// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||||
// 1. Create a Loan product, 1000 principal, across 3 installment
|
// 1. Create a Loan product, 1000 principal, across 3 installment
|
||||||
// 2. Submit the loan, and check the generated repayment schedule
|
// 2. Submit the loan, and check the generated repayment schedule
|
||||||
@@ -2183,7 +2183,7 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
|||||||
final Account incomeAccount = accountHelper.createIncomeAccount();
|
final Account incomeAccount = accountHelper.createIncomeAccount();
|
||||||
final Account expenseAccount = accountHelper.createExpenseAccount();
|
final Account expenseAccount = accountHelper.createExpenseAccount();
|
||||||
final Account overpaymentAccount = accountHelper.createLiabilityAccount();
|
final Account overpaymentAccount = accountHelper.createLiabilityAccount();
|
||||||
Integer localLoanProductId = createLoanProduct("1000", "15", "3", false, null, false, LoanScheduleType.CUMULATIVE,
|
Integer localLoanProductId = createLoanProduct("1000", "15", "3", false, null, false, LoanScheduleType.PROGRESSIVE,
|
||||||
LoanScheduleProcessingType.HORIZONTAL, assetAccount, incomeAccount, expenseAccount, overpaymentAccount);
|
LoanScheduleProcessingType.HORIZONTAL, assetAccount, incomeAccount, expenseAccount, overpaymentAccount);
|
||||||
assertNotNull(localLoanProductId);
|
assertNotNull(localLoanProductId);
|
||||||
|
|
||||||
@@ -2310,7 +2310,7 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// UC111: Advanced payment allocation, cumulative loan schedule handling, rounding test
|
// UC111: Advanced payment allocation, progressive loan schedule handling, rounding test
|
||||||
// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||||
// 1. Create a Loan product, 40.50 principal, across 4 installment (1 down payment, 3 normal installment)
|
// 1. Create a Loan product, 40.50 principal, across 4 installment (1 down payment, 3 normal installment)
|
||||||
// 2. Submit the loan, and check the generated repayment schedule
|
// 2. Submit the loan, and check the generated repayment schedule
|
||||||
@@ -2322,7 +2322,7 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
|||||||
final Account incomeAccount = accountHelper.createIncomeAccount();
|
final Account incomeAccount = accountHelper.createIncomeAccount();
|
||||||
final Account expenseAccount = accountHelper.createExpenseAccount();
|
final Account expenseAccount = accountHelper.createExpenseAccount();
|
||||||
final Account overpaymentAccount = accountHelper.createLiabilityAccount();
|
final Account overpaymentAccount = accountHelper.createLiabilityAccount();
|
||||||
Integer localLoanProductId = createLoanProduct("40.50", "15", "3", true, "25", false, LoanScheduleType.CUMULATIVE,
|
Integer localLoanProductId = createLoanProduct("40.50", "15", "3", true, "25", false, LoanScheduleType.PROGRESSIVE,
|
||||||
LoanScheduleProcessingType.HORIZONTAL, assetAccount, incomeAccount, expenseAccount, overpaymentAccount);
|
LoanScheduleProcessingType.HORIZONTAL, assetAccount, incomeAccount, expenseAccount, overpaymentAccount);
|
||||||
assertNotNull(localLoanProductId);
|
assertNotNull(localLoanProductId);
|
||||||
|
|
||||||
@@ -3012,6 +3012,27 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UC119: Advanced payment allocation with Loan Schedule as Cumulative
|
||||||
|
// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||||
|
// 1. Create a Loan product with Adv. Pment. Alloc., but the loan schedule as Cumulative -> expect validation error
|
||||||
|
@Test
|
||||||
|
public void uc119() {
|
||||||
|
runAt("02 February 2023", () -> {
|
||||||
|
final Account assetAccount = accountHelper.createAssetAccount();
|
||||||
|
final Account incomeAccount = accountHelper.createIncomeAccount();
|
||||||
|
final Account expenseAccount = accountHelper.createExpenseAccount();
|
||||||
|
final Account overpaymentAccount = accountHelper.createLiabilityAccount();
|
||||||
|
AdvancedPaymentData defaultPaymentAllocation = createDefaultPaymentAllocation();
|
||||||
|
|
||||||
|
ArrayList<HashMap<String, Object>> loanProductErrorData = createLoanProductGetError("500", "15", "4", false,
|
||||||
|
LoanScheduleType.CUMULATIVE, LoanScheduleProcessingType.HORIZONTAL, defaultPaymentAllocation, assetAccount,
|
||||||
|
incomeAccount, expenseAccount, overpaymentAccount);
|
||||||
|
assertNotNull(loanProductErrorData);
|
||||||
|
assertEquals("validation.msg.loanproduct.loanScheduleProcessingType.supported.only.for.progressive.loan.schedule.type",
|
||||||
|
loanProductErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private static void validateLoanSummaryBalances(GetLoansLoanIdResponse loanDetails, Double totalOutstanding, Double totalRepayment,
|
private static void validateLoanSummaryBalances(GetLoansLoanIdResponse loanDetails, Double totalOutstanding, Double totalRepayment,
|
||||||
Double principalOutstanding, Double principalPaid, Double totalOverpaid) {
|
Double principalOutstanding, Double principalPaid, Double totalOverpaid) {
|
||||||
assertEquals(totalOutstanding, loanDetails.getSummary().getTotalOutstanding());
|
assertEquals(totalOutstanding, loanDetails.getSummary().getTotalOutstanding());
|
||||||
|
|||||||
+15
-5
@@ -35,6 +35,8 @@ import org.apache.fineract.client.models.PostLoanProductsResponse;
|
|||||||
import org.apache.fineract.client.models.PostLoansLoanIdChargesChargeIdRequest;
|
import org.apache.fineract.client.models.PostLoansLoanIdChargesChargeIdRequest;
|
||||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanTestLifecycleExtension;
|
import org.apache.fineract.integrationtests.common.loans.LoanTestLifecycleExtension;
|
||||||
|
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleProcessingType;
|
||||||
|
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleType;
|
||||||
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
|
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
@@ -53,7 +55,9 @@ public class AdvancedPaymentAllocationWaiveLoanCharges extends BaseLoanIntegrati
|
|||||||
Long loanProductId = createLoanProductWithAdvancedAllocation();
|
Long loanProductId = createLoanProductWithAdvancedAllocation();
|
||||||
// Apply and Approve Loan
|
// Apply and Approve Loan
|
||||||
Long loanId = applyAndApproveLoan(clientId, loanProductId, "01 January 2023", 1000.0, 1,
|
Long loanId = applyAndApproveLoan(clientId, loanProductId, "01 January 2023", 1000.0, 1,
|
||||||
(req) -> req.setTransactionProcessingStrategyCode(ADVANCED_PAYMENT_ALLOCATION_STRATEGY));
|
(req) -> req.transactionProcessingStrategyCode(ADVANCED_PAYMENT_ALLOCATION_STRATEGY)
|
||||||
|
.loanScheduleType(LoanScheduleType.PROGRESSIVE.toString())
|
||||||
|
.loanScheduleProcessingType(LoanScheduleProcessingType.HORIZONTAL.toString()));
|
||||||
// Disburse Loan
|
// Disburse Loan
|
||||||
disburseLoan(loanId, BigDecimal.valueOf(1000.00), "01 January 2023");
|
disburseLoan(loanId, BigDecimal.valueOf(1000.00), "01 January 2023");
|
||||||
// Add Penalty
|
// Add Penalty
|
||||||
@@ -85,7 +89,9 @@ public class AdvancedPaymentAllocationWaiveLoanCharges extends BaseLoanIntegrati
|
|||||||
Long loanProductId = createLoanProductWithAdvancedAllocation();
|
Long loanProductId = createLoanProductWithAdvancedAllocation();
|
||||||
// Apply and Approve Loan
|
// Apply and Approve Loan
|
||||||
Long loanId = applyAndApproveLoan(clientId, loanProductId, "01 January 2023", 1000.0, 1,
|
Long loanId = applyAndApproveLoan(clientId, loanProductId, "01 January 2023", 1000.0, 1,
|
||||||
(req) -> req.setTransactionProcessingStrategyCode(ADVANCED_PAYMENT_ALLOCATION_STRATEGY));
|
(req) -> req.transactionProcessingStrategyCode(ADVANCED_PAYMENT_ALLOCATION_STRATEGY)
|
||||||
|
.loanScheduleType(LoanScheduleType.PROGRESSIVE.toString())
|
||||||
|
.loanScheduleProcessingType(LoanScheduleProcessingType.HORIZONTAL.toString()));
|
||||||
// Disburse Loan
|
// Disburse Loan
|
||||||
disburseLoan(loanId, BigDecimal.valueOf(1000.00), "01 January 2023");
|
disburseLoan(loanId, BigDecimal.valueOf(1000.00), "01 January 2023");
|
||||||
// Add Penalty
|
// Add Penalty
|
||||||
@@ -117,8 +123,10 @@ public class AdvancedPaymentAllocationWaiveLoanCharges extends BaseLoanIntegrati
|
|||||||
Long loanProductId = createLoanProductWithAdvancedAllocation();
|
Long loanProductId = createLoanProductWithAdvancedAllocation();
|
||||||
// Apply and Approve Loan
|
// Apply and Approve Loan
|
||||||
Long loanId = applyAndApproveLoan(clientId, loanProductId, "01 January 2023", 1000.0, 1,
|
Long loanId = applyAndApproveLoan(clientId, loanProductId, "01 January 2023", 1000.0, 1,
|
||||||
(req) -> req.setTransactionProcessingStrategyCode(ADVANCED_PAYMENT_ALLOCATION_STRATEGY));
|
(req) -> req.transactionProcessingStrategyCode(ADVANCED_PAYMENT_ALLOCATION_STRATEGY)
|
||||||
// Disburse Loan
|
.loanScheduleType(LoanScheduleType.PROGRESSIVE.toString())
|
||||||
|
.loanScheduleProcessingType(LoanScheduleProcessingType.HORIZONTAL.toString())); // Disburse
|
||||||
|
// Loan
|
||||||
disburseLoan(loanId, BigDecimal.valueOf(1000.00), "01 January 2023");
|
disburseLoan(loanId, BigDecimal.valueOf(1000.00), "01 January 2023");
|
||||||
|
|
||||||
// set business date to
|
// set business date to
|
||||||
@@ -180,7 +188,9 @@ public class AdvancedPaymentAllocationWaiveLoanCharges extends BaseLoanIntegrati
|
|||||||
|
|
||||||
protected Long createLoanProductWithAdvancedAllocation() {
|
protected Long createLoanProductWithAdvancedAllocation() {
|
||||||
PostLoanProductsRequest req = createOnePeriod30DaysLongNoInterestPeriodicAccrualProduct();
|
PostLoanProductsRequest req = createOnePeriod30DaysLongNoInterestPeriodicAccrualProduct();
|
||||||
req.setTransactionProcessingStrategyCode(ADVANCED_PAYMENT_ALLOCATION_STRATEGY);
|
req.transactionProcessingStrategyCode(ADVANCED_PAYMENT_ALLOCATION_STRATEGY)
|
||||||
|
.loanScheduleType(LoanScheduleType.PROGRESSIVE.toString())
|
||||||
|
.loanScheduleProcessingType(LoanScheduleProcessingType.HORIZONTAL.toString());
|
||||||
req.addPaymentAllocationItem(createDefaultPaymentAllocationWithMixedGrouping());
|
req.addPaymentAllocationItem(createDefaultPaymentAllocationWithMixedGrouping());
|
||||||
PostLoanProductsResponse loanProduct = loanTransactionHelper.createLoanProduct(req);
|
PostLoanProductsResponse loanProduct = loanTransactionHelper.createLoanProduct(req);
|
||||||
return loanProduct.getResourceId();
|
return loanProduct.getResourceId();
|
||||||
|
|||||||
+5
@@ -71,6 +71,8 @@ import org.apache.fineract.integrationtests.common.loans.LoanProductHelper;
|
|||||||
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanTestLifecycleExtension;
|
import org.apache.fineract.integrationtests.common.loans.LoanTestLifecycleExtension;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||||
|
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleProcessingType;
|
||||||
|
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleType;
|
||||||
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
|
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.extension.ExtendWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
@@ -145,6 +147,7 @@ public abstract class BaseLoanIntegrationTest {
|
|||||||
.interestCalculationPeriodType(1)//
|
.interestCalculationPeriodType(1)//
|
||||||
.transactionProcessingStrategyCode(
|
.transactionProcessingStrategyCode(
|
||||||
LoanProductTestBuilder.DUE_PENALTY_FEE_INTEREST_PRINCIPAL_IN_ADVANCE_PRINCIPAL_PENALTY_FEE_INTEREST_STRATEGY)//
|
LoanProductTestBuilder.DUE_PENALTY_FEE_INTEREST_PRINCIPAL_IN_ADVANCE_PRINCIPAL_PENALTY_FEE_INTEREST_STRATEGY)//
|
||||||
|
.loanScheduleType(LoanScheduleType.CUMULATIVE.toString()) //
|
||||||
.daysInYearType(1)//
|
.daysInYearType(1)//
|
||||||
.daysInMonthType(1)//
|
.daysInMonthType(1)//
|
||||||
.canDefineInstallmentAmount(true)//
|
.canDefineInstallmentAmount(true)//
|
||||||
@@ -206,6 +209,8 @@ public abstract class BaseLoanIntegrationTest {
|
|||||||
|
|
||||||
return createOnePeriod30DaysLongNoInterestPeriodicAccrualProduct() //
|
return createOnePeriod30DaysLongNoInterestPeriodicAccrualProduct() //
|
||||||
.transactionProcessingStrategyCode("advanced-payment-allocation-strategy")//
|
.transactionProcessingStrategyCode("advanced-payment-allocation-strategy")//
|
||||||
|
.loanScheduleType(LoanScheduleType.PROGRESSIVE.toString()) //
|
||||||
|
.loanScheduleProcessingType(LoanScheduleProcessingType.HORIZONTAL.toString()) //
|
||||||
.addPaymentAllocationItem(defaultAllocation);
|
.addPaymentAllocationItem(defaultAllocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
@@ -50,6 +50,7 @@ import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
|||||||
import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
|
import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanTestLifecycleExtension;
|
import org.apache.fineract.integrationtests.common.loans.LoanTestLifecycleExtension;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||||
|
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleType;
|
||||||
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
|
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
@@ -735,6 +736,7 @@ public class ClientLoanCreditBalanceRefundandRepaymentTypeIntegrationTest extend
|
|||||||
return Stream.of(Arguments.of(Named.of("DEFAULT_STRATEGY", new LoanProductTestBuilder().withRepaymentStrategy(DEFAULT_STRATEGY))),
|
return Stream.of(Arguments.of(Named.of("DEFAULT_STRATEGY", new LoanProductTestBuilder().withRepaymentStrategy(DEFAULT_STRATEGY))),
|
||||||
Arguments.of(Named.of("ADVANCED_PAYMENT_ALLOCATION_STRATEGY",
|
Arguments.of(Named.of("ADVANCED_PAYMENT_ALLOCATION_STRATEGY",
|
||||||
new LoanProductTestBuilder().withRepaymentStrategy(ADVANCED_PAYMENT_ALLOCATION_STRATEGY)
|
new LoanProductTestBuilder().withRepaymentStrategy(ADVANCED_PAYMENT_ALLOCATION_STRATEGY)
|
||||||
|
.withLoanScheduleType(LoanScheduleType.PROGRESSIVE)
|
||||||
.addAdvancedPaymentAllocation(createDefaultPaymentAllocation(), createRepaymentPaymentAllocation()))));
|
.addAdvancedPaymentAllocation(createDefaultPaymentAllocation(), createRepaymentPaymentAllocation()))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
@@ -59,6 +59,7 @@ import org.apache.fineract.integrationtests.common.loans.LoanTestLifecycleExtens
|
|||||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||||
import org.apache.fineract.integrationtests.common.products.DelinquencyBucketsHelper;
|
import org.apache.fineract.integrationtests.common.products.DelinquencyBucketsHelper;
|
||||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
|
import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
|
||||||
|
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleType;
|
||||||
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
|
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Named;
|
import org.junit.jupiter.api.Named;
|
||||||
@@ -422,6 +423,7 @@ public class DelinquencyAndChargebackIntegrationTest {
|
|||||||
return Stream.of(Arguments.of(Named.of("DEFAULT_STRATEGY", new LoanProductTestBuilder().withRepaymentStrategy(DEFAULT_STRATEGY))),
|
return Stream.of(Arguments.of(Named.of("DEFAULT_STRATEGY", new LoanProductTestBuilder().withRepaymentStrategy(DEFAULT_STRATEGY))),
|
||||||
Arguments.of(Named.of("ADVANCED_PAYMENT_ALLOCATION_STRATEGY",
|
Arguments.of(Named.of("ADVANCED_PAYMENT_ALLOCATION_STRATEGY",
|
||||||
new LoanProductTestBuilder().withRepaymentStrategy(ADVANCED_PAYMENT_ALLOCATION_STRATEGY)
|
new LoanProductTestBuilder().withRepaymentStrategy(ADVANCED_PAYMENT_ALLOCATION_STRATEGY)
|
||||||
|
.withLoanScheduleType(LoanScheduleType.PROGRESSIVE)
|
||||||
.addAdvancedPaymentAllocation(createDefaultPaymentAllocation(), createRepaymentPaymentAllocation()))));
|
.addAdvancedPaymentAllocation(createDefaultPaymentAllocation(), createRepaymentPaymentAllocation()))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
@@ -71,6 +71,8 @@ import org.apache.fineract.integrationtests.common.loans.LoanTestLifecycleExtens
|
|||||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||||
import org.apache.fineract.integrationtests.common.products.DelinquencyBucketsHelper;
|
import org.apache.fineract.integrationtests.common.products.DelinquencyBucketsHelper;
|
||||||
import org.apache.fineract.integrationtests.common.system.CodeHelper;
|
import org.apache.fineract.integrationtests.common.system.CodeHelper;
|
||||||
|
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleProcessingType;
|
||||||
|
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleType;
|
||||||
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
|
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
@@ -675,6 +677,8 @@ public class LoanAccountChargeOffWithAdvancedPaymentAllocationTest extends BaseL
|
|||||||
.isEqualAmortization(false)//
|
.isEqualAmortization(false)//
|
||||||
.interestCalculationPeriodType(1)//
|
.interestCalculationPeriodType(1)//
|
||||||
.transactionProcessingStrategyCode("advanced-payment-allocation-strategy")//
|
.transactionProcessingStrategyCode("advanced-payment-allocation-strategy")//
|
||||||
|
.loanScheduleType(LoanScheduleType.PROGRESSIVE.toString())//
|
||||||
|
.loanScheduleProcessingType(LoanScheduleProcessingType.HORIZONTAL.toString())//
|
||||||
.addPaymentAllocationItem(defaultAllocation)//
|
.addPaymentAllocationItem(defaultAllocation)//
|
||||||
.daysInYearType(1)//
|
.daysInYearType(1)//
|
||||||
.daysInMonthType(1)//
|
.daysInMonthType(1)//
|
||||||
|
|||||||
+7
-1
@@ -69,6 +69,8 @@ import org.apache.fineract.integrationtests.common.loans.LoanProductHelper;
|
|||||||
import org.apache.fineract.integrationtests.common.loans.LoanTestLifecycleExtension;
|
import org.apache.fineract.integrationtests.common.loans.LoanTestLifecycleExtension;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||||
import org.apache.fineract.integrationtests.common.products.DelinquencyBucketsHelper;
|
import org.apache.fineract.integrationtests.common.products.DelinquencyBucketsHelper;
|
||||||
|
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleProcessingType;
|
||||||
|
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleType;
|
||||||
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
|
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
@@ -431,7 +433,9 @@ public class LoanAccountChargeReveseReplayWithAdvancedPaymentAllocationTest {
|
|||||||
.interestType(0)//
|
.interestType(0)//
|
||||||
.isEqualAmortization(false)//
|
.isEqualAmortization(false)//
|
||||||
.interestCalculationPeriodType(1)//
|
.interestCalculationPeriodType(1)//
|
||||||
.transactionProcessingStrategyCode("mifos-standard-strategy").daysInYearType(1)//
|
.transactionProcessingStrategyCode("mifos-standard-strategy")//
|
||||||
|
.loanScheduleType(LoanScheduleType.CUMULATIVE.toString())//
|
||||||
|
.daysInYearType(1)//
|
||||||
.daysInMonthType(1)//
|
.daysInMonthType(1)//
|
||||||
.canDefineInstallmentAmount(true)//
|
.canDefineInstallmentAmount(true)//
|
||||||
.graceOnArrearsAgeing(3)//
|
.graceOnArrearsAgeing(3)//
|
||||||
@@ -494,6 +498,8 @@ public class LoanAccountChargeReveseReplayWithAdvancedPaymentAllocationTest {
|
|||||||
|
|
||||||
loanProductsRequest //
|
loanProductsRequest //
|
||||||
.transactionProcessingStrategyCode("advanced-payment-allocation-strategy")//
|
.transactionProcessingStrategyCode("advanced-payment-allocation-strategy")//
|
||||||
|
.loanScheduleType(LoanScheduleType.PROGRESSIVE.toString())//
|
||||||
|
.loanScheduleProcessingType(LoanScheduleProcessingType.HORIZONTAL.toString())//
|
||||||
.addPaymentAllocationItem(defaultAllocation);
|
.addPaymentAllocationItem(defaultAllocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -48,6 +48,7 @@ import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker;
|
|||||||
import org.apache.fineract.integrationtests.common.loans.LoanTestLifecycleExtension;
|
import org.apache.fineract.integrationtests.common.loans.LoanTestLifecycleExtension;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||||
import org.apache.fineract.integrationtests.useradministration.users.UserHelper;
|
import org.apache.fineract.integrationtests.useradministration.users.UserHelper;
|
||||||
|
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleType;
|
||||||
import org.apache.http.HttpStatus;
|
import org.apache.http.HttpStatus;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
@@ -154,7 +155,7 @@ public class LoanCatchUpIntegrationTest {
|
|||||||
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal("15,000.00").withNumberOfRepayments("4")
|
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal("15,000.00").withNumberOfRepayments("4")
|
||||||
.withRepaymentAfterEvery("1").withRepaymentTypeAsMonth().withinterestRatePerPeriod("1")
|
.withRepaymentAfterEvery("1").withRepaymentTypeAsMonth().withinterestRatePerPeriod("1")
|
||||||
.withInterestRateFrequencyTypeAsMonths().withAmortizationTypeAsEqualInstallments().withInterestTypeAsDecliningBalance()
|
.withInterestRateFrequencyTypeAsMonths().withAmortizationTypeAsEqualInstallments().withInterestTypeAsDecliningBalance()
|
||||||
.build(chargeId);
|
.withLoanScheduleType(LoanScheduleType.CUMULATIVE).build(chargeId);
|
||||||
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+11
-4
@@ -64,6 +64,8 @@ import org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper;
|
|||||||
import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper;
|
import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper;
|
||||||
import org.apache.fineract.integrationtests.common.savings.SavingsStatusChecker;
|
import org.apache.fineract.integrationtests.common.savings.SavingsStatusChecker;
|
||||||
import org.apache.fineract.portfolio.loanaccount.domain.transactionprocessor.impl.AdvancedPaymentScheduleTransactionProcessor;
|
import org.apache.fineract.portfolio.loanaccount.domain.transactionprocessor.impl.AdvancedPaymentScheduleTransactionProcessor;
|
||||||
|
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleProcessingType;
|
||||||
|
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleType;
|
||||||
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
|
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
@@ -258,6 +260,7 @@ public class LoanChargePaymentWithAdvancedPaymentAllocationTest {
|
|||||||
.withRepaymentTypeAsDays().withRepaymentAfterEvery(repaymentAfterEvery).withNumberOfRepayments(numberOfRepayments)
|
.withRepaymentTypeAsDays().withRepaymentAfterEvery(repaymentAfterEvery).withNumberOfRepayments(numberOfRepayments)
|
||||||
.withEnableDownPayment(true, "25", true).withinterestRatePerPeriod("0").withInterestRateFrequencyTypeAsMonths()
|
.withEnableDownPayment(true, "25", true).withinterestRatePerPeriod("0").withInterestRateFrequencyTypeAsMonths()
|
||||||
.withRepaymentStrategy(AdvancedPaymentScheduleTransactionProcessor.ADVANCED_PAYMENT_ALLOCATION_STRATEGY)
|
.withRepaymentStrategy(AdvancedPaymentScheduleTransactionProcessor.ADVANCED_PAYMENT_ALLOCATION_STRATEGY)
|
||||||
|
.withLoanScheduleType(LoanScheduleType.PROGRESSIVE).withLoanScheduleProcessingType(LoanScheduleProcessingType.HORIZONTAL)
|
||||||
.withAmortizationTypeAsEqualPrincipalPayment().withInterestTypeAsFlat().withAccountingRulePeriodicAccrual(accounts)
|
.withAmortizationTypeAsEqualPrincipalPayment().withInterestTypeAsFlat().withAccountingRulePeriodicAccrual(accounts)
|
||||||
.addAdvancedPaymentAllocation(defaultAllocation, goodwillCreditAllocation, merchantIssuedRefundAllocation,
|
.addAdvancedPaymentAllocation(defaultAllocation, goodwillCreditAllocation, merchantIssuedRefundAllocation,
|
||||||
payoutRefundAllocation)
|
payoutRefundAllocation)
|
||||||
@@ -272,10 +275,12 @@ public class LoanChargePaymentWithAdvancedPaymentAllocationTest {
|
|||||||
return loanTransactionHelper.applyLoan(new PostLoansRequest().clientId(clientId).productId(loanProductId.longValue())
|
return loanTransactionHelper.applyLoan(new PostLoansRequest().clientId(clientId).productId(loanProductId.longValue())
|
||||||
.expectedDisbursementDate(expectedDisbursementDate).dateFormat(DATETIME_PATTERN)
|
.expectedDisbursementDate(expectedDisbursementDate).dateFormat(DATETIME_PATTERN)
|
||||||
.transactionProcessingStrategyCode(AdvancedPaymentScheduleTransactionProcessor.ADVANCED_PAYMENT_ALLOCATION_STRATEGY)
|
.transactionProcessingStrategyCode(AdvancedPaymentScheduleTransactionProcessor.ADVANCED_PAYMENT_ALLOCATION_STRATEGY)
|
||||||
.locale("en").submittedOnDate(submittedOnDate).amortizationType(1).interestRatePerPeriod(interestRate)
|
.loanScheduleType(LoanScheduleType.PROGRESSIVE.toString())
|
||||||
.interestCalculationPeriodType(1).interestType(0).repaymentFrequencyType(0).repaymentEvery(repaymentAfterEvery)
|
.loanScheduleProcessingType(LoanScheduleProcessingType.HORIZONTAL.toString()).locale("en").submittedOnDate(submittedOnDate)
|
||||||
.repaymentFrequencyType(0).numberOfRepayments(numberOfRepayments).loanTermFrequency(loanTermFrequency)
|
.amortizationType(1).interestRatePerPeriod(interestRate).interestCalculationPeriodType(1).interestType(0)
|
||||||
.loanTermFrequencyType(0).principal(BigDecimal.valueOf(principal)).loanType("individual"));
|
.repaymentFrequencyType(0).repaymentEvery(repaymentAfterEvery).repaymentFrequencyType(0)
|
||||||
|
.numberOfRepayments(numberOfRepayments).loanTermFrequency(loanTermFrequency).loanTermFrequencyType(0)
|
||||||
|
.principal(BigDecimal.valueOf(principal)).loanType("individual"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String updateLoanJson(final Integer clientID, final Integer loanProductID, String savingsId) {
|
private String updateLoanJson(final Integer clientID, final Integer loanProductID, String savingsId) {
|
||||||
@@ -297,6 +302,8 @@ public class LoanChargePaymentWithAdvancedPaymentAllocationTest {
|
|||||||
.withRepaymentFrequencyTypeAsDays() //
|
.withRepaymentFrequencyTypeAsDays() //
|
||||||
.withInterestRatePerPeriod("0") //
|
.withInterestRatePerPeriod("0") //
|
||||||
.withRepaymentStrategy(AdvancedPaymentScheduleTransactionProcessor.ADVANCED_PAYMENT_ALLOCATION_STRATEGY)
|
.withRepaymentStrategy(AdvancedPaymentScheduleTransactionProcessor.ADVANCED_PAYMENT_ALLOCATION_STRATEGY)
|
||||||
|
.withLoanScheduleType(LoanScheduleType.PROGRESSIVE.toString()) //
|
||||||
|
.withLoanScheduleProcessingType(LoanScheduleProcessingType.HORIZONTAL.toString()) //
|
||||||
.withAmortizationTypeAsEqualInstallments() //
|
.withAmortizationTypeAsEqualInstallments() //
|
||||||
.withInterestTypeAsDecliningBalance() //
|
.withInterestTypeAsDecliningBalance() //
|
||||||
.withInterestCalculationPeriodTypeSameAsRepaymentPeriod() //
|
.withInterestCalculationPeriodTypeSameAsRepaymentPeriod() //
|
||||||
|
|||||||
+2
@@ -51,6 +51,7 @@ import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
|||||||
import org.apache.fineract.integrationtests.common.loans.LoanTestLifecycleExtension;
|
import org.apache.fineract.integrationtests.common.loans.LoanTestLifecycleExtension;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||||
import org.apache.fineract.integrationtests.common.products.DelinquencyBucketsHelper;
|
import org.apache.fineract.integrationtests.common.products.DelinquencyBucketsHelper;
|
||||||
|
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleType;
|
||||||
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
|
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Named;
|
import org.junit.jupiter.api.Named;
|
||||||
@@ -328,6 +329,7 @@ public class LoanChargebackOnPaymentTypeRepaymentTransactionsTest {
|
|||||||
return Stream.of(Arguments.of(Named.of("DEFAULT_STRATEGY", new LoanProductTestBuilder().withRepaymentStrategy(DEFAULT_STRATEGY))),
|
return Stream.of(Arguments.of(Named.of("DEFAULT_STRATEGY", new LoanProductTestBuilder().withRepaymentStrategy(DEFAULT_STRATEGY))),
|
||||||
Arguments.of(Named.of("ADVANCED_PAYMENT_ALLOCATION_STRATEGY",
|
Arguments.of(Named.of("ADVANCED_PAYMENT_ALLOCATION_STRATEGY",
|
||||||
new LoanProductTestBuilder().withRepaymentStrategy(ADVANCED_PAYMENT_ALLOCATION_STRATEGY)
|
new LoanProductTestBuilder().withRepaymentStrategy(ADVANCED_PAYMENT_ALLOCATION_STRATEGY)
|
||||||
|
.withLoanScheduleType(LoanScheduleType.PROGRESSIVE)
|
||||||
.addAdvancedPaymentAllocation(createDefaultPaymentAllocation(), createRepaymentPaymentAllocation()))));
|
.addAdvancedPaymentAllocation(createDefaultPaymentAllocation(), createRepaymentPaymentAllocation()))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
@@ -64,6 +64,7 @@ import org.apache.fineract.integrationtests.common.loans.LoanTestLifecycleExtens
|
|||||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||||
import org.apache.fineract.integrationtests.common.products.DelinquencyBucketsHelper;
|
import org.apache.fineract.integrationtests.common.products.DelinquencyBucketsHelper;
|
||||||
import org.apache.fineract.integrationtests.common.system.CodeHelper;
|
import org.apache.fineract.integrationtests.common.system.CodeHelper;
|
||||||
|
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleType;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Disabled;
|
import org.junit.jupiter.api.Disabled;
|
||||||
@@ -1185,6 +1186,7 @@ public class LoanPostChargeOffScenariosTest {
|
|||||||
.isEqualAmortization(false)//
|
.isEqualAmortization(false)//
|
||||||
.interestCalculationPeriodType(1)//
|
.interestCalculationPeriodType(1)//
|
||||||
.transactionProcessingStrategyCode("mifos-standard-strategy")//
|
.transactionProcessingStrategyCode("mifos-standard-strategy")//
|
||||||
|
.loanScheduleType(LoanScheduleType.CUMULATIVE.toString())//
|
||||||
.daysInYearType(1)//
|
.daysInYearType(1)//
|
||||||
.daysInMonthType(1)//
|
.daysInMonthType(1)//
|
||||||
.canDefineInstallmentAmount(true)//
|
.canDefineInstallmentAmount(true)//
|
||||||
|
|||||||
+6
-2
@@ -34,6 +34,8 @@ import org.apache.fineract.client.models.PutLoanProductsProductIdRequest;
|
|||||||
import org.apache.fineract.integrationtests.common.Utils;
|
import org.apache.fineract.integrationtests.common.Utils;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||||
|
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleProcessingType;
|
||||||
|
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleType;
|
||||||
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
|
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
@@ -139,7 +141,8 @@ public class LoanProductUpdateApiTest {
|
|||||||
String loanProductCreateJSON = new LoanProductTestBuilder().withPrincipal("15,000.00").withNumberOfRepayments("4")
|
String loanProductCreateJSON = new LoanProductTestBuilder().withPrincipal("15,000.00").withNumberOfRepayments("4")
|
||||||
.withRepaymentAfterEvery("1").withRepaymentTypeAsMonth().withinterestRatePerPeriod("1")
|
.withRepaymentAfterEvery("1").withRepaymentTypeAsMonth().withinterestRatePerPeriod("1")
|
||||||
.withInterestRateFrequencyTypeAsMonths().withAmortizationTypeAsEqualInstallments().withInterestTypeAsDecliningBalance()
|
.withInterestRateFrequencyTypeAsMonths().withAmortizationTypeAsEqualInstallments().withInterestTypeAsDecliningBalance()
|
||||||
.addAdvancedPaymentAllocation(advancedPaymentData).build();
|
.addAdvancedPaymentAllocation(advancedPaymentData).withLoanScheduleType(LoanScheduleType.PROGRESSIVE)
|
||||||
|
.withLoanScheduleProcessingType(LoanScheduleProcessingType.HORIZONTAL).build();
|
||||||
return LOAN_TRANSACTION_HELPER.getLoanProductId(loanProductCreateJSON);
|
return LOAN_TRANSACTION_HELPER.getLoanProductId(loanProductCreateJSON);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -149,7 +152,8 @@ public class LoanProductUpdateApiTest {
|
|||||||
.withRepaymentAfterEvery("1").withRepaymentTypeAsMonth().withinterestRatePerPeriod("1")
|
.withRepaymentAfterEvery("1").withRepaymentTypeAsMonth().withinterestRatePerPeriod("1")
|
||||||
.withInterestRateFrequencyTypeAsMonths().withAmortizationTypeAsEqualInstallments().withInterestTypeAsDecliningBalance()
|
.withInterestRateFrequencyTypeAsMonths().withAmortizationTypeAsEqualInstallments().withInterestTypeAsDecliningBalance()
|
||||||
.withInterestCalculationPeriodTypeAsDays().withAllowPartialPeriodInterestCalculation(false)
|
.withInterestCalculationPeriodTypeAsDays().withAllowPartialPeriodInterestCalculation(false)
|
||||||
.addAdvancedPaymentAllocation(advancedPaymentData).build();
|
.addAdvancedPaymentAllocation(advancedPaymentData).withLoanScheduleType(LoanScheduleType.PROGRESSIVE)
|
||||||
|
.withLoanScheduleProcessingType(LoanScheduleProcessingType.HORIZONTAL).build();
|
||||||
return LOAN_TRANSACTION_HELPER.getLoanProductId(loanProductCreateJSON);
|
return LOAN_TRANSACTION_HELPER.getLoanProductId(loanProductCreateJSON);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-1
@@ -44,6 +44,8 @@ import org.apache.fineract.integrationtests.common.accounting.FinancialActivityA
|
|||||||
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanTestLifecycleExtension;
|
import org.apache.fineract.integrationtests.common.loans.LoanTestLifecycleExtension;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||||
|
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleProcessingType;
|
||||||
|
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleType;
|
||||||
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
|
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
@@ -238,7 +240,9 @@ public class LoanProductWithAdvancedPaymentAllocationIntegrationTests {
|
|||||||
.withRepaymentTypeAsMonth().withinterestRatePerPeriod("1")
|
.withRepaymentTypeAsMonth().withinterestRatePerPeriod("1")
|
||||||
.withAccountingRulePeriodicAccrual(new Account[] { ASSET_ACCOUNT, EXPENSE_ACCOUNT, INCOME_ACCOUNT, OVERPAYMENT_ACCOUNT })
|
.withAccountingRulePeriodicAccrual(new Account[] { ASSET_ACCOUNT, EXPENSE_ACCOUNT, INCOME_ACCOUNT, OVERPAYMENT_ACCOUNT })
|
||||||
.withInterestRateFrequencyTypeAsMonths().withAmortizationTypeAsEqualInstallments().withInterestTypeAsDecliningBalance()
|
.withInterestRateFrequencyTypeAsMonths().withAmortizationTypeAsEqualInstallments().withInterestTypeAsDecliningBalance()
|
||||||
.withFeeAndPenaltyAssetAccount(FEE_PENALTY_ACCOUNT).addAdvancedPaymentAllocation(advancedPaymentData).build();
|
.withFeeAndPenaltyAssetAccount(FEE_PENALTY_ACCOUNT).addAdvancedPaymentAllocation(advancedPaymentData)
|
||||||
|
.withLoanScheduleType(LoanScheduleType.PROGRESSIVE).withLoanScheduleProcessingType(LoanScheduleProcessingType.HORIZONTAL)
|
||||||
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private PutLoanProductsProductIdRequest updateLoanProductRequest(AdvancedPaymentData... advancedPaymentData) {
|
private PutLoanProductsProductIdRequest updateLoanProductRequest(AdvancedPaymentData... advancedPaymentData) {
|
||||||
|
|||||||
+2
@@ -61,6 +61,7 @@ import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
|||||||
import org.apache.fineract.integrationtests.common.loans.LoanTestLifecycleExtension;
|
import org.apache.fineract.integrationtests.common.loans.LoanTestLifecycleExtension;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||||
import org.apache.fineract.integrationtests.common.products.DelinquencyBucketsHelper;
|
import org.apache.fineract.integrationtests.common.products.DelinquencyBucketsHelper;
|
||||||
|
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleType;
|
||||||
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
|
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Named;
|
import org.junit.jupiter.api.Named;
|
||||||
@@ -720,6 +721,7 @@ public class LoanTransactionChargebackTest {
|
|||||||
return Stream.of(Arguments.of(Named.of("DEFAULT_STRATEGY", new LoanProductTestBuilder().withRepaymentStrategy(DEFAULT_STRATEGY))),
|
return Stream.of(Arguments.of(Named.of("DEFAULT_STRATEGY", new LoanProductTestBuilder().withRepaymentStrategy(DEFAULT_STRATEGY))),
|
||||||
Arguments.of(Named.of("ADVANCED_PAYMENT_ALLOCATION_STRATEGY",
|
Arguments.of(Named.of("ADVANCED_PAYMENT_ALLOCATION_STRATEGY",
|
||||||
new LoanProductTestBuilder().withRepaymentStrategy(ADVANCED_PAYMENT_ALLOCATION_STRATEGY)
|
new LoanProductTestBuilder().withRepaymentStrategy(ADVANCED_PAYMENT_ALLOCATION_STRATEGY)
|
||||||
|
.withLoanScheduleType(LoanScheduleType.PROGRESSIVE)
|
||||||
.addAdvancedPaymentAllocation(createDefaultPaymentAllocation(), createRepaymentPaymentAllocation()))));
|
.addAdvancedPaymentAllocation(createDefaultPaymentAllocation(), createRepaymentPaymentAllocation()))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
@@ -51,6 +51,7 @@ import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
|||||||
import org.apache.fineract.integrationtests.common.loans.LoanTestLifecycleExtension;
|
import org.apache.fineract.integrationtests.common.loans.LoanTestLifecycleExtension;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||||
import org.apache.fineract.integrationtests.common.products.DelinquencyBucketsHelper;
|
import org.apache.fineract.integrationtests.common.products.DelinquencyBucketsHelper;
|
||||||
|
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleType;
|
||||||
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
|
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Named;
|
import org.junit.jupiter.api.Named;
|
||||||
@@ -226,6 +227,7 @@ public class LoanTransactionFullAmountChargebackForOverpaidLoanTest {
|
|||||||
return Stream.of(Arguments.of(Named.of("DEFAULT_STRATEGY", new LoanProductTestBuilder().withRepaymentStrategy(DEFAULT_STRATEGY))),
|
return Stream.of(Arguments.of(Named.of("DEFAULT_STRATEGY", new LoanProductTestBuilder().withRepaymentStrategy(DEFAULT_STRATEGY))),
|
||||||
Arguments.of(Named.of("ADVANCED_PAYMENT_ALLOCATION_STRATEGY",
|
Arguments.of(Named.of("ADVANCED_PAYMENT_ALLOCATION_STRATEGY",
|
||||||
new LoanProductTestBuilder().withRepaymentStrategy(ADVANCED_PAYMENT_ALLOCATION_STRATEGY)
|
new LoanProductTestBuilder().withRepaymentStrategy(ADVANCED_PAYMENT_ALLOCATION_STRATEGY)
|
||||||
|
.withLoanScheduleType(LoanScheduleType.PROGRESSIVE)
|
||||||
.addAdvancedPaymentAllocation(createDefaultPaymentAllocation(), createRepaymentPaymentAllocation()))));
|
.addAdvancedPaymentAllocation(createDefaultPaymentAllocation(), createRepaymentPaymentAllocation()))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-1
@@ -44,6 +44,8 @@ import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuil
|
|||||||
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanTestLifecycleExtension;
|
import org.apache.fineract.integrationtests.common.loans.LoanTestLifecycleExtension;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||||
|
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleProcessingType;
|
||||||
|
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleType;
|
||||||
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
|
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
@@ -132,7 +134,9 @@ public class LoanWithAdvancedPaymentAllocationIntegrationTests {
|
|||||||
.withRepaymentStrategy(ADVANCED_PAYMENT_ALLOCATION_STRATEGY)
|
.withRepaymentStrategy(ADVANCED_PAYMENT_ALLOCATION_STRATEGY)
|
||||||
.withAccountingRulePeriodicAccrual(new Account[] { ASSET_ACCOUNT, EXPENSE_ACCOUNT, INCOME_ACCOUNT, OVERPAYMENT_ACCOUNT })
|
.withAccountingRulePeriodicAccrual(new Account[] { ASSET_ACCOUNT, EXPENSE_ACCOUNT, INCOME_ACCOUNT, OVERPAYMENT_ACCOUNT })
|
||||||
.withInterestRateFrequencyTypeAsMonths().withAmortizationTypeAsEqualInstallments().withInterestTypeAsDecliningBalance()
|
.withInterestRateFrequencyTypeAsMonths().withAmortizationTypeAsEqualInstallments().withInterestTypeAsDecliningBalance()
|
||||||
.withFeeAndPenaltyAssetAccount(FEE_PENALTY_ACCOUNT).addAdvancedPaymentAllocation(advancedPaymentData).build();
|
.withFeeAndPenaltyAssetAccount(FEE_PENALTY_ACCOUNT).addAdvancedPaymentAllocation(advancedPaymentData)
|
||||||
|
.withLoanScheduleType(LoanScheduleType.PROGRESSIVE).withLoanScheduleProcessingType(LoanScheduleProcessingType.HORIZONTAL)
|
||||||
|
.build();
|
||||||
return loanProductJSON;
|
return loanProductJSON;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,6 +156,8 @@ public class LoanWithAdvancedPaymentAllocationIntegrationTests {
|
|||||||
.withInterestTypeAsDecliningBalance() //
|
.withInterestTypeAsDecliningBalance() //
|
||||||
.withSubmittedOnDate(operationDate) //
|
.withSubmittedOnDate(operationDate) //
|
||||||
.withRepaymentStrategy(ADVANCED_PAYMENT_ALLOCATION_STRATEGY) //
|
.withRepaymentStrategy(ADVANCED_PAYMENT_ALLOCATION_STRATEGY) //
|
||||||
|
.withLoanScheduleType(LoanScheduleType.PROGRESSIVE.toString()) //
|
||||||
|
.withLoanScheduleProcessingType(LoanScheduleProcessingType.HORIZONTAL.toString()) //
|
||||||
.build(clientId, loanProductId, null);
|
.build(clientId, loanProductId, null);
|
||||||
return loanTransactionHelper.getLoanId(loanApplicationJSON);
|
return loanTransactionHelper.getLoanId(loanApplicationJSON);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -49,6 +49,8 @@ import org.apache.fineract.integrationtests.common.charges.ChargesHelper;
|
|||||||
import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
|
import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||||
|
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleProcessingType;
|
||||||
|
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleType;
|
||||||
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
|
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
@@ -227,7 +229,8 @@ public class LoanWriteOffWithAdvancedPaymentAllocationTest {
|
|||||||
String loanProductCreateJSON = new LoanProductTestBuilder().withPrincipal("15,000.00").withNumberOfRepayments("4")
|
String loanProductCreateJSON = new LoanProductTestBuilder().withPrincipal("15,000.00").withNumberOfRepayments("4")
|
||||||
.withRepaymentAfterEvery("1").withRepaymentTypeAsMonth().withinterestRatePerPeriod("1")
|
.withRepaymentAfterEvery("1").withRepaymentTypeAsMonth().withinterestRatePerPeriod("1")
|
||||||
.withInterestRateFrequencyTypeAsMonths().withAmortizationTypeAsEqualInstallments().withInterestTypeAsDecliningBalance()
|
.withInterestRateFrequencyTypeAsMonths().withAmortizationTypeAsEqualInstallments().withInterestTypeAsDecliningBalance()
|
||||||
.addAdvancedPaymentAllocation(advancedPaymentData).build();
|
.addAdvancedPaymentAllocation(advancedPaymentData).withLoanScheduleType(LoanScheduleType.PROGRESSIVE)
|
||||||
|
.withLoanScheduleProcessingType(LoanScheduleProcessingType.HORIZONTAL).build();
|
||||||
return LOAN_TRANSACTION_HELPER.getLoanProductId(loanProductCreateJSON);
|
return LOAN_TRANSACTION_HELPER.getLoanProductId(loanProductCreateJSON);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -498,8 +498,9 @@ public class RefundForActiveLoansWithAdvancedPaymentAllocationTest {
|
|||||||
.withRepaymentStrategy(AdvancedPaymentScheduleTransactionProcessor.ADVANCED_PAYMENT_ALLOCATION_STRATEGY)
|
.withRepaymentStrategy(AdvancedPaymentScheduleTransactionProcessor.ADVANCED_PAYMENT_ALLOCATION_STRATEGY)
|
||||||
.withLoanScheduleType(LoanScheduleType.PROGRESSIVE).withLoanScheduleProcessingType(loanScheduleProcessingType)
|
.withLoanScheduleType(LoanScheduleType.PROGRESSIVE).withLoanScheduleProcessingType(loanScheduleProcessingType)
|
||||||
.withAmortizationTypeAsEqualPrincipalPayment().withInterestTypeAsFlat().withAccountingRulePeriodicAccrual(accounts)
|
.withAmortizationTypeAsEqualPrincipalPayment().withInterestTypeAsFlat().withAccountingRulePeriodicAccrual(accounts)
|
||||||
.addAdvancedPaymentAllocation(defaultAllocation).withDaysInMonth("30").withDaysInYear("365").withMoratorium("0", "0")
|
.addAdvancedPaymentAllocation(defaultAllocation).withLoanScheduleType(LoanScheduleType.PROGRESSIVE)
|
||||||
.build(null);
|
.withLoanScheduleProcessingType(LoanScheduleProcessingType.HORIZONTAL).withDaysInMonth("30").withDaysInYear("365")
|
||||||
|
.withMoratorium("0", "0").build(null);
|
||||||
return loanTransactionHelper.getLoanProductId(loanProductJSON);
|
return loanTransactionHelper.getLoanProductId(loanProductJSON);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -66,6 +66,8 @@ import org.apache.fineract.integrationtests.common.loans.LoanProductHelper;
|
|||||||
import org.apache.fineract.integrationtests.common.loans.LoanTestLifecycleExtension;
|
import org.apache.fineract.integrationtests.common.loans.LoanTestLifecycleExtension;
|
||||||
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
|
||||||
import org.apache.fineract.integrationtests.common.products.DelinquencyBucketsHelper;
|
import org.apache.fineract.integrationtests.common.products.DelinquencyBucketsHelper;
|
||||||
|
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleProcessingType;
|
||||||
|
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleType;
|
||||||
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
|
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
@@ -270,8 +272,9 @@ public class UndoRepaymentWithDownPaymentIntegrationTest {
|
|||||||
.interestType(0)//
|
.interestType(0)//
|
||||||
.isEqualAmortization(false)//
|
.isEqualAmortization(false)//
|
||||||
.interestCalculationPeriodType(1)//
|
.interestCalculationPeriodType(1)//
|
||||||
|
.loanScheduleType(LoanScheduleType.PROGRESSIVE.toString())//
|
||||||
.transactionProcessingStrategyCode("advanced-payment-allocation-strategy")//
|
.transactionProcessingStrategyCode("advanced-payment-allocation-strategy")//
|
||||||
.addPaymentAllocationItem(defaultAllocation)//
|
.loanScheduleProcessingType(LoanScheduleProcessingType.HORIZONTAL.toString()).addPaymentAllocationItem(defaultAllocation)//
|
||||||
.daysInYearType(1)//
|
.daysInYearType(1)//
|
||||||
.daysInMonthType(1)//
|
.daysInMonthType(1)//
|
||||||
.canDefineInstallmentAmount(true)//
|
.canDefineInstallmentAmount(true)//
|
||||||
|
|||||||
+3
-1
@@ -93,7 +93,9 @@ public class JournalEntryHelper {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Assertions.assertTrue(matchFound, "Journal Entry not found");
|
if (entry.getTransactionAmount() > 0) {
|
||||||
|
Assertions.assertTrue(matchFound, "Journal Entry not found");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+20
@@ -59,6 +59,8 @@ public class LoanApplicationTestBuilder {
|
|||||||
private String amortizationType = EQUAL_PRINCIPAL_PAYMENTS;
|
private String amortizationType = EQUAL_PRINCIPAL_PAYMENTS;
|
||||||
private String interestCalculationPeriodType = CALCULATION_PERIOD_SAME_AS_REPAYMENT_PERIOD;
|
private String interestCalculationPeriodType = CALCULATION_PERIOD_SAME_AS_REPAYMENT_PERIOD;
|
||||||
private String transactionProcessingCode = DEFAULT_STRATEGY;
|
private String transactionProcessingCode = DEFAULT_STRATEGY;
|
||||||
|
private String loanScheduleProcessingType = null;
|
||||||
|
private String loanScheduleType = null;
|
||||||
private String expectedDisbursmentDate = "";
|
private String expectedDisbursmentDate = "";
|
||||||
private String submittedOnDate = "";
|
private String submittedOnDate = "";
|
||||||
private String loanType = "individual";
|
private String loanType = "individual";
|
||||||
@@ -158,6 +160,14 @@ public class LoanApplicationTestBuilder {
|
|||||||
map.put("collateral", this.collaterals);
|
map.put("collateral", this.collaterals);
|
||||||
map.put("interestChargedFromDate", this.interestChargedFromDate);
|
map.put("interestChargedFromDate", this.interestChargedFromDate);
|
||||||
|
|
||||||
|
if (loanScheduleType != null) {
|
||||||
|
map.put("loanScheduleType", this.loanScheduleType);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (loanScheduleProcessingType != null) {
|
||||||
|
map.put("loanScheduleProcessingType", this.loanScheduleProcessingType);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.externalId != null) {
|
if (this.externalId != null) {
|
||||||
map.put("externalId", this.externalId);
|
map.put("externalId", this.externalId);
|
||||||
}
|
}
|
||||||
@@ -357,6 +367,16 @@ public class LoanApplicationTestBuilder {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LoanApplicationTestBuilder withLoanScheduleType(final String loanScheduleType) {
|
||||||
|
this.loanScheduleType = loanScheduleType;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LoanApplicationTestBuilder withLoanScheduleProcessingType(final String loanScheduleProcessingType) {
|
||||||
|
this.loanScheduleProcessingType = loanScheduleProcessingType;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public LoanApplicationTestBuilder withFirstRepaymentDate(final String firstRepaymentDate) {
|
public LoanApplicationTestBuilder withFirstRepaymentDate(final String firstRepaymentDate) {
|
||||||
this.repaymentsStartingFromDate = firstRepaymentDate;
|
this.repaymentsStartingFromDate = firstRepaymentDate;
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
+3
-2
@@ -203,6 +203,9 @@ public class LoanProductTestBuilder {
|
|||||||
map.put("maxPrincipal", this.maxPrincipal);
|
map.put("maxPrincipal", this.maxPrincipal);
|
||||||
map.put("isEqualAmortization", this.isEqualAmortization);
|
map.put("isEqualAmortization", this.isEqualAmortization);
|
||||||
map.put("overdueDaysForNPA", this.overdueDaysForNPA);
|
map.put("overdueDaysForNPA", this.overdueDaysForNPA);
|
||||||
|
map.put("loanScheduleType", loanScheduleType);
|
||||||
|
map.put("loanScheduleProcessingType", loanScheduleProcessingType);
|
||||||
|
|
||||||
if (this.minimumDaysBetweenDisbursalAndFirstRepayment != null) {
|
if (this.minimumDaysBetweenDisbursalAndFirstRepayment != null) {
|
||||||
map.put("minimumDaysBetweenDisbursalAndFirstRepayment", this.minimumDaysBetweenDisbursalAndFirstRepayment);
|
map.put("minimumDaysBetweenDisbursalAndFirstRepayment", this.minimumDaysBetweenDisbursalAndFirstRepayment);
|
||||||
}
|
}
|
||||||
@@ -312,8 +315,6 @@ public class LoanProductTestBuilder {
|
|||||||
if (disableScheduleExtensionForDownPayment) {
|
if (disableScheduleExtensionForDownPayment) {
|
||||||
map.put("disableScheduleExtensionForDownPayment", disableScheduleExtensionForDownPayment);
|
map.put("disableScheduleExtensionForDownPayment", disableScheduleExtensionForDownPayment);
|
||||||
}
|
}
|
||||||
map.put("loanScheduleType", loanScheduleType);
|
|
||||||
map.put("loanScheduleProcessingType", loanScheduleProcessingType);
|
|
||||||
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user