@mbanq/core-sdk-js / commands / WriteLoanOff
Function: WriteLoanOff()
WriteLoanOff(
loanId,data):Command<{data: {dateFormat:string;locale:string;transactionDate:string;writeoffReasonCodeId:number; };loanId:number; }, {changes: {closedOnDate:string;dateFormat:string;locale:string;status: {active:boolean;closed:boolean;closedObligationsMet:boolean;closedRescheduled:boolean;closedWrittenOff:boolean;code:string;id:number;overpaid:boolean;pendingApproval:boolean;value:string;waitingForDisbursal:boolean; };transactionDate:string;writeoffReason: {codeName:string;id:number;name:string; };writtenOffOnDate:string; };clientId:number;id:string|number;loanId:number;officeId:number;resourceId:string|number; }>
Defined in: src/commands/rest/loan.ts:727
Writes off a loan that is considered unrecoverable. This formally removes the loan from the lender's balance sheet when it's determined the loan cannot be recovered.
Parameters
loanId
number
The unique identifier of the loan to be written off
data
dateFormat
string = ...
locale
string = ...
transactionDate
string = ...
writeoffReasonCodeId
number = ...
Returns
Command<{ data: { dateFormat: string; locale: string; transactionDate: string; writeoffReasonCodeId: number; }; loanId: number; }, { changes: { closedOnDate: string; dateFormat: string; locale: string; status: { active: boolean; closed: boolean; closedObligationsMet: boolean; closedRescheduled: boolean; closedWrittenOff: boolean; code: string; id: number; overpaid: boolean; pendingApproval: boolean; value: string; waitingForDisbursal: boolean; }; transactionDate: string; writeoffReason: { codeName: string; id: number; name: string; }; writtenOffOnDate: string; }; clientId: number; id: string | number; loanId: number; officeId: number; resourceId: string | number; }>
A Command that when executed returns the write-off confirmation with status and dates
Example
const writeoffCmd = WriteLoanOff(3104, {
locale: "en",
dateFormat: "dd MMMM yyyy",
transactionDate: "30 March 2025",
writeoffReasonCodeId: 4001
});
const result = await writeoffCmd.execute(config);
console.log('Loan status:', result.changes.status.value); // "Closed (written off)"
console.log('Written off on:', result.changes.writtenOffOnDate); // "30 March 2025"
console.log('Reason:', result.changes.writeoffReason.name); // "Legal Settlement or Court Order"