sitb-software / jspos Goto Github PK
View Code? Open in Web Editor NEWJavaScript ISO8583 ,JavaScript version of JPOS
License: MIT License
JavaScript ISO8583 ,JavaScript version of JPOS
License: MIT License
C:\Program Files\nodejs\node_modules\jspos>npm install
[email protected] prepublish C:\Program Files\nodejs\node_modules\jspos
npm run compile[email protected] compile C:\Program Files\nodejs\node_modules\jspos
babel ./src -d ./lib --ignore tests/*
./src doesn't exist
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Users\User\AppData\R
oaming\npm\node_modules\npm\bin\npm-cli.js" "run" "compile"
npm ERR! node v5.6.0
npm ERR! npm v2.7.4
npm ERR! code ELIFECYCLE
npm ERR! [email protected] compile: babel ./src -d ./lib --ignore __tests__/*
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] compile script 'babel ./src -d ./lib
--ignore tests/'.
npm ERR! This is most likely a problem with the jspos package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! babel ./src -d ./lib --ignore tests/
npm ERR! You can get their info via:
npm ERR! npm owner ls jspos
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Program Files\nodejs\node_modules\jspos\npm-debug.log
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Users\User\AppData\R
oaming\npm\node_modules\npm\bin\npm-cli.js" "install"
npm ERR! node v5.6.0
npm ERR! npm v2.7.4
npm ERR! code ELIFECYCLE
npm ERR! [email protected] prepublish: npm run compile
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] prepublish script 'npm run compile'.
npm ERR! This is most likely a problem with the jspos package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm run compile
npm ERR! You can get their info via:
npm ERR! npm owner ls jspos
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Program Files\nodejs\node_modules\jspos\npm-debug.log
Can I use the example without using babel?
Hi! First Thanks for this library, is really useful!!
I found a problem with decodeLength function, in BcdPrefixer.js.
When "(this.nDigits + 1) / 2" is a float, the floor operation is not performed automatically, e.g.:
this.nDigits = 2 then,
this.nDigits + 1/ 2 = 1.5,
for (let i = 0; i < 1.5 ; i++)
1st iteration 0 < 1.5 --- true
2nd iteration 1 < 1.5 --- true, JS not make automatically the floor operation, unlike Java implementation, and the second iteration shouldn't be performed.
Thanks for your help!
Is there any support for ISO header field, I want to set the TPDU before the message type?
I am trying to set fields 65 going forward but only fields 2 to 64 are showing. Please help
Hi. Thanks for a great library.
How would I create a Sub Field Packager?
The JPOS library has the ability to create sub fields. Here is the XML from JPOS:
<isofieldpackager
id="127"
length="999999"
name="RESERVED PRIVATE USE"
class="org.jpos.iso.IFA_LLLLLLBINARY"
packager="org.jpos.iso.packager.GenericSubFieldPackager">
<isofield
id="0"
length="0"
name="PLACEHOLDER"
class="org.jpos.iso.IF_CHAR"/>
<isofield
id="1"
length="8"
name="BITMAP"
class="org.jpos.iso.IFB_BITMAP"/>
</isofieldpackager>
I am setting up the fields so:
var packager = new Packager();
packager.fld = [ new IFA_NUMERIC(4, "MESSAGE TYPE INDICATOR"), ...
Is there a simple way to add a new sub field packager to the array with fields defined inside that?
Many thanks!
root@Ubuntu-1310-saucy-64-minimal /home/app/node_modules/jspos # npm install
npm WARN lifecycle [email protected]~prepublish: cannot run in wd %s %s (wd=%s) [email protected] npm run compile /home/app/node_modules/jspos
root@Ubuntu-1310-saucy-64-minimal /home/app/node_modules/jspos # npm test
[email protected] test /home/app/node_modules/jspos
babel-node ./tests/index.js
sh: 1: babel-node: not found
npm ERR! Test failed. See above for more details.
please help me
i use jpos in .net project in enterprise Project . but now when i see npm-jspos i realy happy .
i use from your example
but becase of i dont have typescript file in express frame work i change code but i have error in 'msg.pack()'
Error: null field 11 packager
at MyPackager.pack (D:\SwitchJS\citydiSwicthNodeV1\node_modules\jspos\lib\ISOBasePackager.js:144:31)
at ISOMsg.pack (D:\SwitchJS\citydiSwicthNodeV1\node_modules\jspos\lib\ISOMsg.js:180:34)
at exports.index (D:\SwitchJS\citydiSwicthNodeV1\controllers\index.js:20:16)
at Layer.handle [as handle_request] (D:\SwitchJS\citydiSwicthNodeV1\node_modules\express\lib\router\layer.js:95:5)
at next (D:\SwitchJS\citydiSwicthNodeV1\node_modules\express\lib\router\route.js:137:13)
at Route.dispatch (D:\SwitchJS\citydiSwicthNodeV1\node_modules\express\lib\router\route.js:112:3)
at Layer.handle [as handle_request] (D:\SwitchJS\citydiSwicthNodeV1\node_modules\express\lib\router\layer.js:95:5)
at D:\SwitchJS\citydiSwicthNodeV1\node_modules\express\lib\router\index.js:281:22
at Function.process_params (D:\SwitchJS\citydiSwicthNodeV1\node_modules\express\lib\router\index.js:335:12)
at next (D:\SwitchJS\citydiSwicthNodeV1\node_modules\express\lib\router\index.js:275:10)
it is my code
MyPackager.js File
var jspos = require("jspos")
let { IFB_NUMERIC, IFB_BITMAP, IFB_LLNUM, IFB_LLLNUM, IF_CHAR, IFB_LLCHAR, IFB_LLLCHAR, IFB_BINARY, IFB_LLBINARY, IFB_LLLBINARY, IFB_AMOUNT } = jspos.packer;
const pad = false;
let fld = [
/000/ new IFB_NUMERIC(4, "Message Type Indicator", true),
/001/ new IFB_BITMAP(8, "Bitmap"),
/002/ new IFB_LLNUM(19, "Primary Account number", pad),
/003/ new IFB_NUMERIC(6, "Processing Code", pad),
/004/ new IFB_NUMERIC(12, "Amount, Transaction", pad),
/005/ new IFB_NUMERIC(12, "Amount, Reconciliation", pad),
/006/ new IFB_NUMERIC(12, "Amount, Cardholder billing", pad),
/007/ new IFB_NUMERIC(10, "Date and time, transmission", pad),
/008/ new IFB_NUMERIC(8, "Amount, Cardholder billing fee", pad)
];
class MyPackager extends jspos.ISOBasePackager{
constructor() {
super();
this.setFieldPackager(fld);
}
}
exports.GetPakager= new MyPackager();
controllers/index.js File
exports.index = function (req, res, next) {
try {
console.log('dddd');
debugger;
var jspos = require("jspos");
var packager = require("./MyPackager");
var msg = packager.GetPakager.createISOMsg();
msg.setMTI('0800');
msg.setField(11, '000105');
msg.setField(41, '00000764');
msg.setField(42, '111000001111002');
msg.setField(60, '00000001003');
msg.setField(63, '001');
var tt=msg.pack();
console.log(jspos.ISOUtil.hexString(msg.pack()));
let msgStr = '08000020000000C00012000105303030303037363431313130303030303131313130303200110000000100300003303031';
let unpackMsg = packager.GetPakager.createISOMsg();
unpackMsg.unpack(jspos.ISOUtil.hex2byte(msgStr));
console.log(jspos.ISOUtil.hexString(unpackMsg.pack()));
res.render('index', { title: 'wwwww' });
}
catch (exceptiopn) {
console.log(exceptiopn)
logger2.error(exceptiopn);
}
};
plese helpe me and tell me my problem
thanks
Anyway to generate System Trace Audit Number (STAN)?
JPOS can do this:
String stan = ISOUtil.zeropad(Long.toString(SpaceUtil.nextLong(sp, "STAN") % 1000000L), 6);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.