890e2406b14a10e85146fe09563b10c048562420
[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 _0xa8e1=['rpc','jayson/promise','http','request','then','info','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','License,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x6ef3b6,_0x5628b3){var _0x4dd8db=function(_0x4a565d){while(--_0x4a565d){_0x6ef3b6['push'](_0x6ef3b6['shift']());}};_0x4dd8db(++_0x5628b3);}(_0xa8e1,0x197));var _0x1a8e=function(_0x3b5049,_0x495a94){_0x3b5049=_0x3b5049-0x0;var _0x12454e=_0xa8e1[_0x3b5049];return _0x12454e;};'use strict';var _=require(_0x1a8e('0x0'));var util=require(_0x1a8e('0x1'));var moment=require('moment');var BPromise=require(_0x1a8e('0x2'));var rs=require(_0x1a8e('0x3'));var fs=require('fs');var Redis=require(_0x1a8e('0x4'));var db=require(_0x1a8e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1a8e('0x6'))(_0x1a8e('0x7'));var config=require('../../config/environment');var jayson=require(_0x1a8e('0x8'));var client=jayson['client'][_0x1a8e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29db0e,_0x25c742,_0x2f836e){return new BPromise(function(_0x3b7af7,_0x54233f){return client[_0x1a8e('0xa')](_0x29db0e,_0x2f836e)[_0x1a8e('0xb')](function(_0x3c5698){logger[_0x1a8e('0xc')]('License,\x20%s,\x20%s',_0x25c742,'request\x20sent');logger[_0x1a8e('0xd')](_0x1a8e('0xe'),_0x25c742,_0x1a8e('0xf'),JSON[_0x1a8e('0x10')](_0x3c5698));if(_0x3c5698[_0x1a8e('0x11')]){if(_0x3c5698['error'][_0x1a8e('0x12')]===0x1f4){logger[_0x1a8e('0x11')](_0x1a8e('0x13'),_0x25c742,_0x3c5698['error'][_0x1a8e('0x14')]);return _0x54233f(_0x3c5698['error'][_0x1a8e('0x14')]);}logger[_0x1a8e('0x11')](_0x1a8e('0x13'),_0x25c742,_0x3c5698[_0x1a8e('0x11')][_0x1a8e('0x14')]);return _0x3b7af7(_0x3c5698[_0x1a8e('0x11')][_0x1a8e('0x14')]);}else{logger[_0x1a8e('0xc')](_0x1a8e('0x13'),_0x25c742,_0x1a8e('0xf'));_0x3b7af7(_0x3c5698[_0x1a8e('0x15')][_0x1a8e('0x14')]);}})[_0x1a8e('0x16')](function(_0x5d9793){logger['error']('License,\x20%s,\x20%s',_0x25c742,_0x5d9793);_0x54233f(_0x5d9793);});});}