var http = require('http');

module.exports = {
	pinRequest: 
		function(phone)
		{
			var options={
				host:"sms.jibbrapp.com",
				path:"send",
				headers: {
					signature: require('../config/signature.js').signature
				}
			};
			var req = http.request(options);
			req.write(JSON.stringify({
				mobile: phone,
				token: generatePin()
			}));
			req.end();
		}
}

function generatePin() {
	var token = "0000" + Math.floor(Math.random()*(10000));
	return token.substr(token.length - 4);
}

@@ -261,16 +261,44 @@
 options)
+,%0A%09%09%09%09%09token = generatePin()
 ;%0A%09%09%09req
@@ -351,29 +351,105 @@
 %09token: 
-generatePin()
+token,%0A%09%09%09%09text: %22Your pin is %22 + token + %22 is valid for nex 5 min.%22,%0A%09%09%09%09callback: null%09
 %0A%09%09%09%7D));

generate sms message here