Skip to content

Commit

Permalink
Removed unnecessary object
Browse files Browse the repository at this point in the history
  • Loading branch information
fraudlabspro committed Jul 16, 2021
1 parent bb6f264 commit fd54077
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 43 deletions.
40 changes: 15 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,11 @@ params = {
ship_zip_code: '33602',
ship_country: 'US',
};
flp.validate(params, flpResults);

function flpResults(err, res, data) {
if (!err && res.statusCode == 200) {
flp.validate(params, (err, data) => {
if (!err) {
console.log(data);
}
}
});
```


Expand All @@ -123,13 +121,11 @@ params = {
id: '20170906MXFHSTRF',
id_type: 'fraudlabspro_id',
};
flp.getTransaction(params, flpResults);

function flpResults(err, res, data) {
if (!err && res.statusCode == 200) {
flp.getTransaction(params, (err, data) => {
if (!err) {
console.log(data);
}
}
});
```


Expand All @@ -154,13 +150,11 @@ params = {
action: 'APPROVE',
note: 'This customer made a valid purchase before.',
};
flp.feedback(params, flpResults);

function flpResults(err, res, data) {
if (!err && res.statusCode == 200) {
flp.feedback(params, (err, data) => {
if (!err) {
console.log(data);
}
}
});
```


Expand Down Expand Up @@ -192,13 +186,11 @@ params = {
otp_timeout: 3600,
country_code: 'US',
};
sms.sendSMS(params, flpResults);

function flpResults(err, res, data) {
if (!err && res.statusCode == 200) {
sms.sendSMS(params, (err, data) => {
if (!err) {
console.log(data);
}
}
});
```


Expand All @@ -221,11 +213,9 @@ params = {
tran_id: 'UNIQUE_TRANS_ID',
otp: 'OTP_RECEIVED',
};
sms.verifyOTP(params, flpResults);

function flpResults(err, res, data) {
if (!err && res.statusCode == 200) {
sms.verifyOTP(params, (err, data) => {
if (!err) {
console.log(data);
}
}
});
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fraudlabspro-nodejs",
"version": "2.0.0",
"version": "2.1.0",
"description": "FraudLabs Pro Node.js module enables users to easily implement fraud detection feature using the FraudLabs Pro API.",
"keywords": ["fraud prevention", "fraud detection", "fraud checker", "fraudlabs pro", "fraudlabspro", "fraud protection"],
"homepage": "https://github.com/fraudlabspro/fraudlabspro-nodejs",
Expand Down
12 changes: 6 additions & 6 deletions src/fraudlabspro.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var https = require('https');
var crypto = require('crypto');
var VERSION = '2.0.0';
var VERSION = '2.1.0';
var SOURCE = 'FraudLabsPro Node.js SDK';
var FORMAT = 'json';

Expand Down Expand Up @@ -136,7 +136,7 @@ class FraudValidation {
let req = https.request(options, function (res) {
res.on('data', (chunk) => (d = d + chunk));
res.on('end', function () {
callback(null, res, JSON.parse(d));
callback(null, JSON.parse(d));
});
});

Expand Down Expand Up @@ -184,7 +184,7 @@ class FraudValidation {
let req = https.request(options, function (res) {
res.on('data', (chunk) => (d = d + chunk));
res.on('end', function () {
callback(null, res, JSON.parse(d));
callback(null, JSON.parse(d));
});
});

Expand Down Expand Up @@ -220,7 +220,7 @@ class FraudValidation {
let req = https.get(urlStr, function (res) {
res.on('data', (chunk) => (d = d + chunk));
res.on('end', function () {
callback(null, res, JSON.parse(d));
callback(null, JSON.parse(d));
});
});

Expand Down Expand Up @@ -275,7 +275,7 @@ class SMSVerification {
let req = https.request(options, function (res) {
res.on('data', (chunk) => (d = d + chunk));
res.on('end', function () {
callback(null, res, JSON.parse(d));
callback(null, JSON.parse(d));
});
});

Expand Down Expand Up @@ -322,7 +322,7 @@ class SMSVerification {
let req = https.request(options, function (res) {
res.on('data', (chunk) => (d = d + chunk));
res.on('end', function () {
callback(null, res, JSON.parse(d));
callback(null, JSON.parse(d));
});
});

Expand Down
36 changes: 25 additions & 11 deletions src/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,48 @@
// params = {
// ip: '8.8.8.8'
// };
// flp.validate(params, flpResults);
// flp.validate(params, (err, data) => {
// if (!err) {
// console.log(data);
// }
// });

// params = {
// id: '20210716AZ1ZIC',
// action: 'REJECT',
// };
// flp.feedback(params, flpResults);
// flp.feedback(params, (err, data) => {
// if (!err) {
// console.log(data);
// }
// });

// params = {
// id: '20210716AZ1ZIC',
// id_type: 'fraudlabspro_id',
// };
// flp.getTransaction(params, flpResults);
// flp.getTransaction(params, (err, data) => {
// if (!err) {
// console.log(data);
// }
// });

// params = {
// tel: '+1234567890',
// mesg: 'Hello, your OTP is <otp>.',
// };
// sms.sendSMS(params, flpResults);
// sms.sendSMS(params, (err, data) => {
// if (!err) {
// console.log(data);
// }
// });

// params = {
// tran_id: 'fG8Ee2w88DBD3HjzBz0',
// otp: '649114',
// };
// sms.verifyOTP(params, flpResults);

function flpResults(err, res, data) {
if (!err && res.statusCode == 200) {
console.log(data);
}
}
// sms.verifyOTP(params, (err, data) => {
// if (!err) {
// console.log(data);
// }
// });

0 comments on commit fd54077

Please sign in to comment.