Built motion from commit 85328c08.|2.5.50
[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 _0xae1f=['info','License,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','request','then'];(function(_0x2b62c8,_0x36c80b){var _0x569ebb=function(_0x1f2f37){while(--_0x1f2f37){_0x2b62c8['push'](_0x2b62c8['shift']());}};_0x569ebb(++_0x36c80b);}(_0xae1f,0x15f));var _0xfae1=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xae1f[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0xfae1('0x0'));var util=require(_0xfae1('0x1'));var moment=require(_0xfae1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfae1('0x3'));var db=require(_0xfae1('0x4'))['db'];var utils=require(_0xfae1('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xfae1('0x6'));var client=jayson[_0xfae1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x425165,_0x4eced4,_0x33b40e){return new BPromise(function(_0x25684d,_0x53350e){return client[_0xfae1('0x8')](_0x425165,_0x33b40e)[_0xfae1('0x9')](function(_0x53145f){logger[_0xfae1('0xa')](_0xfae1('0xb'),_0x4eced4,_0xfae1('0xc'));logger[_0xfae1('0xd')]('License,\x20%s,\x20%s,\x20%s',_0x4eced4,_0xfae1('0xc'),JSON[_0xfae1('0xe')](_0x53145f));if(_0x53145f[_0xfae1('0xf')]){if(_0x53145f[_0xfae1('0xf')][_0xfae1('0x10')]===0x1f4){logger[_0xfae1('0xf')]('License,\x20%s,\x20%s',_0x4eced4,_0x53145f[_0xfae1('0xf')][_0xfae1('0x11')]);return _0x53350e(_0x53145f['error']['message']);}logger[_0xfae1('0xf')](_0xfae1('0xb'),_0x4eced4,_0x53145f[_0xfae1('0xf')][_0xfae1('0x11')]);return _0x25684d(_0x53145f[_0xfae1('0xf')][_0xfae1('0x11')]);}else{logger['info']('License,\x20%s,\x20%s',_0x4eced4,_0xfae1('0xc'));_0x25684d(_0x53145f['result'][_0xfae1('0x11')]);}})[_0xfae1('0x12')](function(_0x33c2ed){logger['error'](_0xfae1('0xb'),_0x4eced4,_0x33c2ed);_0x53350e(_0x33c2ed);});});}