dycodedev / veritrans-node Goto Github PK
View Code? Open in Web Editor NEWVeritrans integration library for node.js
Veritrans integration library for node.js
Hello,
The module works fine when I am in localhost. However, when I am running it on my AWS Machine, it shows error:
syntaxerror: use of const in strict mode
Complete error message as below:
/home/ubuntu/finhop/node_modules/veritrans/index.js:3
const _ = require('lodash');
^^^^^
SyntaxError: Use of const in strict mode.
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
I tried running it on different environment and I use the simple: "node app.js" command to run it.
Any clue? Does this happen to you or anyone else?
As stated in VeriTrans API Documentations, for multiple items inside item_details is supported by having them inside array like the following:
"item_details" : [{/item1/}, {/item2/}, ...]
However, this module does not seem to support the multiple items inside "item_details" and that appears in the validate_transaction.js file, which does not consider the possibility of having "item_details" in array format.
if (utils.hasProperty(payload, 'item_details')) {
if (!utils.hasProperty(payload.item_details, requiredItemDetailsProps)) {
return callback(new Error('item_details field requires: ' + requiredItemDetailsProps + ' fields'));
}
}
Edit:
Further code review seems to indicate the array fails at the following lines:
if (object.constructor !== Object) {
return false;
}
at utils.js
Saya coba bikin simple app pake ExpressJS manfaatin lib ini untuk check status dari orderan saya yg sudah sukses masuk ke Veritrans via Sandbox, berikut code saya:
var PORT = 4040;
var serverKey = "-SERVERKEY-";
var clientKey = "-CLIENTKEY-";
var url = "https://api.sandbox.veritrans.co.id/v2";
const config2 = {
serverKey: serverKey,
clientKey: clientKey,
url: url
};
const Veritrans = require('veritrans');
const vt = new Veritrans(config2);
var http = require('http');
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
app.use(bodyParser.json());
app.use(express.static(__dirname + '/public'));
app.use(bodyParser.json());
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
app.get('/status/:id', function(req, res) {
var id = req.params.id;
console.log(id)
vt.transaction.status(id, (err, result) => {
if (err) {
console.error(err);
return res.redirect('/transaction/' + id);
}
return res.redirect('/transaction/' + id);
});
});
app.listen(PORT, function() {
console.log('Express listening on port ' + PORT + '!');
});
Lalu saya coba GET Request via Postman
http://localhost:4040/status/100030002_prepaid_1462182481
Di Console saya keluar error:
{ [Error: The requested resource is not found] code: '404' }
Padahal orderID ini ada di Sandbox nya
Ini kenapa ya? Apakah saya ada yang kelewatan?
because JSCS merged with ESLINT, So this repo need update standardization. right?
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.