Skip to content

Commit

Permalink
FINERACT-1981: Introduce Interest should not be calculated on past du…
Browse files Browse the repository at this point in the history
…e principal amount on API
  • Loading branch information
janez89 committed Nov 26, 2024
1 parent c2d72c9 commit bd6c392
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = [];
Expand All @@ -21,8 +21,4 @@ export class LoanTermVariationsTabComponent implements OnInit {
});
this.loanId = this.route.parent.parent.snapshot.params['loanId'];
}

ngOnInit(): void {
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -542,15 +542,19 @@ <h3 class="mat-h3" fxFlexFill>{{ 'labels.heading.Interest Recalculation' | trans
<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>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,10 @@ <h3 fxFlex="96%" class="mat-h3">{{'labels.heading.Interest Recalculation' | tran
{{'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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ export class LoanProductSettingsStepComponent implements OnInit {
this.loanProductSettingsForm.removeControl('recalculationRestFrequencyType');
this.loanProductSettingsForm.removeControl('isArrearsBasedOnOriginalSchedule');
}
this.enableFieldsWhenScheduleTypeIsProgressiveAndInterestRateRecalculationEnabled();
});

this.loanProductSettingsForm.get('holdGuaranteeFunds').valueChanges
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 2 additions & 0 deletions src/app/products/loan-products/models/loan-product.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export interface LoanProduct {
recalculationCompoundingFrequencyType?: number;
recalculationRestFrequencyType?: number;
allowCompoundingOnEod?: boolean;
disallowInterestCalculationOnPastDue?: boolean;
isArrearsBasedOnOriginalSchedule?: boolean;
isCompoundingToBePostedAsTransaction?: boolean;
recalculationRestFrequencyInterval?: number;
Expand Down Expand Up @@ -168,4 +169,5 @@ export interface InterestRecalculationData {
isCompoundingToBePostedAsTransaction: boolean;
preClosureInterestCalculationStrategy: OptionData;
allowCompoundingOnEod: boolean;
disallowInterestCalculationOnPastDue: boolean;
}
1 change: 1 addition & 0 deletions src/assets/translations/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -1506,6 +1506,7 @@
"Dividend Period End Date": "Dividend Period End Date",
"Dividend Period Start Date": "Dividend Period Start Date",
"Dividends": "Dividends",
"Do not calculate interest on past due principal balances": "Do not calculate interest on past due principal balances",
"Documents": "Documents",
"Document Key": "Document Key",
"Document Type": "Document Type",
Expand Down

0 comments on commit bd6c392

Please sign in to comment.