WEB-536:fix: resolve chargeIds parameter error in penalty waiving (#2957)

This commit is contained in:
Shubham Kumar
2026-01-01 15:43:32 -06:00
committed by GitHub
parent b00c60ef27
commit c28f729363
3 changed files with 60 additions and 6 deletions
@@ -126,11 +126,25 @@ export class LoanRescheduleComponent implements OnInit {
};
data.loanId = this.loanId;
// Add waived penalty charge IDs if penalties are being waived
// Waive penalties first if selected, then submit reschedule
if (this.waivePenalties.value && this.selectedPenalties.length > 0) {
data.chargeIds = this.selectedPenalties;
this.penaltyManagementService.waivePenalties(this.loanId, this.selectedPenalties).subscribe({
next: () => {
this.submitReschedule(data);
},
error: (error: any) => {
console.error('Error waiving penalties:', error);
// Continue with reschedule even if waive fails
this.submitReschedule(data);
}
});
} else {
this.submitReschedule(data);
}
}
/** Submit the reschedule after penalties are waived */
private submitReschedule(data: any) {
this.loanService.submitRescheduleData(data).subscribe((response: any) => {
// TODO: needs to be updated
// mentioned in Community App:
@@ -326,11 +326,25 @@ export class MakeRepaymentComponent implements OnInit {
}
delete data.skipInterestRefund;
// Add waived penalty charge IDs if penalties are being waived
// Waive penalties first if selected, then submit repayment
if (this.waivePenalties && this.selectedPenalties.length > 0) {
data.chargeIds = this.selectedPenalties;
this.penaltyManagementService.waivePenalties(this.loanId, this.selectedPenalties).subscribe({
next: () => {
this.submitRepayment(data);
},
error: (error: any) => {
console.error('Error waiving penalties:', error);
// Continue with repayment even if waive fails
this.submitRepayment(data);
}
});
} else {
this.submitRepayment(data);
}
}
/** Submit the repayment after penalties are waived */
private submitRepayment(data: any) {
this.loanService.submitLoanActionButton(this.loanId, data, this.command).subscribe((response: any) => {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
});