New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

tuc

Package Overview
Dependencies
Maintainers
4
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tuc - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

test/balance.js

3

example/balance.js

@@ -10,5 +10,2 @@ // require library

// enable debug;
tuc.setDebug(false);
// call method getBalance

@@ -15,0 +12,0 @@ tuc.getBalance(number, (balance) => {

@@ -10,5 +10,2 @@ // require library

// enable debug;
tuc.setDebug(false);
// call method getType

@@ -15,0 +12,0 @@ tuc.getType(number, (balance) => {

'use strict';
const debug = require('debug')('tuc');
const randomstring = require('randomstring');

@@ -6,6 +7,12 @@ const request = require('request');

const INVALID_FORMAT = 100;
const HTTP_REQUEST_ERROR = 101;
const EMPTY_RESPONSE = 102;
const INVALID_RESPONSE = 103;
const INACTIVE = 104;
let captcha = randomstring.generate({
length: 6,
charset: '123456789',
});;
});

@@ -23,18 +30,9 @@ /**

/**
* Enable or disable show debug
* @debug {boolean}
*/
setDebug(debug) {
if (typeof debug === 'boolean') {
this.debug = debug;
}
}
/**
* Create a object error
*/
error(message) {
error(message, code) {
let error = {
error: {
message: message,
code: code,
},

@@ -68,11 +66,5 @@ };

callback(
_this.error('El formato no es correcto. El formato correcto es 00000000.')
_this.error('El formato no es correcto. El formato correcto es 00000000.', INVALID_FORMAT)
);
} else {
// init request settings
request.defaults({
strictSSL: false, // allow us to use our _this-signed cert for testing
rejectUnauthorized: false,
});
let options = {

@@ -88,9 +80,8 @@ url: _this.url,

request.post(options, (error, response, body) => {
if (_this.debug) {
console.log(body);
}
debug('Status Code: %d', response.statusCode);
debug(body);
if (error) {
callback(
_this.error(error)
_this.error(error, HTTP_REQUEST_ERROR)
);

@@ -102,4 +93,5 @@ } else {

} catch (e) {
console.log(e.message);
callback(
_this.error('El sitio www.mpeso.net está presentando problemas en la consulta del saldo.')
_this.error('El sitio www.mpeso.net está presentando problemas en la consulta del saldo.', EMPTY_RESPONSE)
);

@@ -109,3 +101,3 @@ }

callback(
_this.error('Error al intentar conectarse con el sitio www.mpeso.net')
_this.error('Error al intentar conectarse con el sitio www.mpeso.net', INVALID_RESPONSE)
);

@@ -133,2 +125,5 @@ }

getBalance(number, callback) {
debug('Method: Balance');
debug('Card: %s', number);
// set context on _this

@@ -157,3 +152,3 @@ let _this = this;

callback(
_this.error(`${form._terminal} está inactivo`)
_this.error(`${form._terminal} está inactivo`, INACTIVE)
);

@@ -164,3 +159,3 @@ }

callback(
_this.error('Respuesta inválida del servidor')
_this.error('Respuesta inválida del servidor', INVALID_RESPONSE)
);

@@ -177,2 +172,5 @@ }

getType(number, callback) {
debug('Method: Type');
debug('Card: %s', number);
// set context on _this

@@ -204,3 +202,3 @@ let _this = this;

callback(
_this.error(`${form._terminal} está inactivo`)
_this.error(`${form._terminal} está inactivo`, INACTIVE)
);

@@ -207,0 +205,0 @@ }

{
"name": "tuc",
"version": "0.1.0",
"version": "0.1.1",
"description": "TUC Client for Node.js",
"author": "Paulo McNally <paulomcnally@gmail.com>",
"scripts": {
"test": "node_modules/mocha/bin/mocha"
},
"contributors": [

@@ -14,2 +17,6 @@ {

"email": "om.cortez.2010@gmail.com"
},
{
"name": "Bruce Lampson",
"email": "brucelampson@gmail.com"
}

@@ -27,5 +34,6 @@ ],

"dependencies": {
"debug": "2.2.0",
"randomstring": "1.1.5",
"request": "~2.34.0",
"string": "~1.8.0"
"request": "~2.72.0",
"string": "~3.3.1"
},

@@ -39,3 +47,7 @@ "bugs": {

"url": "git://github.com/nodenica/node-tuc.git"
},
"devDependencies": {
"is_js": "0.8.0",
"mocha": "2.5.3"
}
}

@@ -13,16 +13,19 @@ # TUC

var Tuc = require('tuc');
// require library
const Tuc = require('tuc');
var tuc = new Tuc();
// instance class
const tuc = new Tuc();
tuc.getBalance('00759795', function( balance ){
// set number
let number = '00758888';
console.log( balance );
// call method getBalance
tuc.getBalance(number, (balance) => {
console.log(balance);
});
tuc.getType('00759795', function( type ){
console.log( type );
// call method getType
tuc.getType(number, (balance) => {
console.log(balance);
});

@@ -40,3 +43,4 @@

* [robe007](https://github.com/robe007)
* [oscarmcm](https://github.com/oscarmcm)
This is a unoficial client. For more info visit [https://mpeso.net/](https://mpeso.net/)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc