fe65cca3a7304883a977404f750f086cee27fcef
[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 _0x151b=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x33ac3f,_0x637043){var _0x3f5274=function(_0x1ac65a){while(--_0x1ac65a){_0x33ac3f['push'](_0x33ac3f['shift']());}};_0x3f5274(++_0x637043);}(_0x151b,0x153));var _0xb151=function(_0x2960c0,_0x32966b){_0x2960c0=_0x2960c0-0x0;var _0x78a13b=_0x151b[_0x2960c0];return _0x78a13b;};'use strict';var _=require(_0xb151('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb151('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb151('0x2'));var db=require(_0xb151('0x3'))['db'];var utils=require(_0xb151('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xb151('0x5'));var jayson=require(_0xb151('0x6'));var client=jayson['client'][_0xb151('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4ba994,_0xd89657,_0x352713){return new BPromise(function(_0x46fdb0,_0x484caf){return client['request'](_0x4ba994,_0x352713)[_0xb151('0x8')](function(_0x20f1b2){logger['info']('License,\x20%s,\x20%s',_0xd89657,_0xb151('0x9'));logger[_0xb151('0xa')](_0xb151('0xb'),_0xd89657,_0xb151('0x9'),JSON[_0xb151('0xc')](_0x20f1b2));if(_0x20f1b2[_0xb151('0xd')]){if(_0x20f1b2[_0xb151('0xd')][_0xb151('0xe')]===0x1f4){logger[_0xb151('0xd')](_0xb151('0xf'),_0xd89657,_0x20f1b2['error'][_0xb151('0x10')]);return _0x484caf(_0x20f1b2['error'][_0xb151('0x10')]);}logger[_0xb151('0xd')](_0xb151('0xf'),_0xd89657,_0x20f1b2[_0xb151('0xd')]['message']);return _0x46fdb0(_0x20f1b2[_0xb151('0xd')][_0xb151('0x10')]);}else{logger[_0xb151('0x11')]('License,\x20%s,\x20%s',_0xd89657,'request\x20sent');_0x46fdb0(_0x20f1b2[_0xb151('0x12')]['message']);}})[_0xb151('0x13')](function(_0x4ca435){logger[_0xb151('0xd')]('License,\x20%s,\x20%s',_0xd89657,_0x4ca435);_0x484caf(_0x4ca435);});});}