3d560b64e9323d5256aec13458c083acd58b62e2
[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 _0x46a3=['request','then','info','License,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x49ca6b,_0x3ba842){var _0x1d957f=function(_0x12ef94){while(--_0x12ef94){_0x49ca6b['push'](_0x49ca6b['shift']());}};_0x1d957f(++_0x3ba842);}(_0x46a3,0x172));var _0x346a=function(_0x47c298,_0x11408e){_0x47c298=_0x47c298-0x0;var _0x7322f6=_0x46a3[_0x47c298];return _0x7322f6;};'use strict';var _=require(_0x346a('0x0'));var util=require(_0x346a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x346a('0x2'));var fs=require('fs');var Redis=require(_0x346a('0x3'));var db=require(_0x346a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x346a('0x5'))(_0x346a('0x6'));var config=require(_0x346a('0x7'));var jayson=require(_0x346a('0x8'));var client=jayson['client'][_0x346a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x361962,_0x3192b3,_0x34ead8){return new BPromise(function(_0x494749,_0x194209){return client[_0x346a('0xa')](_0x361962,_0x34ead8)[_0x346a('0xb')](function(_0x3d580e){logger[_0x346a('0xc')](_0x346a('0xd'),_0x3192b3,_0x346a('0xe'));logger['debug']('License,\x20%s,\x20%s,\x20%s',_0x3192b3,_0x346a('0xe'),JSON[_0x346a('0xf')](_0x3d580e));if(_0x3d580e[_0x346a('0x10')]){if(_0x3d580e[_0x346a('0x10')][_0x346a('0x11')]===0x1f4){logger['error'](_0x346a('0xd'),_0x3192b3,_0x3d580e['error']['message']);return _0x194209(_0x3d580e[_0x346a('0x10')][_0x346a('0x12')]);}logger[_0x346a('0x10')](_0x346a('0xd'),_0x3192b3,_0x3d580e['error'][_0x346a('0x12')]);return _0x494749(_0x3d580e['error']['message']);}else{logger['info']('License,\x20%s,\x20%s',_0x3192b3,'request\x20sent');_0x494749(_0x3d580e[_0x346a('0x13')]['message']);}})['catch'](function(_0x512221){logger[_0x346a('0x10')](_0x346a('0xd'),_0x3192b3,_0x512221);_0x194209(_0x512221);});});}