@dudoo/tsbcc
v1.0.4
Published
TSC PAX S-80
Downloads
4
Readme
TSBCC
TSB PAX S-80
Installation
npm install @dudoo/tsbcc --save
Usage
const TSB = require('@dudoo/tsbcc');
let tsb = new TSB({port: '/dev/tty.usbserial', baudRate: 9600, dataBits: 7, parity: 'even', stopBits: 1});
信用卡交易要求
tsb.requestTransaction('003', 413.00, (err, data, result) => {
if(err)
console.log(err);
else{
console.log('result:%s', result);
console.log(data);
}
tsb.close();
});
信用卡取消交易要求
tsb.cancelTransaction(TSB.HostId.TAISHIN_GEN, '000030', (err, data, result) => {
if(err)
console.log(err);
else{
console.log('result:%s', result);
console.log(data);
}
tsb.close();
});
/*
OUTPUT:
result:APPROVED
{ transType: '30',
hostId: '03',
receiptNo: '000030',
cardNo: '468236******9351 ',
transAmount: 413,
transDateTime: 2018-07-20T04:03:00.000Z,
approvalNo: '115042 ',
ecrRespCode: '0000',
edcTerminalId: '64852495',
cardType: '01',
cupInd: 'C' }
result:ERROR
{ transType: '30',
hostId: ' ',
receiptNo: ' ',
cardNo: ' ',
transAmount: NaN,
transDateTime: Invalid Date,
approvalNo: ' ',
ecrRespCode: '0001',
edcTerminalId: ' ',
cardType: ' ',
cupInd: ' ' }
*/
信用卡結帳交易要求
tsb.requestSettlement(TSB.HostId.TAISHIN_GEN, (err, data, result) => {
if(err)
console.log(err);
else{
console.log('result:%s', result);
console.log(data);
}
tsb.close();
});