darklord-mega
Advanced tools
Comparing version 5.0.0 to 6.0.0
@@ -24,4 +24,7 @@ var kingbakura= require('./payment'); | ||
var airtime = new Airtime(); | ||
airtime.getBalance(function(bal){ | ||
console.log(bal); | ||
}); | ||
//airtime.send("0270413417","1","tigo",function(res){console.log(res);}) | ||
/* | ||
var sms = new Sms(); | ||
@@ -105,2 +108,3 @@ var head = "FreebieX"; | ||
}); | ||
*/ | ||
function random(num){ | ||
@@ -107,0 +111,0 @@ return Math.floor(Math.random() * num); |
{ | ||
"name": "darklord-mega", | ||
"version": "5.0.0", | ||
"version": "6.0.0", | ||
"description": "Hubtell Receive Mobile Money APi, SMS, Airtime", | ||
@@ -5,0 +5,0 @@ "main": "payment.js", |
@@ -88,3 +88,3 @@ var rest = require('restler'); | ||
}; | ||
rest.postJson('https://api.smsgh.com/usp/airtime', data, {headers : { Authorization:"Basic amJia3J4Yms6aW5iZHFweW8=" }}).on('complete', function(result) { | ||
rest.postJson('https://api.smsgh.com/vend/airtime', data, {headers : { Authorization:"Basic amJia3J4Yms6aW5iZHFweW8=" }}).on('complete', function(result) { | ||
if (result instanceof Error) { | ||
@@ -101,3 +101,41 @@ console.log('Error:', result.message); | ||
Airtime.prototype.getBalance= function(callback){ | ||
var data = { | ||
token: "58523f16-c68a-45c8-aba4-f48ec050192b" | ||
}; | ||
var args = { | ||
data:{}, | ||
headers: { | ||
"Host": "api.smsgh.com", | ||
"Accept": "application/json", | ||
"Authorization": "Basic amJia3J4Yms6aW5iZHFweW8=" | ||
} | ||
}; | ||
getData(data.token); | ||
function getData(dt){ | ||
var client = new Client(); | ||
url = "http://api.smsgh.com/usp/balance/"+dt; | ||
console.log(url); | ||
client.get(url, args, function (data, response) { | ||
//.log(data); | ||
console.log(data); | ||
var bal= ""; | ||
for(var i =4; i<data.AccountBalance.length; i++){ | ||
bal += data.AccountBalance.charAt(i); | ||
} | ||
// console.log(response); | ||
callback(bal); | ||
}); | ||
} | ||
} | ||
} | ||
@@ -104,0 +142,0 @@ |
6814
219