module-bank-api
v1.2.2
Published
Wrapper for Modulbank API for Node.js
Downloads
7
Readme
ModuleBank API
Wrapper for ModuleBank API for Node.js
Install
npm i module-bank-api -S
Usage
Import
{ModuleBankApi, ModuleBankPaymentCategory} = require('module-bank-api');
// or
import {ModuleBankApi, ModuleBankPaymentCategory} from 'module-bank-api';
API object
let api = new ModuleBankApi(
'sandboxtoken', // Auth token
true // true - sandbox mode, false - production mode
);
API methods
api.getAccountInfo(callback)
- returns user accounts https://api.modulbank.ru/data/#_5api.getOperationHistory(bankAccountId, params, callback)
- returns operation history for the account https://api.modulbank.ru/data/#_6
Argument params
is an Object with the followings fields:
let query = {
category: ModuleBankPaymentCategory.CREDIT, // ModuleBankPaymentCategory.CREDIT or ModuleBankPaymentCategory.DEBET
skip: 2, // Skim records count
records: 3, // Records limit
from: from, // Select operation from this date (JS Date object)
till: till, // Select operation till this date (JS Date object)
};
All fields are optional.
api.getBalance(bankAccountId, callback)
- returns balance of the account https://api.modulbank.ru/data/#_7api.uploadOperation(operation1c, callback)
- uploads operations in 1C format https://api.modulbank.ru/load/
Callback signature
function callback(error, response) {
if (!error) {
console.log(response);
}
}
error
- error information ornull
if no error happensresponse
- response data
ModuleBankPaymentCategory
ModuleBankPaymentCategory.DEBET
- debet categoryModuleBankPaymentCategory.CREDIT
- credit category