The client ID of the Encompass instance to connect to.
The Encompass instance ID of the instance to connect to.
The password of the account to retrieve tokens with. Only stores the value provided to the constructor.
The bearer token that is used to authenticate each request to the Encompas API. The same token will be reused
until either a 401
is returned, or the value is overwritten with the setToken()
or getToken()
methods.
The domain of the Encompass API.
The username of the account to retrieve tokens with. Only stores the value provided to the constructor.
The version of the Encompass API to send requests to. Defaults to 1
.
The batch update API allows your to apply the same loan data to multiple loans and can be invoked with batchLoanUpdate()
method.
This method returns an object that with it's own functionality to check the status of batch update, or to get the request ID if needed.
Just like viewing a pipeline, either a filter or an array of lan GUIDs can be provided.
const updateData: BatchLoanUpdateContract = {
loanGuids: [
// array of loan GUIDs to update
],
loanData: {
// contract of the loan data to apply to each loan
},
};
const exampleBatchUpdate: BatchUpdate = await encompass.batchLoanUpdate(updateData);
// the return value can be used to check the status:
const latestStatus: BatchUpdateStatus = await exampleBatchUpdate.getUpdateStatus();
console.log(latestStatus.status) // 'done' or 'error'
// or if needed you can get the request ID itself:
const exampleBatchUpdateId: string = exampleBatchUpdate.getRequestId();
Returns the result of the 'Get Canonical Names' endpoint.
Exchanges the provided username and password for a bearer token and stores it to the #token
property of the instance.
If no username and password are provided, it will fallback to the username and password values provided to the constructor.
Calls the token introspection API with the provided token. If a token is not provided, it will introspect the token stored to the #token
property of the instance as a fallback.
If the introspection returns a valid token, it will return the response body of the request, if the token is invalid, returns null
.
If an API is not available through an explicit method in this class, the request()
method is a wrapper around fetch that allows you to request any Encompass API endpoint.
It takes in the same arguments as any fetch API, with the exception that the first argument is appended as a path to the Encompass API domain.
// hitting the Get Custom Fields API:
const customFieldsResponse: Response = await encompass.request('/settings/loan/customFields');
const data = await customFieldsResponse.json();
console.log(data);
// or update a contact:
const options: RequestInit = {
method: 'POST',
body: {
firstname: 'contact first name',
lastname: 'contact last name',
},
};
await encompass.request('/businessContacts/<some-contact-id>', options);
Replaces the #token
property with the provided token value. The instance can be implicitly 'logged out' by setting this value to null
(if it was not provided a username and password in the constructor).
Generate a pipeline view by calling the viewPipeline()
method. This method has one required argument, a PipeLineContract
, and can optionally take a limit value as the second argument:
// a pipelineContract expects either a loanGuids array, or a filter object:
const commonFilterValues = {
sortOrder: [
{
canonicalName: 'Loan.LastModified',
order: 'desc'
}
],
fields: [
"Loan.LoanAmount",
"Fields.4002"
],
};
const pipelineWithGuids: LoanGuidsPipeLineContract = {
...commonFilterValues,
loanGuids: [
'some-loan-guid-1',
'some-loan-guid-2',
],
};
const pipelineWithFilter: FilterPipeLineContract = {
...commonFilterValues,
filter: {
operator: 'and',
terms: [
{
canonicalName: "Loan.LastModified",
matchType: "greaterThanOrEquals",
value: new Date()
},
{
canonicalName: "Loan.LoanFolder",
matchType: "exact",
value: "My Pipeline"
}
]
},
};
const pipelineDataFromGuids = await encompass.viewPipeline(pipelineWithGuids);
// or with the other contract, and a limit of the first 50 results:
const pipelineDataFromFilter = await encompass.viewPipeline(pipelineWithFilter, 50);
A collection of methods to use when working with loans. In general, these are wrappers around the 'Loan Management' API endpoints.
Deletes the loan that matches the provided GUID.
Retrieves the loan data of the provided loan GUID. Can optionally be filtered by providing an array of entities.
Takes in a loan number (Loan.LoanNumber
) and returns the matching loan's GUID. If no matching loan is found, returns null
.
Updates a loan object. Expects the data to already be formatted into the correct contract shape.
const updateData: any = {
applications: [
borrower: {
lastName: 'new borrower last name',
},
],
contacts: [
{
contactType: 'LOAN_OFFICER',
name: 'new loan officer name',
},
],
customFields: [
{
fieldName: 'CX.SOME.CUSTOM.FIELD',
stringValue: 'new value',
},
],
};
// using the default options:
await encompass.loans.update('some-loan-guid', updateData);
// providing options:
const options: LoanUpdateOptions = {
appendData: true,
persistent: 'transient',
view: 'entity',
};
await encompass.loans.update('some-loan-guid', updateData, options);
If the contract is not known, one can be generated before updating. The update data is expected as key value pairs (the key being the field ID), and all standard Encompass values are placed in the standardFields
key, while all custom fields are placed in the customFields
key.
const updateData: UpdateLoanWithGenerateContract = {
standardFields: {
'4000': 'new borrower last name',
'317': 'new loan officer name',
},
customFields: {
'CX.SOME.CUSTOM.FIELD': 'new value',
},
};
await encompass.loans.updateWithGeneratedContract('some-loan-guild', updateData);
The updateWithGeneratedContract()
method can also take the third LoanUpdateOptions
as well.
Keep in mind this method requires an extra call to generate the contract, and loans.update()
should be used instead when possible.
A collection of methods when working with milestones and associates.
Assigns a loan associate to a milestone. The associate ID provided must be of a user who fits the persona group for that milestone.
const guidToUpdate: string = 'some-loan-guid';
const assignUnderwriterOptions: AssignMilestoneOptions = {
loanGuid: guidToUpdate,
milestone: 'Underwriting',
userId: 'UnderwritersId',
};
await encompass.milestones.assign(assignUnderwriterOptions);
Returns the response of the Get All Milestone endpoints for the provided GUID.
Updates the matching milestone for the loan guid provided. The options
key will be added to the body of the call, and the optional action
key can be used to finish or unfinish a milestone.
const updateProcessingOptions: UpdateMilestoneOptions = {
loanGuid: guidToUpdate,
milestone: 'Processing',
options: {
comments: 'this milestone is complete!',
}
action: 'finish',
};
await encompass.milestones.update(updateProcessingOptions);
A collection of methods that assist with schema operations.
Takes in a value representing key value pairs of field IDs and new values and returns the correct contract shape to perform an update on a loan.
const borrowerUpdateData = {
'4000': 'new first name',
'4002': 'new last name',
};
// returns the contract:
const updateContract = await encompass.schemas.generateContract(borrowerUpdateData);
// this value can now be used to update a loan:
await encompass.loans.update(updateContract);
Calls the loan schema endpoint and returns the schema. Can be filtered down by providing an optional array of entity names.
Generated using TypeDoc
The API key of the Encompass instance to connect to.