d88a6200e1f0185697308bc28bf6f6606f8a394b
[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 _0x4dcf=['request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','License,\x20%s,\x20%s'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x4dcf,0x1c2));var _0xf4dc=function(_0x178216,_0x20a145){_0x178216=_0x178216-0x0;var _0x279c80=_0x4dcf[_0x178216];return _0x279c80;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf4dc('0x0'));var rs=require(_0xf4dc('0x1'));var fs=require('fs');var Redis=require(_0xf4dc('0x2'));var db=require(_0xf4dc('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf4dc('0x4'))(_0xf4dc('0x5'));var config=require('../../config/environment');var jayson=require(_0xf4dc('0x6'));var client=jayson[_0xf4dc('0x7')][_0xf4dc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5833c6,_0x334c27,_0x5ad8cf){return new BPromise(function(_0xf4ff07,_0x302414){return client[_0xf4dc('0x9')](_0x5833c6,_0x5ad8cf)[_0xf4dc('0xa')](function(_0x80e92e){logger['info'](_0xf4dc('0xb'),_0x334c27,_0xf4dc('0xc'));logger[_0xf4dc('0xd')](_0xf4dc('0xe'),_0x334c27,'request\x20sent',JSON['stringify'](_0x80e92e));if(_0x80e92e[_0xf4dc('0xf')]){if(_0x80e92e['error'][_0xf4dc('0x10')]===0x1f4){logger[_0xf4dc('0xf')]('License,\x20%s,\x20%s',_0x334c27,_0x80e92e['error'][_0xf4dc('0x11')]);return _0x302414(_0x80e92e[_0xf4dc('0xf')]['message']);}logger[_0xf4dc('0xf')](_0xf4dc('0xb'),_0x334c27,_0x80e92e[_0xf4dc('0xf')][_0xf4dc('0x11')]);return _0xf4ff07(_0x80e92e['error']['message']);}else{logger[_0xf4dc('0x12')](_0xf4dc('0xb'),_0x334c27,_0xf4dc('0xc'));_0xf4ff07(_0x80e92e[_0xf4dc('0x13')][_0xf4dc('0x11')]);}})[_0xf4dc('0x14')](function(_0x2311c1){logger['error'](_0xf4dc('0xb'),_0x334c27,_0x2311c1);_0x302414(_0x2311c1);});});}