3cc9f1f0b86b5d1c98ce9a1dc7e5c125292fac19
[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 _0x5304=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','License,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x5ec983,_0x466c52){var _0xba7456=function(_0x585179){while(--_0x585179){_0x5ec983['push'](_0x5ec983['shift']());}};_0xba7456(++_0x466c52);}(_0x5304,0x1ca));var _0x4530=function(_0x5d8018,_0x588592){_0x5d8018=_0x5d8018-0x0;var _0x151ac4=_0x5304[_0x5d8018];return _0x151ac4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4530('0x0'));var BPromise=require(_0x4530('0x1'));var rs=require(_0x4530('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4530('0x3'));var logger=require(_0x4530('0x4'))(_0x4530('0x5'));var config=require(_0x4530('0x6'));var jayson=require(_0x4530('0x7'));var client=jayson['client'][_0x4530('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x356abf,_0x49308f,_0x558823){return new BPromise(function(_0x171310,_0x5ca90d){return client[_0x4530('0x9')](_0x356abf,_0x558823)[_0x4530('0xa')](function(_0x3febb3){logger[_0x4530('0xb')]('License,\x20%s,\x20%s',_0x49308f,_0x4530('0xc'));logger[_0x4530('0xd')](_0x4530('0xe'),_0x49308f,_0x4530('0xc'),JSON['stringify'](_0x3febb3));if(_0x3febb3[_0x4530('0xf')]){if(_0x3febb3[_0x4530('0xf')][_0x4530('0x10')]===0x1f4){logger['error'](_0x4530('0x11'),_0x49308f,_0x3febb3['error'][_0x4530('0x12')]);return _0x5ca90d(_0x3febb3[_0x4530('0xf')][_0x4530('0x12')]);}logger[_0x4530('0xf')](_0x4530('0x11'),_0x49308f,_0x3febb3[_0x4530('0xf')][_0x4530('0x12')]);return _0x171310(_0x3febb3[_0x4530('0xf')]['message']);}else{logger[_0x4530('0xb')](_0x4530('0x11'),_0x49308f,_0x4530('0xc'));_0x171310(_0x3febb3[_0x4530('0x13')][_0x4530('0x12')]);}})[_0x4530('0x14')](function(_0x76f6c5){logger[_0x4530('0xf')](_0x4530('0x11'),_0x49308f,_0x76f6c5);_0x5ca90d(_0x76f6c5);});});}