6fb60a707a40e104772ec1396494fb4ffc7e1879
[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 _0x939f=['request','then','info','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x1ade24,_0x1bb417){var _0x31d807=function(_0x4aff7b){while(--_0x4aff7b){_0x1ade24['push'](_0x1ade24['shift']());}};_0x31d807(++_0x1bb417);}(_0x939f,0xe8));var _0xf939=function(_0x1d92f8,_0xe82340){_0x1d92f8=_0x1d92f8-0x0;var _0x56dba3=_0x939f[_0x1d92f8];return _0x56dba3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf939('0x0'));var BPromise=require(_0xf939('0x1'));var rs=require(_0xf939('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf939('0x3'))['db'];var utils=require(_0xf939('0x4'));var logger=require(_0xf939('0x5'))('rpc');var config=require(_0xf939('0x6'));var jayson=require(_0xf939('0x7'));var client=jayson[_0xf939('0x8')][_0xf939('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a218b,_0x15d32b,_0x2e1d12){return new BPromise(function(_0x26e17f,_0x4341e9){return client[_0xf939('0xa')](_0x5a218b,_0x2e1d12)[_0xf939('0xb')](function(_0x11941e){logger[_0xf939('0xc')]('License,\x20%s,\x20%s',_0x15d32b,_0xf939('0xd'));logger['debug'](_0xf939('0xe'),_0x15d32b,'request\x20sent',JSON[_0xf939('0xf')](_0x11941e));if(_0x11941e[_0xf939('0x10')]){if(_0x11941e[_0xf939('0x10')][_0xf939('0x11')]===0x1f4){logger[_0xf939('0x10')](_0xf939('0x12'),_0x15d32b,_0x11941e[_0xf939('0x10')][_0xf939('0x13')]);return _0x4341e9(_0x11941e[_0xf939('0x10')]['message']);}logger['error']('License,\x20%s,\x20%s',_0x15d32b,_0x11941e[_0xf939('0x10')][_0xf939('0x13')]);return _0x26e17f(_0x11941e[_0xf939('0x10')]['message']);}else{logger[_0xf939('0xc')](_0xf939('0x12'),_0x15d32b,_0xf939('0xd'));_0x26e17f(_0x11941e[_0xf939('0x14')]['message']);}})[_0xf939('0x15')](function(_0x152aec){logger['error'](_0xf939('0x12'),_0x15d32b,_0x152aec);_0x4341e9(_0x152aec);});});}