Skip to content

Commit a3fdfb9

Browse files
budaidevadamsaghy
authored andcommitted
FINERACT-2312: full term configuration added
1 parent 035b902 commit a3fdfb9

File tree

23 files changed

+492
-100
lines changed

23 files changed

+492
-100
lines changed

fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanApiConstants.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ public interface LoanApiConstants {
195195

196196
String INTEREST_RECOGNITION_ON_DISBURSEMENT_DATE = "interestRecognitionOnDisbursementDate";
197197

198+
String ALLOW_FULL_TERM_FOR_TRANCHE = "allowFullTermForTranche";
199+
198200
// Loan Summary Transaction Types
199201
List<LoanTransactionType> LOAN_SUMMARY_TRANSACTION_TYPES = List.of(LoanTransactionType.CHARGE_ADJUSTMENT, //
200202
LoanTransactionType.CHARGEBACK, //

fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanAccountData.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ public class LoanAccountData {
269269
private Boolean enableInstallmentLevelDelinquency;
270270
private LocalDate lastClosedBusinessDate;
271271
private Boolean chargedOff;
272+
private Boolean allowFullTermForTranche;
272273

273274
private Boolean enableDownPayment;
274275
private BigDecimal disbursedAmountPercentageForDownPayment;
@@ -480,12 +481,12 @@ public static LoanAccountData basicLoanDetails(final Long id, final String accou
480481
final BigDecimal disbursedAmountPercentageForDownPayment, final boolean enableAutoRepaymentForDownPayment,
481482
final boolean enableInstallmentLevelDelinquency, final EnumOptionData loanScheduleType,
482483
final EnumOptionData loanScheduleProcessingType, final Integer fixedLength, final StringEnumOptionData chargeOffBehaviour,
483-
final boolean isInterestRecognitionOnDisbursementDate, final StringEnumOptionData daysInYearCustomStrategy,
484-
final boolean enableIncomeCapitalization, final StringEnumOptionData capitalizedIncomeCalculationType,
485-
final StringEnumOptionData capitalizedIncomeStrategy, StringEnumOptionData capitalizedIncomeType,
486-
final boolean enableBuyDownFee, final StringEnumOptionData buyDownFeeCalculationType,
487-
final StringEnumOptionData buyDownFeeStrategy, final StringEnumOptionData buyDownFeeIncomeType,
488-
final boolean merchantBuyDownFee) {
484+
final boolean isInterestRecognitionOnDisbursementDate, final boolean allowFullTermForTranche,
485+
final StringEnumOptionData daysInYearCustomStrategy, final boolean enableIncomeCapitalization,
486+
final StringEnumOptionData capitalizedIncomeCalculationType, final StringEnumOptionData capitalizedIncomeStrategy,
487+
StringEnumOptionData capitalizedIncomeType, final boolean enableBuyDownFee,
488+
final StringEnumOptionData buyDownFeeCalculationType, final StringEnumOptionData buyDownFeeStrategy,
489+
final StringEnumOptionData buyDownFeeIncomeType, final boolean merchantBuyDownFee) {
489490

490491
final CollectionData delinquent = CollectionData.template();
491492

@@ -531,7 +532,8 @@ public static LoanAccountData basicLoanDetails(final Long id, final String accou
531532
.setEnableInstallmentLevelDelinquency(enableInstallmentLevelDelinquency).setLoanScheduleType(loanScheduleType)
532533
.setLoanScheduleProcessingType(loanScheduleProcessingType).setFixedLength(fixedLength)
533534
.setChargeOffBehaviour(chargeOffBehaviour).setInterestRecognitionOnDisbursementDate(isInterestRecognitionOnDisbursementDate)
534-
.setDaysInYearCustomStrategy(daysInYearCustomStrategy).setEnableIncomeCapitalization(enableIncomeCapitalization)
535+
.setAllowFullTermForTranche(allowFullTermForTranche).setDaysInYearCustomStrategy(daysInYearCustomStrategy)
536+
.setEnableIncomeCapitalization(enableIncomeCapitalization)
535537
.setCapitalizedIncomeCalculationType(capitalizedIncomeCalculationType)
536538
.setCapitalizedIncomeStrategy(capitalizedIncomeStrategy).setCapitalizedIncomeType(capitalizedIncomeType)
537539
.setEnableBuyDownFee(enableBuyDownFee).setBuyDownFeeCalculationType(buyDownFeeCalculationType)

fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,9 @@ public class Loan extends AbstractAuditableWithUTCDateTimeCustom<Long> {
427427
@Column(name = "enable_installment_level_delinquency", nullable = false)
428428
private boolean enableInstallmentLevelDelinquency = false;
429429

430+
@Column(name = "allow_full_term_for_tranche", nullable = false)
431+
private boolean allowFullTermForTranche = false;
432+
430433
public static Loan newIndividualLoanApplication(final String accountNo, final Client client, final AccountType loanType,
431434
final LoanProduct loanProduct, final Fund fund, final Staff officer, final CodeValue loanPurpose,
432435
final LoanRepaymentScheduleTransactionProcessor transactionProcessingStrategy,
@@ -436,12 +439,12 @@ public static Loan newIndividualLoanApplication(final String accountNo, final Cl
436439
final Boolean createStandingInstructionAtDisbursement, final Boolean isFloatingInterestRate,
437440
final BigDecimal interestRateDifferential, final List<Rate> rates, final BigDecimal fixedPrincipalPercentagePerInstallment,
438441
final ExternalId externalId, final LoanApplicationTerms loanApplicationTerms, final Boolean enableInstallmentLevelDelinquency,
439-
final LocalDate submittedOnDate) {
442+
final LocalDate submittedOnDate, final Boolean allowFullTermForTranche) {
440443
return new Loan(accountNo, client, null, loanType, fund, officer, loanPurpose, transactionProcessingStrategy, loanProduct,
441444
loanRepaymentScheduleDetail, null, loanCharges, collateral, null, fixedEmiAmount, disbursementDetails,
442445
maxOutstandingLoanBalance, createStandingInstructionAtDisbursement, isFloatingInterestRate, interestRateDifferential, rates,
443446
fixedPrincipalPercentagePerInstallment, externalId, loanApplicationTerms, enableInstallmentLevelDelinquency,
444-
submittedOnDate);
447+
submittedOnDate, allowFullTermForTranche);
445448
}
446449

447450
public static Loan newGroupLoanApplication(final String accountNo, final Group group, final AccountType loanType,
@@ -453,12 +456,12 @@ public static Loan newGroupLoanApplication(final String accountNo, final Group g
453456
final Boolean createStandingInstructionAtDisbursement, final Boolean isFloatingInterestRate,
454457
final BigDecimal interestRateDifferential, final List<Rate> rates, final BigDecimal fixedPrincipalPercentagePerInstallment,
455458
final ExternalId externalId, final LoanApplicationTerms loanApplicationTerms, final Boolean enableInstallmentLevelDelinquency,
456-
final LocalDate submittedOnDate) {
459+
final LocalDate submittedOnDate, final Boolean allowFullTermForTranche) {
457460
return new Loan(accountNo, null, group, loanType, fund, officer, loanPurpose, transactionProcessingStrategy, loanProduct,
458461
loanRepaymentScheduleDetail, null, loanCharges, null, syncDisbursementWithMeeting, fixedEmiAmount, disbursementDetails,
459462
maxOutstandingLoanBalance, createStandingInstructionAtDisbursement, isFloatingInterestRate, interestRateDifferential, rates,
460463
fixedPrincipalPercentagePerInstallment, externalId, loanApplicationTerms, enableInstallmentLevelDelinquency,
461-
submittedOnDate);
464+
submittedOnDate, allowFullTermForTranche);
462465
}
463466

464467
public static Loan newIndividualLoanApplicationFromGroup(final String accountNo, final Client client, final Group group,
@@ -470,12 +473,12 @@ public static Loan newIndividualLoanApplicationFromGroup(final String accountNo,
470473
final Boolean createStandingInstructionAtDisbursement, final Boolean isFloatingInterestRate,
471474
final BigDecimal interestRateDifferential, final List<Rate> rates, final BigDecimal fixedPrincipalPercentagePerInstallment,
472475
final ExternalId externalId, final LoanApplicationTerms loanApplicationTerms, final Boolean enableInstallmentLevelDelinquency,
473-
final LocalDate submittedOnDate) {
476+
final LocalDate submittedOnDate, final Boolean allowFullTermForTranche) {
474477
return new Loan(accountNo, client, group, loanType, fund, officer, loanPurpose, transactionProcessingStrategy, loanProduct,
475478
loanRepaymentScheduleDetail, null, loanCharges, null, syncDisbursementWithMeeting, fixedEmiAmount, disbursementDetails,
476479
maxOutstandingLoanBalance, createStandingInstructionAtDisbursement, isFloatingInterestRate, interestRateDifferential, rates,
477480
fixedPrincipalPercentagePerInstallment, externalId, loanApplicationTerms, enableInstallmentLevelDelinquency,
478-
submittedOnDate);
481+
submittedOnDate, allowFullTermForTranche);
479482
}
480483

481484
protected Loan() {
@@ -491,7 +494,7 @@ private Loan(final String accountNo, final Client client, final Group group, fin
491494
final Boolean createStandingInstructionAtDisbursement, final Boolean isFloatingInterestRate,
492495
final BigDecimal interestRateDifferential, final List<Rate> rates, final BigDecimal fixedPrincipalPercentagePerInstallment,
493496
final ExternalId externalId, final LoanApplicationTerms loanApplicationTerms, final Boolean enableInstallmentLevelDelinquency,
494-
final LocalDate submittedOnDate) {
497+
final LocalDate submittedOnDate, final Boolean allowFullTermForTranche) {
495498
this.loanRepaymentScheduleDetail = loanRepaymentScheduleDetail;
496499

497500
this.isFloatingInterestRate = isFloatingInterestRate;
@@ -572,6 +575,7 @@ private Loan(final String accountNo, final Client client, final Group group, fin
572575
this.loanInterestRecalculationDetails.updateLoan(this);
573576
}
574577
this.enableInstallmentLevelDelinquency = enableInstallmentLevelDelinquency;
578+
this.allowFullTermForTranche = allowFullTermForTranche;
575579
this.getLoanProductRelatedDetail()
576580
.setEnableAccrualActivityPosting(loanProduct.getLoanProductRelatedDetail().isEnableAccrualActivityPosting());
577581
}
@@ -1783,6 +1787,14 @@ public void updateEnableInstallmentLevelDelinquency(boolean enableInstallmentLev
17831787
this.enableInstallmentLevelDelinquency = enableInstallmentLevelDelinquency;
17841788
}
17851789

1790+
public boolean isAllowFullTermForTranche() {
1791+
return this.allowFullTermForTranche;
1792+
}
1793+
1794+
public void updateAllowFullTermForTranche(boolean allowFullTermForTranche) {
1795+
this.allowFullTermForTranche = allowFullTermForTranche;
1796+
}
1797+
17861798
public void deductFromNetDisbursalAmount(final BigDecimal subtrahend) {
17871799
this.netDisbursalAmount = this.netDisbursalAmount.subtract(subtrahend);
17881800
}

fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/LoanProductConstants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public interface LoanProductConstants {
7272
String MULTI_DISBURSE_LOAN_PARAMETER_NAME = "multiDisburseLoan";
7373
String MAX_TRANCHE_COUNT_PARAMETER_NAME = "maxTrancheCount";
7474
String OUTSTANDING_LOAN_BALANCE_PARAMETER_NAME = "outstandingLoanBalance";
75+
String ALLOW_FULL_TERM_FOR_TRANCHE_PARAM_NAME = "allowFullTermForTranche";
7576

7677
String GRACE_ON_ARREARS_AGEING_PARAMETER_NAME = "graceOnArrearsAgeing";
7778
String OVERDUE_DAYS_FOR_NPA_PARAMETER_NAME = "overdueDaysForNPA";

fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/api/LoanProductsApiResourceSwagger.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,8 @@ private PostLoanProductsRequest() {}
309309
// Multi Disburse
310310
@Schema(example = "true")
311311
public Boolean multiDisburseLoan;
312+
@Schema(example = "false", description = "Allow full term length for each tranche disbursement. Only available for PROGRESSIVE schedule type with multi-disbursement enabled.")
313+
public Boolean allowFullTermForTranche;
312314
@Schema(example = "50")
313315
public Integer principalThresholdForLastInstallment;
314316
@Schema(example = "true")
@@ -1481,6 +1483,8 @@ private GetWriteOffReasonToExpenseAccountMappings() {}
14811483
public Boolean isRatesEnabled;
14821484
@Schema(example = "true")
14831485
public Boolean multiDisburseLoan;
1486+
@Schema(example = "false", description = "Allow full term length for each tranche disbursement. Only available for PROGRESSIVE schedule type with multi-disbursement enabled.")
1487+
public Boolean allowFullTermForTranche;
14841488
@Schema(example = "3")
14851489
public Integer maxTrancheCount;
14861490
@Schema(example = "36000.000000")
@@ -1794,6 +1798,8 @@ private PutLoanProductsProductIdRequest() {}
17941798
// Multi Disburse
17951799
@Schema(example = "true")
17961800
public Boolean multiDisburseLoan;
1801+
@Schema(example = "false", description = "Allow full term length for each tranche disbursement. Only available for PROGRESSIVE schedule type with multi-disbursement enabled.")
1802+
public Boolean allowFullTermForTranche;
17971803
@Schema(example = "50")
17981804
public Integer principalThresholdForLastInstallment;
17991805
@Schema(example = "true")

0 commit comments

Comments
 (0)