-
-
Save 8ui/057ea2d335f13673db5513329beebc58 to your computer and use it in GitHub Desktop.
Пример использования в node.js сбербанковской библиотеки для работы с банковскими терминалами sbrf.dll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const winax = require('winax'); | |
const sbrf = new winax.Object('SBRFSRV.Server'); | |
let opResultCode; | |
const opPinpadCheckResultCode = sbrf.NFun(7003); | |
console.log(opPinpadCheckResultCode, opPinpadCheckResultCode === 0 ? 'пинпад есть' : 'пинпада нет'); | |
sbrf.clear(); | |
// контрольная лента | |
console.info('[контрольная лента]'); | |
opResultCode = sbrf.NFun(7000); | |
console.log(opResultCode, sbrf.GParamString('Cheque'), sbrf.GParamString('Cheque1251')); | |
sbrf.clear(); | |
// короткая контрольная лента | |
console.info('[короткая контрольная лента]'); | |
opResultCode = sbrf.NFun(7004); | |
console.log(opResultCode, sbrf.GParamString('Cheque'), sbrf.GParamString('Cheque1251')); | |
sbrf.clear(); | |
// сверка итогов ("итоги дня по картам") | |
console.info('[сверка итогов]'); | |
opResultCode = sbrf.NFun(6000); | |
console.log(opResultCode); | |
sbrf.clear(); | |
// // x-отчёт по картам | |
// console.info('[x-отчёт по картам]'); | |
// opResultCode = sbrf.NFun(6002); | |
// console.log(opResultCode); | |
// sbrf.clear(); | |
// console.info('[получить номер терминала и мерчанта]'); | |
// opResultCode = sbrf.NFun(7007); | |
// console.log(opResultCode, sbrf.GParamString('TermNum'), sbrf.GParamString('MerchNum')); | |
// sbrf.clear(); | |
// оплата | |
sbrf.SParam('Amount', 300*100); | |
opResultCode = sbrf.NFun(4000); | |
console.log(opResultCode); | |
const e = [ | |
'AmountClear', | |
'Amount', | |
'CardName', | |
'CardType', | |
'TrxDate', | |
'TrxTime', | |
'TermNum', | |
'MerchNum', | |
'AuthCode', | |
'RRN', | |
'MerchantTSN', | |
'MerchantBatchNum', | |
'ClientCard', | |
'ClientExpiryDate', | |
'Hash', | |
'OwnCard' | |
].reduce((acc, key) => { | |
acc[key] = sbrf.GParamString(key); | |
return acc; | |
}, {}); | |
console.log(e); | |
sbrf.clear(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment