Built motion from commit (unavailable).|2.5.2
[motion2.git] / server / api / license / license.rpc.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0xceb0=['../../config/logger','jayson/promise','client','http','then','info','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','License,\x20%s,\x20%s','message','result','randomstring','../../mysqldb','../../config/utils'];(function(_0x28d9de,_0x4740ee){var _0x59b604=function(_0x5dc579){while(--_0x5dc579){_0x28d9de['push'](_0x28d9de['shift']());}};_0x59b604(++_0x4740ee);}(_0xceb0,0x173));var _0x0ceb=function(_0x35413a,_0x1ef4e7){_0x35413a=_0x35413a-0x0;var _0x296ded=_0xceb0[_0x35413a];return _0x296ded;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0ceb('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ceb('0x1'))['db'];var utils=require(_0x0ceb('0x2'));var logger=require(_0x0ceb('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0ceb('0x4'));var client=jayson[_0x0ceb('0x5')][_0x0ceb('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x52e6bb,_0x448bf8,_0x19e438){return new BPromise(function(_0x4ec03a,_0x9e53b7){return client['request'](_0x52e6bb,_0x19e438)[_0x0ceb('0x7')](function(_0x3e71f4){logger[_0x0ceb('0x8')]('License,\x20%s,\x20%s',_0x448bf8,'request\x20sent');logger[_0x0ceb('0x9')](_0x0ceb('0xa'),_0x448bf8,_0x0ceb('0xb'),JSON[_0x0ceb('0xc')](_0x3e71f4));if(_0x3e71f4[_0x0ceb('0xd')]){if(_0x3e71f4[_0x0ceb('0xd')]['code']===0x1f4){logger[_0x0ceb('0xd')](_0x0ceb('0xe'),_0x448bf8,_0x3e71f4[_0x0ceb('0xd')][_0x0ceb('0xf')]);return _0x9e53b7(_0x3e71f4[_0x0ceb('0xd')][_0x0ceb('0xf')]);}logger[_0x0ceb('0xd')]('License,\x20%s,\x20%s',_0x448bf8,_0x3e71f4[_0x0ceb('0xd')]['message']);return _0x4ec03a(_0x3e71f4['error'][_0x0ceb('0xf')]);}else{logger[_0x0ceb('0x8')](_0x0ceb('0xe'),_0x448bf8,'request\x20sent');_0x4ec03a(_0x3e71f4[_0x0ceb('0x10')][_0x0ceb('0xf')]);}})['catch'](function(_0x1dc6f5){logger[_0x0ceb('0xd')](_0x0ceb('0xe'),_0x448bf8,_0x1dc6f5);_0x9e53b7(_0x1dc6f5);});});}