This project/package is to make use of Finnotech open api easier in nodejs projects.
Using npm:
$ npm i "https://github.com/ARTM2000/finnotech-easy.git"
import Finnotech, { SCOPES } from 'finnotech-easy';
const finnotechServices = new Finnotech({
clientId: 'myAppName',
clientSecret: 'myAppClientSecret',
nid: 'nationalIdentity', // for app members
getAccessToken: async (fullScopeName) => {
// process to get require access token by scope name
return 'accessToken';
},
getRefreshToken: async (fullScopeName) => {
// process to get require refresh token by scope name
return 'refreshToken';
},
setTokens: async (tokenData) => {
const {
accessToken,
refreshToken,
lifeTime,
scopes,
tokenType,
} = tokenData;
// do store token process here...
},
});
const { TokenService, OakService } = finnotechServices;
const getIbanInquiryInfo = async (iban) => {
try {
// get token for require scopes. this function finally call setTokens.
await TokenService.getClientCredentialToken([
SCOPES.ibanInquiry.name,
]);
// finally call ibanInquiry service
const result = await OakService.ibanInquiry({ iban });
console.log(result.data);
} catch (err) {
console.error(err);
}
}
getIbanInquiryInfo('IRxxxxxxxxxxxxxxxxxxxxxxxx')
Name | Type | Description |
---|---|---|
clientId | string |
The clientId or app name of your confirmed application - شناسه اپلیکیشن |
clientSecret | string |
The app secret password - گذرواژه |
nid | string |
national identity of a app member that have access to call service |
getAccessToken | Function |
An asynchronous or synchronous function which will receive fullScopeName as props and expect to get access token for service call. This function call before each service call |
getRefreshToken | Function |
An asynchronous or synchronous function which will receive fullScopeName as props and expect to get refresh token if service receive invalid token response. |
setTokens | Function |
An asynchronous or synchronous function which will receive tokenData as props which contain token information (accessToken , refreshToken , lifeTime , scopes , tokenType ). Use this function to store tokens that will receive |
useSandBox | boolean |
Optional . If you want to use sandbox version of finnotech api, bass true otherwise it's not required |
For get client-credentials token for its scope(s) (document page). This function just receive an array of client-credentials scope names. This function finally call setTokens
e.g.
TokenService.getClientCredentialToken([ SCOPES.ibanInquiry.name ]); // return Promise<void>
For iban inquiry service (document page). e.g.
OakService.ibanInquiry({ iban: 'IRxxxxxxxxxxxxxxxxxxxxxxxx' }); // return Promise<IFinnotechIbanInquiryResponse>
For group iban inquiry service (document page):
- submit group iban inquiry:
OakService.submitGroupIbanInquiry({ file: 'csv buffer or base64 content' }); // return Promise<IFinnotechSubmitGroupIbanInquiryResponse>
- get result of group iban inquiry:
OakService.getResultOfGroupIbanInquiry({ inquiryTrackId: 'submit track id' }); // return Promise<string>
- retry group iban inquiry request:
OakService.retryGroupIbanInquiry({ inquiryTrackId: 'submit track id' }); // return Promise<IFinnotechSubmitGroupIbanInquiryResponse>
For card balance service (document page). e.g.
OakService.cardBalance({ card: '6362142376876523' }); // return Promise<IFinnotechCardBalanceResponse>
For card statement service (document page). e.g.
OakService.cardStatement({
card: '6362142376876523',
fromDate: '990421', // optional
toDate: '991021', // optional
}); // return Promise<IFinnotechCardStatementResponse>
For deposit to iban service (document page). e.g.
OakService.depositToIban({
deposit: 'xxxxxxxxxxxxxx',
bank: '10', // from document
}); // return Promise<IFinnotechDepositToIbanResponse>
For cif inquiry service (document page). e.g.
OakService.cifInquiry({ nid: '1234567890' }); // return Promise<IFinnotechCifInquiryResponse>
For shahab inquiry service (document page). e.g.
OakService.shahabInquiry({
nid: '1234567890',
birthData: '13790430',
}); // return Promise<IFinnotechShahabInquiryResponse>
For facility inquiry service (document page). e.g.
CreditService.facilityInquiry({ nid: 'xxxxxxxxxx' }); // return Promise<IFinnotechFacilityInquiryResponse>
For backCheque inquiry service (document page). e.g.
CreditService.backChequeInquiry({ nid: 'xxxxxxxxxx' }); // return Promise<IFinnotechBackChequeInquiryResponse>
- Client-Credentials token
- Oak only Client-Credentials services
- Credit only Client-Credentials services
- Utility and Convert services
- Open account list services
- General inquiry services
- Wallet services
- Authorization-Code token
- Authorization-SMS token
- Oak Authorization-Code services
- Credit Authorization-SMS services
- Service call inquiry list - wages
- Get list of tokens
- Revoke token