Purpose:

Allow Lenders to initiate a new transaction with your integration

Sample Usage:

import host from '@elliemae/em-ssf-guest'

...

let transactionRequest = {
  request: {
    type: 'NEW_REQUEST',
    options: {
      stringOption: 'SOME_VALUE',
      booleanOption: true,
      numericOption: 1000
    },
    resources: [
      {
        id: 'A_RESOURCE_ID',
        name: 'A_RESOURCE_NAME',
        mimeType: 'A_RESOURCE_MIMETYPE'
        }
    ]
  }
}

async function createTransaction(transactionRequest) {
  try {
    const transactionObject = await host.getObject('transaction')
    const transactionData = await transactionObject.create(transactionRequest)

    applicationState.transactionId = transactionData.id
  } catch (error) {
    console.log({error})
  }
}

createTransaction(transactionRequest)
import host from '@elliemae/em-ssf-guest'

...

let transactionRequest = {
  request: {
    type: 'SUPPORTED_REQUEST_TYPE',
    options: {
      stringOption: 'SOME_VALUE',
      booleanOption: true,
      numericOption: 1000
    },
    resources: [
      {
        id: 'A_RESOURCE_ID',
        name: 'A_RESOURCE_NAME',
        mimeType: 'A_RESOURCE_MIMETYPE'
        }
    ]
  }
}

host.getObject('transaction')
  .then(
    (transactionObject) => {
      transactionObject.create(transactionRequest)
        .then(
          (transactionData) => {
            applicationState.transactionId = transactionData.id
          }
        )
        .catch(
          (error) => {
            console.log({error})
          }
        )
    }
  )
  .catch(
    (error) => {
      console.log({error})
    }
  )

Interface:

Input:

Type: Object

{
  request: {
    type: 'SUPPORTED_REQUEST_TYPE',
    options: {
      stringOption: 'SOME_VALUE',
      booleanOption: true,
      numericOption: 1000
    },
    resources: [
      {
        id: 'A_RESOURCE_ID',
        name: 'A_RESOURCE_NAME',
        mimeType: 'A_RESOURCE_MIMETYPE'
        }
    ]
  }
}

Attribute

Description

`$.request.type`

string

The type of transaction request being initiated for the subject product. This must be one of the supported values for the request type that your application is configured to support - based on which its data entitlements are scoped.

`$.request.options`

object

The specific set of selectable options that apply to the specific type of transaction request, as modeled by your application. This may be used to select from which bureaus to order a borrower's credit score for a Credit integration, or how many days of income information to pull for a borrower in the case of a Verification of Income/Employment integration.

`$.request.resources`

array

The collection of file attachments - referred to as resource objects in the EPC API - to be attached to the transaction request. The id, name, and mimeType attribute needed for each resource object in the collection can be created in one of two ways:

  1. Your application utilized the transaction.createResource method to build a custom file upload experience, and the user invoked this functionality and uploaded a file from their local drive.

  2. Your application utilized the application.performAction("getAvailableResources") method to launch the host application's file explorer, and the user invoked this functionality and attached a file[s] from the host application.

Once the resource objects are collected from these methods, be sure to echo them back to the EPC platform when creating a transaction!

Returns:

Type: Promise

==> Resolved:

{
    id: "TRANSACTION_GUID"
}

==> Rejected:

An error is raised, containing a message attribute about details on the error that occurred

{
  message: "{{ERROR_DETAILS}}"
}

❗️

Common Error Scenarios!

  • You used a $.request.type that is not configured to be supported by your application
  • You passed an invalid resource object (not collected in one of the two ways described in the table above), or repeated a resource object, in $.request.resources