@flexbase/ecredit-node-client

中文文档
0.15.0发布于 2023/08/27MITTypeScriptCommonJS近 30 天下载 10.4万

Node.js Client for CRS Credit eCredit API

原始使用文档
文档目录8 节
  1. Install
  2. Usage
  3. Getting your Credentials
  4. Creating the Client
  5. Experian Calls
  6. Development
  7. Setup
  8. Testing

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.

版本与发布记录

@flexbase/ecredit-node-client 共发布 15 个版本,首次发布于 2022/07/19;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.15.0latest2023/08/273 年前
0.14.02023/07/153 年前
0.13.02023/06/223 年前
0.12.02023/05/123 年前
0.11.02023/04/173 年前
0.10.02023/04/123 年前

关于 @flexbase/ecredit-node-client 的常见问题

@flexbase/ecredit-node-client 是什么?

Node.js Client for CRS Credit eCredit API

如何安装 @flexbase/ecredit-node-client?

在项目目录运行 npm install @flexbase/ecredit-node-client,或使用 pnpm add / yarn add / bun add。

@flexbase/ecredit-node-client 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@flexbase/ecredit-node-client 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@flexbase/ecredit-node-client 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=12.*。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@flexbase/ecredit-node-client 可以商用吗?

@flexbase/ecredit-node-client 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@flexbase/ecredit-node-client 的下载量有多少?

根据 npm 官方下载统计,@flexbase/ecredit-node-client 在 2026/10/15 – 2026/11/13 这 30 天内被下载 104,004 次,日均约 3,467 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@flexbase/ecredit-node-client 还在维护吗?

最新版本 0.15.0 发布于 2023/08/27(3 年前);至今共发布 15 个版本,其中过去 12 个月发布了 0 个;首次发布于 2022/07/19。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。