bd8dbf14f4159a749ad0d98f11cf9b7d14363eda
[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 _0xc5b6=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util'];(function(_0x6ffc3d,_0x3fd67d){var _0x4a83fc=function(_0x23b846){while(--_0x23b846){_0x6ffc3d['push'](_0x6ffc3d['shift']());}};_0x4a83fc(++_0x3fd67d);}(_0xc5b6,0xe2));var _0x6c5b=function(_0x36c72c,_0x144535){_0x36c72c=_0x36c72c-0x0;var _0x3f6f1b=_0xc5b6[_0x36c72c];return _0x3f6f1b;};'use strict';var _=require(_0x6c5b('0x0'));var util=require(_0x6c5b('0x1'));var moment=require(_0x6c5b('0x2'));var BPromise=require(_0x6c5b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c5b('0x4'))['db'];var utils=require(_0x6c5b('0x5'));var logger=require(_0x6c5b('0x6'))(_0x6c5b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6c5b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6441a0,_0x4aeaee,_0x319378){return new BPromise(function(_0x1118a7,_0x46c19){return client[_0x6c5b('0x9')](_0x6441a0,_0x319378)[_0x6c5b('0xa')](function(_0x72c41){logger[_0x6c5b('0xb')](_0x6c5b('0xc'),_0x4aeaee,_0x6c5b('0xd'));logger['debug'](_0x6c5b('0xe'),_0x4aeaee,_0x6c5b('0xd'),JSON['stringify'](_0x72c41));if(_0x72c41[_0x6c5b('0xf')]){if(_0x72c41[_0x6c5b('0xf')][_0x6c5b('0x10')]===0x1f4){logger[_0x6c5b('0xf')]('License,\x20%s,\x20%s',_0x4aeaee,_0x72c41[_0x6c5b('0xf')][_0x6c5b('0x11')]);return _0x46c19(_0x72c41[_0x6c5b('0xf')]['message']);}logger[_0x6c5b('0xf')](_0x6c5b('0xc'),_0x4aeaee,_0x72c41['error'][_0x6c5b('0x11')]);return _0x1118a7(_0x72c41[_0x6c5b('0xf')][_0x6c5b('0x11')]);}else{logger[_0x6c5b('0xb')](_0x6c5b('0xc'),_0x4aeaee,_0x6c5b('0xd'));_0x1118a7(_0x72c41['result'][_0x6c5b('0x11')]);}})[_0x6c5b('0x12')](function(_0x480e6a){logger[_0x6c5b('0xf')](_0x6c5b('0xc'),_0x4aeaee,_0x480e6a);_0x46c19(_0x480e6a);});});}