Purpose:

Allow Lenders to update an existing transaction by attaching new resources or updating the request options associated with the transaction.

A transaction update will trigger an updated webhook event on the urn:elli:epc:transaction REST resource, indicating an updated transaction request is ready for your application to retrieve. The updated transaction request will contain:

  1. An updated options object, if set in this method
  2. An updated resources array, with the resources set in this method appended to the previously attached set
  3. By default, a fresh snapshot of the loan data your application is entitled to receive in the transaction request
  4. By default, a fresh snapshot of the user's credential set configured by their Administrator for use with your application

📘

Request type immutability

The type for a lender initiated transaction request can not be updated once created. If you need to support the ability for a lender to change the request type for a transaction they have initiated, the initial transaction must be canceled via a transaction response status update (using the REST API), and the lender must initiate a new transaction request with the updated type

Sample Usage:

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

...

let updatedTransactionRequest = {
  request: {
    options: {
      stringOption: 'SOME_UPDATED_VALUE',
      booleanOption: false,
      numericOption: 9999
    },
    resources: [
      {
      	id: 'A_NEW_RESOURCE_ID',
      	name: 'A_NEW_RESOURCE_NAME',
      	mimeType: 'A_NEW_RESOURCE_MIMETYPE'
    	}
    ]
  }
}

async function updateTransaction(updatedTransactionRequest) {
  try {
    const transactionObject = await host.getObject('transaction')
    const transactionData = await transactionObject.update(updatedTransactionRequest)

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

updateTransaction(updatedTransactionRequest)
import host from '@elliemae/em-ssf-guest'

...

let updatedTransactionRequest = {
  request: {
    options: {
      stringOption: 'SOME_UPDATED_VALUE',
      booleanOption: false,
      numericOption: 9999
    },
    resources: [
      {
      	id: 'A_NEW_RESOURCE_ID',
      	name: 'A_NEW_RESOURCE_NAME',
      	mimeType: 'A_NEW_RESOURCE_MIMETYPE'
    	}
    ]
  }
}

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

Interface:

Input:

Type: Object

{
  request: {
    options: {
      stringOption: 'SOME_UPDATED_VALUE',
      booleanOption: false,
      numericOption: 9999
    },
    resources: [
      {
      	id: 'A_NEW_RESOURCE_ID',
      	name: 'A_NEW_RESOURCE_NAME',
      	mimeType: 'A_NEW_RESOURCE_MIMETYPE'
    	}
    ]
  }
}
AttributeDescription

$.request
object - required

$.request.options
object - optional

The updated set of selectable options associated with the subject transaction request. Note: the options object set here will completely replace the existing request options object in the updated request (no merging)!

$.request.resources
array - optional

A new collection of file attachments (referred to as resource objects in the EPC API) to be appended to the existing set of attachments on the transaction request. Note: The resource objects specified in the update will be appended to the existing set of request resources in the updated transaction request (no replacing or removing)!

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 applications file explorer, and the user invoked this functionality and attached a file[s] from the host application.

👍

You don't have to change anything!

As mentioned above, both options and resources are completely optional in the transaction update. If you want to trigger an update with a fresh snapshot of the request loan data and user credentials, but with no changes to the request options or resources, just pass an empty request object in the methods input argument. This is illustrated above.

Returns:

Type: Promise

==> Resolved:

{
	id: "{{TRANSACTION_ID}}"
}

==> Rejected:

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

{
  message: "{{ERROR_DETAILS}}"
}

❗️

Common Error Scenarios!

  • 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