npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@flexbase/ecredit-node-client

v0.15.0

Published

Node.js Client for CRS Credit eCredit API

Downloads

868

Readme

ecredit-node-client

ecredit-node-client is a Node/JS and TypeScript Client for CRS Credit that allows you to use normal Node syntax to Experian, Equifax, and other data from the CRS Credit eCredit API.

Install

# with npm
$ npm install @flexbase/ecredit-node-client

Usage

This README isn't going to cover all the specifics of what CRS Credit is, and how to use it - it's targeted as a companion to the CRS Credit developer docs that explain each of the endpoints and how the general CRS Credit API works.

However, we'll put in plenty of examples so that it's clear how to use this library to interact with CRS Credit.

Getting your Credentials

This client uses the standard username and password, and you obtain those from the CRS Credit support team.

Creating the Client

At the current time, a targeted subset of functions are available from the client. These are currently about the Experian domain. As we add more features, this client will exapnd, but for now, this works as we need it to.

The basic construction of the client is:

import { Ecredit } from '@flexbase/ecredit-node-client'
const client = new Ecredit(username, password)

If you'd like to provide the Host to use, say, for sandbox access, this can also be provided in the constructor:

const client = new Eclient(username, password, {
  host: 'mware-dev.crscreditapi.com/api',
})

where the options can include:

  • host - the hostname where all eCredit calls should be sent

Experian Calls

The CRS Credit API documentation is broken up into different sections, and for the Experian section, we have implemented the calls most important to our work.

Basic Credit Report

You can get a Basic Experian Credit Report with a single call:

const resp = await client.experian.basic({
  firstName: 'ANDERSON',
  lastName: 'LAURIE',
  ssn: '666-45-5730',
  street1: '9817 LOOP BLVD',
  street2: 'APT G',
  city: 'CALIFORNIA CITY',
  state: 'CA',
  zip: '93505-1352',
})

where the user is a test user for Experian's sandbox instance. And the response will be something like:

{
  success: true,
  report: {
    headerRecord: [ [Object] ],
    addressInformation: [ [Object], [Object], [Object] ],
    consumerIdentity: { dob: [Object], name: [Array] },
    employmentInformation: [ [Object], [Object] ],
    informationalMessage: [ [Object], [Object] ],
    inquiry: [ [Object], [Object], [Object] ],
    publicRecord: [ [Object] ],
    riskModel: [ [Object] ],
    tradeline: [
      [Object], [Object],
      [Object], [Object],
      [Object], [Object],
      [Object], [Object],
      [Object], [Object],
      [Object], [Object],
      [Object], [Object],
      [Object], [Object],
      [Object]
    ],
    endTotals: [ [Object] ]
  }
}

where the complete, detailed structure is in the Typescript interface definitions.

There is an optional config, as detailed in the CRS Credit docs, and that can be specified as:

const resp = await client.experian.basic(person, {
  config: 'exp-prequal-vantage4',
})

and that will be the version of the report that's pulled from Experian and returned to CRS Credit, and ultimately, the client.

Development

For those interested in working on the library, there are a few things that will make that job a little simpler. The organization of the code is all in src/, with one module per section of the Client: authentication, experian, etc. This makes location of the function very easy.

Additionally, the main communication with the CRS Credit service is in the src/index.ts module in the fire() function. In the constructor for the Client, each of the sections are created, and then they link back to the main class for their communication work.

Setup

In order to work with the code, the development dependencies include dotenv so that each user can create a .env file with a single value for working with CRS Credit:

  • ECREDIT_USERNAME - this is the CRS Credit generated "username".
  • ECREDIT_PASSWORD - this is the CRS Credit "password".

Testing

There are several test scripts that test, and validate, information on the CRS Credit service exercising different parts of the API. Each is self-contained, and can be run with:

$ npm run ts tests/basic.ts

> @flexbase/[email protected] ts
> ts-node -r dotenv/config "tests/basic.ts"

doing a soft pull from Experian...
Success! Pulled the prequal report for test person
doing a hard pull from Experian...
Success! Pulled the hard report for test person

Each of the tests will run a series of calls through the Client, and check the results to see that the operation succeeded. As shown, if the steps all report back with Success! then things are working.

If there is an issue with one of the calls, then an Error! will be printed out, and the data returned from the client will be dumped to the console.