FINERACT-1981: Introduce Interest should not be calculated on past due principal amount on API

This commit is contained in:
Janos Meszaros
2024-11-28 10:07:42 +01:00
committed by Adam Saghy
parent 6411a598de
commit ffe5c98e85
18 changed files with 45 additions and 9 deletions
@@ -6,7 +6,7 @@ import { ActivatedRoute } from '@angular/router';
templateUrl: './loan-term-variations-tab.component.html',
styleUrls: ['./loan-term-variations-tab.component.scss']
})
export class LoanTermVariationsTabComponent implements OnInit {
export class LoanTermVariationsTabComponent {
/** Loan Details Data */
loanTermVariationsData: any[] = [];
@@ -21,8 +21,4 @@ export class LoanTermVariationsTabComponent implements OnInit {
});
this.loanId = this.route.parent.parent.snapshot.params['loanId'];
}
ngOnInit(): void {
}
}
@@ -542,15 +542,19 @@
<div fxFlexFill *ngIf="loanProduct.interestRecalculationData.recalculationRestFrequencyType.id !== 1"
fxLayout="row wrap" fxLayout.lt-md="column">
<span fxFlex="47%">{{ 'labels.inputs.Frequency Interval for recalculation' | translate}}:</span>
<span fxFlex="53%">{{ loanProduct.interestRecalculationData.recalculationRestFrequencyInterval }}</span>
<span fxFlex="53%">{{ loanProduct.interestRecalculationData.recalculationRestFrequencyInterval }}</span>
<div fxFlexFill *ngIf="loanProduct.recalculationRestFrequencyDate">
<span fxFlex="47%">{{ 'labels.inputs.Rest Frequency Date' | translate}}:</span>
<span fxFlex="53%">{{ loanProduct.interestRecalculationData.recalculationRestFrequencyDate }}</span>
<span fxFlex="53%">{{ loanProduct.interestRecalculationData.recalculationRestFrequencyDate }}</span>
</div>
</div>
<div fxFlexFill>
<span fxFlex="47%">{{ 'labels.inputs.Is Arrears recognization based on original schedule' | translate}}:</span>
<span fxFlex="53%">{{ loanProduct.isArrearsBasedOnOriginalSchedule | yesNo }}</span>
<span fxFlex="53%">{{ loanProduct.interestRecalculationData.isArrearsBasedOnOriginalSchedule | yesNo }}</span>
</div>
<div fxFlexFill *ngIf="loanProduct.loanScheduleType.code === 'PROGRESSIVE'">
<span fxFlex="47%">{{ 'labels.inputs.Do not calculate interest on past due principal balances' | translate}}:</span>
<span fxFlex="53%">{{ loanProduct.interestRecalculationData.disallowInterestCalculationOnPastDue | yesNo }}</span>
</div>
</div>
@@ -160,7 +160,8 @@ export class LoanProductSummaryComponent implements OnInit, OnChanges {
allowCompoundingOnEod: this.loanProduct.allowCompoundingOnEod,
isArrearsBasedOnOriginalSchedule: this.loanProduct.isArrearsBasedOnOriginalSchedule,
isCompoundingToBePostedAsTransaction: this.loanProduct.isCompoundingToBePostedAsTransaction,
recalculationRestFrequencyInterval: this.loanProduct.recalculationRestFrequencyInterval
recalculationRestFrequencyInterval: this.loanProduct.recalculationRestFrequencyInterval,
disallowInterestCalculationOnPastDue: this.loanProduct.disallowInterestCalculationOnPastDue,
};
}
@@ -433,6 +433,10 @@
{{'labels.inputs.Is Arrears recognization based on original schedule' | translate}}?
</mat-checkbox>
<mat-checkbox *ngIf="loanProductSettingsForm.value.loanScheduleType === 'PROGRESSIVE'" fxFlex="98%" labelPosition="before" formControlName="disallowInterestCalculationOnPastDue" class="margin-v">
{{'labels.inputs.Do not calculate interest on past due principal balances' | translate}}
</mat-checkbox>
</div>
<mat-divider fxFlex="98%"></mat-divider>
@@ -370,6 +370,7 @@ export class LoanProductSettingsStepComponent implements OnInit {
this.loanProductSettingsForm.removeControl('recalculationRestFrequencyType');
this.loanProductSettingsForm.removeControl('isArrearsBasedOnOriginalSchedule');
}
this.enableFieldsWhenScheduleTypeIsProgressiveAndInterestRateRecalculationEnabled();
});
this.loanProductSettingsForm.get('holdGuaranteeFunds').valueChanges
@@ -491,9 +492,25 @@ export class LoanProductSettingsStepComponent implements OnInit {
this.setRescheduleStrategies();
}
this.processingStrategyService.initialize(this.isAdvancedTransactionProcessingStrategy);
this.enableFieldsWhenScheduleTypeIsProgressiveAndInterestRateRecalculationEnabled();
});
}
private enableFieldsWhenScheduleTypeIsProgressiveAndInterestRateRecalculationEnabled() {
const isProgressiveLoan = this.loanProductSettingsForm.get('loanScheduleType').value === LoanProducts.LOAN_SCHEDULE_TYPE_PROGRESSIVE;
const isInterestRecalculationEnabled = this.loanProductSettingsForm.get('isInterestRecalculationEnabled').value == true;
const shouldControlExists = isProgressiveLoan && isInterestRecalculationEnabled;
const isControlExists = this.loanProductSettingsForm.contains('disallowInterestCalculationOnPastDue');
if (shouldControlExists && !isControlExists) {
this.loanProductSettingsForm.addControl('disallowInterestCalculationOnPastDue', new UntypedFormControl(''));
this.loanProductSettingsForm.patchValue({'disallowInterestCalculationOnPastDue': this.loanProductsTemplate.interestRecalculationData?.disallowInterestCalculationOnPastDue ?? false});
} else if (isControlExists && !shouldControlExists) {
this.loanProductSettingsForm.patchValue({'disallowInterestCalculationOnPastDue': undefined });
this.loanProductSettingsForm.removeControl('disallowInterestCalculationOnPastDue');
}
}
private setRescheduleStrategies() {
if (this.advancedTransactionProcessingStrategyDisabled) {
this.rescheduleStrategyTypeData = this.rescheduleStrategyTypeDataBase.filter(
@@ -52,6 +52,7 @@ export interface LoanProduct {
recalculationCompoundingFrequencyType?: number;
recalculationRestFrequencyType?: number;
allowCompoundingOnEod?: boolean;
disallowInterestCalculationOnPastDue?: boolean;
isArrearsBasedOnOriginalSchedule?: boolean;
isCompoundingToBePostedAsTransaction?: boolean;
recalculationRestFrequencyInterval?: number;
@@ -168,4 +169,5 @@ export interface InterestRecalculationData {
isCompoundingToBePostedAsTransaction: boolean;
preClosureInterestCalculationStrategy: OptionData;
allowCompoundingOnEod: boolean;
disallowInterestCalculationOnPastDue: boolean;
}