WEB-255: Disable automatic Interest Refund calculation

This commit is contained in:
mariiaKraievska
2025-07-11 17:08:41 +03:00
parent a08af7139a
commit 2ed69b2a9b
16 changed files with 44 additions and 15 deletions
@@ -118,6 +118,10 @@
<mat-label> {{ 'labels.inputs.Note' | translate }}</mat-label>
<textarea matInput formControlName="note" cdkTextareaAutosize cdkAutosizeMinRows="2"></textarea>
</mat-form-field>
<mat-checkbox formControlName="skipInterestRefund" *ngIf="showInterestRefundCheckbox()">
{{ 'labels.inputs.Skip Interest Refund Transaction Posting' | translate }}
</mat-checkbox>
</div>
<mat-card-actions class="layout-row align-center gap-5px responsive-column">
@@ -92,7 +92,8 @@ export class MakeRepaymentComponent implements OnInit {
],
externalId: '',
paymentTypeId: '',
note: ''
note: '',
skipInterestRefund: [false]
});
if (this.isCapitalizedIncome()) {
@@ -157,6 +158,11 @@ export class MakeRepaymentComponent implements OnInit {
].includes(this.command);
}
showInterestRefundCheckbox(): boolean {
const code = this.dataObject?.type?.code?.toLowerCase() || '';
return code.includes('merchantissuedrefund') || code.includes('payoutrefund');
}
/** Submits the repayment form */
submit() {
const repaymentLoanFormData = this.repaymentLoanForm.value;
@@ -166,12 +172,16 @@ export class MakeRepaymentComponent implements OnInit {
if (repaymentLoanFormData.transactionDate instanceof Date) {
repaymentLoanFormData.transactionDate = this.dateUtils.formatDate(prevTransactionDate, dateFormat);
}
const data = {
const data: any = {
...repaymentLoanFormData,
dateFormat,
locale
};
data['transactionAmount'] = data['transactionAmount'] * 1;
if (repaymentLoanFormData.skipInterestRefund) {
data.interestRefundCalculation = false;
}
delete data.skipInterestRefund;
this.loanService.submitLoanActionButton(this.loanId, data, this.command).subscribe((response: any) => {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
});
+2
View File
@@ -12,6 +12,7 @@ import { MatSelect } from '@angular/material/select';
import { MatOption } from '@angular/material/core';
import { MatDatepickerInput, MatDatepickerToggle, MatDatepicker } from '@angular/material/datepicker';
import { MatButton } from '@angular/material/button';
import { MatCheckbox } from '@angular/material/checkbox';
import { DateFormatPipe } from '@pipes/date-format.pipe';
import { TranslatePipe as NgxTranslatePipe } from '@ngx-translate/core';
import { TranslatePipe } from '@pipes/translate.pipe';
@@ -39,6 +40,7 @@ export const STANDALONE_SHARED_IMPORTS = [
MatDatepickerToggle,
MatDatepicker,
MatButton,
MatCheckbox,
DateFormatPipe,
HasPermissionDirective,