Purpose:

Refresh your application's transaction origination context - if your current one expires. This method returns a new originId and partnerAccessToken - which your application back-end can use to retrieve a refreshed transaction origin:

  1. A fresh snapshot of the loan data your application is entitled to receive in a transaction origin
  2. A a fresh snapshot of the user's credential set configured by their Administrator for use with your application

Sample Usage:

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

...

async function refreshOriginationContext() {
  try {
    const transactionObject = await host.getObject('transaction')
    const originationContext = await transactionObject.refreshOrigin()

    applicationState.originId = originationContext.id
    applicationSate.partnerAccessToken = originationContext.partnerAccessToken
    if (originationContext.transactionId) {
      applicationState.transactionId = originationContext.transactionId
    }
  } catch (error) {
    console.log({error})
  }
}

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

...

host.getObject('transaction')
  .then(
    (transactionObject) => {
      transactionObject.refreshOrigin()
        .then(
          (originationContext) => {
            applicationState.originId = originationContext.id
            applicationState.partnerAccessToken = originationContext.partnerAccessToken
            
            if (originationContext.transactionId) {
              applicationState.transactionId = originationContext.transactionId
            }
          }
        )
        .catch(
          (error) => {
            console.log({error})
          }
        )
    }
  )
  .catch(
    (error) => {
      console.log({error})
    }
  )

Interface:

Input:

None

Returns:

Type: Promise

==> Resolved:

{
  id: 'ORIGIN_ID',
  partnerAccessToken: 'PARTNER_ACCESS_TOKEN',
  transactionId: 'TRANSACTION_ID',
  context: 'lender' // or 'consumer'
}

Attribute

Description

`$.id`

Unique identifier for the transaction origination information snapshot accessible via the REST API's /partner/v2/origins/:id endpoint

`$.partnerAccessToken`

Temporary session token that grants authorization for a partner integration to access transaction origination information via the REST API's /partner/v2/origins/:id endpoint

`$.transactionId`

Unique identifier for the transaction in whose context the partner integrations user-interface is being launched. This is only available in the situation where your integration is being launched in the context of an existing transaction, and can be used to decide the appropriate view to display to users.

`$.context`

The user type in whose context your integration is being launched - one of:

  1. lender - when your user interface is being presented to a user in a lending enterprise
  2. consumer - when your user interface is being presented to a consumer/borrower

📘

Partner Access Token Validity

Your integration needs the partnerAccessToken returned by the refreshOrigin method to successfully call the GET https://api.elliemae.com/partner/v2/origins/:id Partner RESTful API endpoint and retrieve transaction origination information. Remember that a partnerAccessToken is only valid for 300 seconds once generated 🕒

If your partnerAccessToken expires, don't worry. Call back into transaction.refreshOrigin again to generate a new one!

==> Rejected:

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

{
  message: "{{ERROR_DETAILS}}"
}