Dun & Bradstreet Tanzania Credit Bureau (TZ) API Wrapper for Nodejs (still in beta)
The Unofficial Dun & Bradstreet Tanzania Credit Bureau API wrapper for Nodejs.
- WSDL (requires authentication)
Installation
Install via npm
npm i @debugger_supreme/dunbapi
or install a particular beta version
npm install --save @debugger_supreme/dunbapi@0.0.1-beta.1
Configuration
Authentication
Configure your api username and password in .env
file as follows
DUNB_USERNAME=your_api_username
DUNB_PASSWORD=your_api_password
URL
The package config file comes with default API url pointing to production
.
DUNB_WSDL=https://cweb.dnbtanzania.com/TanWebsite/Services/LiveRequestService.svc?wsdl
To point to test
environment set the DUNB_WSDL key in your .env
file to point to test url given. (See below)
DUNB_WSDL=url
Remember
- The WSDL url should end with a
?wsdl
suffix, don't forget to add this if you haven't already. - You need to first configure correct Authentication details above for your respective environment.
Usage
- searchMultiHit Consumer Report done
- singleHit Consumer Report developing
SearchMultiHit
Method searchMultiHit(params)
queries client information by
export enum PURPOSE_OF_INQUIRY {
"New Credit Application" = 1,
"New Guarantor",
"Review of Existing Customer",
"Regulatory Audit",
}
export type _PURPOSE_OF_INQUIRY = 1 | 2 | 3 | 4;
interface SEARCH_PARAMETERS {
NAME: string;
IDENTIFIER_NUMBER?: string;
MOBILE?: string;
SURROGATES: {
NATIONALITY: NATIONALITIES;
DATEOFBIRTH: string;
},
ACCOUNTNUMBER?: string,
CUSTOMERID?: string,
PURPOSE_OF_INQUIRY: _PURPOSE_OF_INQUIRY
}
import DB from "@debugger_supreme/dunbapi";
const client = new DB({
username: proces.env.CREDIT_INFO_USERNAME,
password: process.env.CREDIT_INFO_PASSWORD,
});
// 1
client
.searchConsumerMultiHit({
NAME: "Paul SIRIL MINJA",
PURPOSE_OF_INQUIRY: 1,
SURROGATES: {
NATIONALITY: "TZ",
DATEOFBIRTH: "15-Jun-1972"
}
})
.then(function (results) {
console.log({ results });
});
SingleHit
// 2: Pull report for a client using entity key and search request id from step 1
client.getReportConsumer({
ENTITY_KEY: '1856250',
SEARCH_REQUEST_ID: '3024716'
}).then(response => {
console.log({
response
})
})
TODO
- [ ] expose types
- [x] SearchMultiHit Report
- [x] SingleHit Report
- [ ] Error Handling
- [ ] Commercial Search