@mbanq/core-sdk-js / commands / GetLoanWriteoffTemplate
Function: GetLoanWriteoffTemplate()
GetLoanWriteoffTemplate(
loanId):Command<{loanId:number; }, {amount:number;currency: {code:string;currencyCodeInDigit:number;decimalPlaces:number;displayLabel:string;displaySymbol:string;inMultiplesOf:number;isBaseCurrency:boolean;name:string;nameCode:string; };date:number[];feeChargesPortion?:number;fixedEmiAmount?:number;interestPortion?:number;isRevolvingLoan?:boolean;loanWriteOffReasonOptions:object[];manuallyReversed?:boolean;outstandingLoanBalance?:number;overpaymentPortion?:number;penaltyChargesPortion?:number;principalPortion?:number;type: {accrual:boolean;approveTransfer:boolean;chargePayment:boolean;code:string;contra:boolean;disbursement:boolean;id:number;initiateTransfer:boolean;recoveryRepayment:boolean;refund:boolean;refundForActiveLoans:boolean;rejectTransfer:boolean;repayment:boolean;repaymentAtDisbursement:boolean;value:string;waiveCharges:boolean;waiveInterest:boolean;withdrawTransfer:boolean;writeOff:boolean; };unrecognizedIncomePortion?:number; }>
Defined in: src/commands/rest/loan.ts:680
Retrieves the loan write-off template for a specific loan. This template provides the necessary fields and reason options required to process a loan write-off.
Parameters
loanId
number
The unique identifier of the loan for which the write-off template is being requested
Returns
Command<{ loanId: number; }, { amount: number; currency: { code: string; currencyCodeInDigit: number; decimalPlaces: number; displayLabel: string; displaySymbol: string; inMultiplesOf: number; isBaseCurrency: boolean; name: string; nameCode: string; }; date: number[]; feeChargesPortion?: number; fixedEmiAmount?: number; interestPortion?: number; isRevolvingLoan?: boolean; loanWriteOffReasonOptions: object[]; manuallyReversed?: boolean; outstandingLoanBalance?: number; overpaymentPortion?: number; penaltyChargesPortion?: number; principalPortion?: number; type: { accrual: boolean; approveTransfer: boolean; chargePayment: boolean; code: string; contra: boolean; disbursement: boolean; id: number; initiateTransfer: boolean; recoveryRepayment: boolean; refund: boolean; refundForActiveLoans: boolean; rejectTransfer: boolean; repayment: boolean; repaymentAtDisbursement: boolean; value: string; waiveCharges: boolean; waiveInterest: boolean; withdrawTransfer: boolean; writeOff: boolean; }; unrecognizedIncomePortion?: number; }>
A Command that when executed returns the write-off template with transaction details and reason options
Example
const writeoffTemplateCmd = GetLoanWriteoffTemplate(12345);
const result = await writeoffTemplateCmd.execute(config);
console.log('Transaction type:', result.type.value); // "Close (as written-off)"
console.log('Amount to write off:', result.amount); // 977.01
console.log('Outstanding balance:', result.outstandingLoanBalance); // 0
console.log('Write-off reasons:', result.loanWriteOffReasonOptions);
// Example reasons:
// [
// { id: 7119, name: "Legal Settlement or Court Order", ... },
// { id: 7120, name: "Government Loan Waiver Programs", ... }
// ]