0f773688e3eb9167850d150cb12fa7ca60c70a7f
[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 _0x5f05=['bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','moment'];(function(_0x56daff,_0xadca9a){var _0x132c82=function(_0x19e0d7){while(--_0x19e0d7){_0x56daff['push'](_0x56daff['shift']());}};_0x132c82(++_0xadca9a);}(_0x5f05,0x1e1));var _0x55f0=function(_0x1e9b1a,_0x51ee65){_0x1e9b1a=_0x1e9b1a-0x0;var _0x47681d=_0x5f05[_0x1e9b1a];return _0x47681d;};'use strict';var _=require(_0x55f0('0x0'));var util=require('util');var moment=require(_0x55f0('0x1'));var BPromise=require(_0x55f0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x55f0('0x3'))['db'];var utils=require(_0x55f0('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x55f0('0x5'));var jayson=require(_0x55f0('0x6'));var client=jayson[_0x55f0('0x7')][_0x55f0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ac2d2,_0x48ee8a,_0x1c51e4){return new BPromise(function(_0x56947b,_0x372b6f){return client[_0x55f0('0x9')](_0x3ac2d2,_0x1c51e4)[_0x55f0('0xa')](function(_0x558d46){logger['info'](_0x55f0('0xb'),_0x48ee8a,_0x55f0('0xc'));logger[_0x55f0('0xd')](_0x55f0('0xe'),_0x48ee8a,'request\x20sent',JSON[_0x55f0('0xf')](_0x558d46));if(_0x558d46['error']){if(_0x558d46[_0x55f0('0x10')][_0x55f0('0x11')]===0x1f4){logger[_0x55f0('0x10')](_0x55f0('0xb'),_0x48ee8a,_0x558d46[_0x55f0('0x10')][_0x55f0('0x12')]);return _0x372b6f(_0x558d46[_0x55f0('0x10')][_0x55f0('0x12')]);}logger[_0x55f0('0x10')](_0x55f0('0xb'),_0x48ee8a,_0x558d46[_0x55f0('0x10')]['message']);return _0x56947b(_0x558d46[_0x55f0('0x10')][_0x55f0('0x12')]);}else{logger[_0x55f0('0x13')](_0x55f0('0xb'),_0x48ee8a,_0x55f0('0xc'));_0x56947b(_0x558d46['result']['message']);}})[_0x55f0('0x14')](function(_0x4f5b0f){logger['error'](_0x55f0('0xb'),_0x48ee8a,_0x4f5b0f);_0x372b6f(_0x4f5b0f);});});}