1.0.14 • Published 2 months ago

qgen-cfm-controller v1.0.14

Weekly downloads
-
License
ISC
Repository
-
Last release
2 months ago

CFM Integration SDK

The CFM Integration SDK provides a simple and effective way for merchants to integrate CFM (Customer Facing Module) functionalities directly into their websites. This SDK allows for initiating the application process, handling session IDs, embedding the CFM application iframe, and registering event listeners for application completion.

SDK Functions Overview

StartApplication

Initiates the application process by posting applicant data to a specified endpoint and handling the session ID.

Parameters:

  • data: ApplicantData - The applicant's information.
  • endpoint: string - The endpoint URL to start the application.
  • handleResponse: Function - A function to extract the session ID from the response.

Example Usage:

const handleResponse = (response) => response.data.data.sessionID; // Define how to extract the session ID from your response
await StartApplication(applicantData, endpoint, handleResponse);

HandleSessionID

Processes the session ID to retrieve an access token, storing both the token and session ID in localStorage for future use.

Parameters:

  • sessionID: string - The session ID obtained from starting the application.

Example Usage:

await HandleSessionID(sessionID);

CreateIFrame

Generates and appends an iframe element to the specified container, embedding the CFM application interface within the web page.

Parameters:

  • divId: string - The ID of the container div where the iframe should be appended.
  • className: string - The class name for the iframe, for styling purposes.
  • tokenData: string (optional) - The token to use in the iframe's source URL. Defaults to localStorage if not provided.
  • sessionData: string (optional) - The session data to use in the iframe's source URL. Defaults to localStorage if not provided.

Example Usage:

CreateIFrame("containerDivId", "iframeClassName", tokenData, sessionData);

RegisterListener

Registers an event listener for the CFM application iframe to handle completion events and other messages from the CFM system.

Parameters:

  • callback: Function - The function to call when an event is received.

Example Usage:

RegisterListener((eventData) => {
  console.log("Application completion event received:", eventData);
});
Event list
  • steps_completed_event
{
    "source": "cfm-event-listener",
    "type": "steps_completed_event",
    "payload": {
        "acceptanceInfo": {
            "deviceIP": "188.250.179.30",
            "deviceInfo": "Mozilla/5.0",
            "id": "65f177550e67c2013b8f7a0e",
            "timestamp": "2024-03-13 09:52:21.622 +0000 UTC",
            "version": "v1"
        },
        "caseID": "65f17753067871cd768cc6b0",
        "caseTypeID": "65153aacb4c7fdf640dd74f8",
        "entityID": "65f17753067871cd768cc6b2",
        "journeyID": "65f177530e67c2013b8f7a0d",
        "locale": "EN",
        "merchantID": "5ede17951111fc24d89bba7b",
        "referenceID": "65f17753b1f30e6fb81d4747",
        "riskLevelID": "65153b157e9b10a3031e985d",
        "sessionID": "65f17753390ffd4984b8bf75",
        "steps": [] // array of steps, it depends cfm process
    }
}

Example Workflow 1

  1. Start an Application: Use the StartApplication function with applicant data and a custom handler to process the response and extract a session ID.

  2. Embed the CFM Iframe: Use the CreateIFrame function to embed the CFM application into your website, providing a seamless experience for users.

  3. Register for Completion Events: Use the RegisterListener function to handle events indicating the completion of the CFM application process.

Example Workflow 2

  1. Handle the Session ID: Use the HandleSessionID function with the obtained session ID to get and store the access token.

  2. Embed the CFM Iframe: Use the CreateIFrame function to embed the CFM application, passing as argument the token and session_id obtained.

  3. Register for Completion Events: Use the RegisterListener function to handle events indicating the completion of the CFM application process.

1.0.14

2 months ago

1.0.13

2 months ago

1.0.9

2 months ago

1.0.8

2 months ago

1.0.11

2 months ago

1.0.10

2 months ago

1.0.12

2 months ago

1.0.7

7 months ago

1.0.2

12 months ago

1.0.6

12 months ago

1.0.5

12 months ago

1.0.4

12 months ago

1.0.3

12 months ago

1.0.1

1 year ago

1.0.0

1 year ago