WEB-536:fix: resolve chargeIds parameter error in penalty waiving (#2957)
This commit is contained in:
+16
-2
@@ -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:
|
||||
|
||||
+16
-2
@@ -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 });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user