0.0.1-security • Published 4 years ago
tochka-cyclops-api v0.0.1-security
Tochka-Cyclops-API (unofficial)
Reference
Installation
npm install tochka-cyclops-apiGetting started
import {Cyclops} from 'tochka-cyclops-api';
const tochka = new Cyclops({
    // is debug logging required, default: false
    debugLogging: true,
    // is error logging required, default: set to debugLogging
    errorLogging: true,
    // key is generated by you, you provide Tochka with it's public pair
    key: 'your_private_key',
    // sign system is provided by Tochka 
    signSystem: 'your_system',
    // sign thumbprint is provided by Tochka 
    signThumbprint: 'your_thumbprint',
    apiUrls: CyclopsApiUrls.STAGE_API_URL,
});Examples
Getting payments
import {Cyclops} from 'tochka-cyclops-api';
const tochka = new Cyclops({
    debugLogging: true,
    key: 'your_private_key',
    signSystem: 'your_system',
    signThumbprint: 'your_thumbprint',
    apiUrls: CyclopsApiUrls.STAGE_API_URL,
});
const result = await tochka
    .listPayments({filters: {}});
console.log(result);Uploading document
import {Cyclops} from 'tochka-cyclops-api';
const tochka = new Cyclops({
    debugLogging: true,
    errorLogging: true,
    key: 'your_private_key',
    signSystem: 'your_system',
    signThumbprint: 'your_thumbprint',
    apiUrls: CyclopsApiUrls.STAGE_API_URL,
});
const file = fs.readFileSync('document.pdf');
const result = await tochka.uploadDocumentBeneficiary(
    {
        document_type: CyclopsDocumentType.CONTRACT_OFFER,
        beneficiary_id: '1648298c-cd0a-48d4-98cd-18c25ff9b43b',
        document_date: '2021-03-301',
        document_number: '1512651265',
    },
    file,
);
console.log(result);Adding custom loggers
1)In constructor
import {Cyclops} from 'tochka-cyclops-api';
const tochka = new Cyclops({
    ... // other params
    debugLogging: true,
    debugCallback: (message, optionalParams) => {
        console.log(
            JSON.stringify(message, null, '    '),
            optionalParams ? JSON.stringify(optionalParams, null, '    ') : '',
        );
    },
    errorCallback: (message, optionalParams) => {
        fs.appendFileSync(
            './log.txt',
            JSON.stringify(message, null, '    ') +
                (optionalParams ? JSON.stringify(optionalParams, null, '    ') : ''),
        );
    },
});2)Using object method
    tochka.setDebugLogger((message, optionalParams) => {
        console.log(
            JSON.stringify(message, null, '    '),
            optionalParams ? JSON.stringify(optionalParams, null, '    ') : '',
        );
    });0.0.1-security
4 years ago
99.99.99
4 years ago
1.0.1
4 years ago
0.1.10
4 years ago
0.1.11
4 years ago
0.1.12
4 years ago
0.1.13
4 years ago
0.1.9
4 years ago
0.1.8
4 years ago
0.1.7
4 years ago
0.1.6
4 years ago
0.1.4
4 years ago
0.1.5
4 years ago
0.1.2
4 years ago
0.1.3
4 years ago
0.1.0
4 years ago
0.1.1
4 years ago
0.0.1
4 years ago
1.0.0
4 years ago