0cd873db83310980983396d3688e966e21009a48
[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 _0xdad3=['message','result','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','License,\x20%s,\x20%s','License,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xdad3,0xf9));var _0x3dad=function(_0x4c89b0,_0x53afb3){_0x4c89b0=_0x4c89b0-0x0;var _0x96c5ef=_0xdad3[_0x4c89b0];return _0x96c5ef;};'use strict';var _=require(_0x3dad('0x0'));var util=require('util');var moment=require(_0x3dad('0x1'));var BPromise=require('bluebird');var rs=require(_0x3dad('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3dad('0x3'))['db'];var utils=require(_0x3dad('0x4'));var logger=require(_0x3dad('0x5'))(_0x3dad('0x6'));var config=require(_0x3dad('0x7'));var jayson=require(_0x3dad('0x8'));var client=jayson[_0x3dad('0x9')][_0x3dad('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43eb56,_0x3843d9,_0x2a7366){return new BPromise(function(_0xc266f2,_0x41b1ff){return client['request'](_0x43eb56,_0x2a7366)[_0x3dad('0xb')](function(_0x55d340){logger[_0x3dad('0xc')](_0x3dad('0xd'),_0x3843d9,'request\x20sent');logger['debug'](_0x3dad('0xe'),_0x3843d9,'request\x20sent',JSON[_0x3dad('0xf')](_0x55d340));if(_0x55d340[_0x3dad('0x10')]){if(_0x55d340[_0x3dad('0x10')]['code']===0x1f4){logger['error'](_0x3dad('0xd'),_0x3843d9,_0x55d340[_0x3dad('0x10')][_0x3dad('0x11')]);return _0x41b1ff(_0x55d340[_0x3dad('0x10')][_0x3dad('0x11')]);}logger[_0x3dad('0x10')]('License,\x20%s,\x20%s',_0x3843d9,_0x55d340[_0x3dad('0x10')][_0x3dad('0x11')]);return _0xc266f2(_0x55d340['error']['message']);}else{logger[_0x3dad('0xc')](_0x3dad('0xd'),_0x3843d9,'request\x20sent');_0xc266f2(_0x55d340[_0x3dad('0x12')][_0x3dad('0x11')]);}})['catch'](function(_0x13e499){logger[_0x3dad('0x10')](_0x3dad('0xd'),_0x3843d9,_0x13e499);_0x41b1ff(_0x13e499);});});}