7632ea135c7b61047d8d466e3b2adc6fa71b4f36
[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 _0x743d=['stringify','error','message','info','util','bluebird','../../mysqldb','rpc','jayson/promise','client','http','request','then','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s'];(function(_0x3f10f8,_0x3ab30a){var _0x569320=function(_0x54107f){while(--_0x54107f){_0x3f10f8['push'](_0x3f10f8['shift']());}};_0x569320(++_0x3ab30a);}(_0x743d,0x6a));var _0xd743=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x743d[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xd743('0x0'));var moment=require('moment');var BPromise=require(_0xd743('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd743('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd743('0x3'));var config=require('../../config/environment');var jayson=require(_0xd743('0x4'));var client=jayson[_0xd743('0x5')][_0xd743('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x24ecec,_0x1d34a1,_0x59d941){return new BPromise(function(_0x248a3d,_0xde675b){return client[_0xd743('0x7')](_0x24ecec,_0x59d941)[_0xd743('0x8')](function(_0x3dba3d){logger['info'](_0xd743('0x9'),_0x1d34a1,_0xd743('0xa'));logger[_0xd743('0xb')](_0xd743('0xc'),_0x1d34a1,'request\x20sent',JSON[_0xd743('0xd')](_0x3dba3d));if(_0x3dba3d[_0xd743('0xe')]){if(_0x3dba3d['error']['code']===0x1f4){logger[_0xd743('0xe')](_0xd743('0x9'),_0x1d34a1,_0x3dba3d[_0xd743('0xe')][_0xd743('0xf')]);return _0xde675b(_0x3dba3d[_0xd743('0xe')]['message']);}logger['error'](_0xd743('0x9'),_0x1d34a1,_0x3dba3d['error'][_0xd743('0xf')]);return _0x248a3d(_0x3dba3d[_0xd743('0xe')][_0xd743('0xf')]);}else{logger[_0xd743('0x10')](_0xd743('0x9'),_0x1d34a1,_0xd743('0xa'));_0x248a3d(_0x3dba3d['result'][_0xd743('0xf')]);}})['catch'](function(_0x4221a1){logger[_0xd743('0xe')]('License,\x20%s,\x20%s',_0x1d34a1,_0x4221a1);_0xde675b(_0x4221a1);});});}