2fa9c96a78355fdc9d11c2e26d691b0e7e353feb
[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 _0x64f1=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring'];(function(_0x3e81d0,_0x10c528){var _0x5401af=function(_0x1ece6c){while(--_0x1ece6c){_0x3e81d0['push'](_0x3e81d0['shift']());}};_0x5401af(++_0x10c528);}(_0x64f1,0x81));var _0x164f=function(_0xbb9dbf,_0x5dafa4){_0xbb9dbf=_0xbb9dbf-0x0;var _0x30223c=_0x64f1[_0xbb9dbf];return _0x30223c;};'use strict';var _=require(_0x164f('0x0'));var util=require(_0x164f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x164f('0x2'));var fs=require('fs');var Redis=require(_0x164f('0x3'));var db=require(_0x164f('0x4'))['db'];var utils=require(_0x164f('0x5'));var logger=require(_0x164f('0x6'))(_0x164f('0x7'));var config=require(_0x164f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x164f('0x9')][_0x164f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4167f8,_0x2139d2,_0x27bb44){return new BPromise(function(_0x1f11ed,_0x25d7c0){return client['request'](_0x4167f8,_0x27bb44)['then'](function(_0x4d6b82){logger[_0x164f('0xb')](_0x164f('0xc'),_0x2139d2,_0x164f('0xd'));logger[_0x164f('0xe')](_0x164f('0xf'),_0x2139d2,_0x164f('0xd'),JSON[_0x164f('0x10')](_0x4d6b82));if(_0x4d6b82[_0x164f('0x11')]){if(_0x4d6b82[_0x164f('0x11')][_0x164f('0x12')]===0x1f4){logger[_0x164f('0x11')]('License,\x20%s,\x20%s',_0x2139d2,_0x4d6b82[_0x164f('0x11')][_0x164f('0x13')]);return _0x25d7c0(_0x4d6b82[_0x164f('0x11')]['message']);}logger[_0x164f('0x11')](_0x164f('0xc'),_0x2139d2,_0x4d6b82[_0x164f('0x11')][_0x164f('0x13')]);return _0x1f11ed(_0x4d6b82['error'][_0x164f('0x13')]);}else{logger[_0x164f('0xb')](_0x164f('0xc'),_0x2139d2,_0x164f('0xd'));_0x1f11ed(_0x4d6b82[_0x164f('0x14')]['message']);}})[_0x164f('0x15')](function(_0x57f5a5){logger[_0x164f('0x11')]('License,\x20%s,\x20%s',_0x2139d2,_0x57f5a5);_0x25d7c0(_0x57f5a5);});});}