Skip to content

@mbanq/core-sdk-js v0.50.0


@mbanq/core-sdk-js / commands / PreCloseLoan

Function: PreCloseLoan()

PreCloseLoan(loanId, data): Command<{ data: { dateFormat: string; locale: string; preclosureReasonCodeId: number; transactionDate: string; }; loanId: number; }, { changes: object & object; loanId: number; transactions?: any[]; }>

Defined in: src/commands/rest/loan.ts:590

Pre-closes a loan by making an early repayment of the entire outstanding loan amount. This is used when the borrower wants to pay off the loan before the scheduled tenure ends.

Parameters

loanId

number

The unique identifier of the loan for which preclosure is being requested

data

dateFormat

string = ...

locale

string = ...

preclosureReasonCodeId

number = ...

transactionDate

string = ...

Returns

Command<{ data: { dateFormat: string; locale: string; preclosureReasonCodeId: number; transactionDate: string; }; loanId: number; }, { changes: object & object; loanId: number; transactions?: any[]; }>

A Command that when executed returns the preclosure response with transaction details and changes

Example

typescript
const preCloseLoanCmd = PreCloseLoan(12765, {
  dateFormat: "dd MMMM yyyy",
  locale: "en",
  transactionDate: "02 August 2024",
  preclosureReasonCodeId: 3100
});
const result = await preCloseLoanCmd.execute(config);
console.log(result.loanId); // 12765
console.log(result.changes.transactionDate); // [2024, 8, 2]
console.log(result.changes.eventAmount); // -1600

Released under the MIT License.