a8e995f1828bc5e4acde06c6f9cb2496c92f46d5
[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 _0x9163=['request','then','info','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x19712f,_0x1b63a3){var _0x1c795e=function(_0x3cd834){while(--_0x3cd834){_0x19712f['push'](_0x19712f['shift']());}};_0x1c795e(++_0x1b63a3);}(_0x9163,0x1af));var _0x3916=function(_0x4a59d7,_0x33d394){_0x4a59d7=_0x4a59d7-0x0;var _0x3248ef=_0x9163[_0x4a59d7];return _0x3248ef;};'use strict';var _=require(_0x3916('0x0'));var util=require(_0x3916('0x1'));var moment=require(_0x3916('0x2'));var BPromise=require(_0x3916('0x3'));var rs=require(_0x3916('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3916('0x5'));var logger=require(_0x3916('0x6'))('rpc');var config=require(_0x3916('0x7'));var jayson=require(_0x3916('0x8'));var client=jayson[_0x3916('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x580696,_0x161c31,_0x290706){return new BPromise(function(_0x47de2a,_0x4eeb80){return client[_0x3916('0xa')](_0x580696,_0x290706)[_0x3916('0xb')](function(_0x10a63c){logger[_0x3916('0xc')](_0x3916('0xd'),_0x161c31,'request\x20sent');logger[_0x3916('0xe')](_0x3916('0xf'),_0x161c31,_0x3916('0x10'),JSON[_0x3916('0x11')](_0x10a63c));if(_0x10a63c[_0x3916('0x12')]){if(_0x10a63c['error']['code']===0x1f4){logger['error']('License,\x20%s,\x20%s',_0x161c31,_0x10a63c['error'][_0x3916('0x13')]);return _0x4eeb80(_0x10a63c[_0x3916('0x12')][_0x3916('0x13')]);}logger[_0x3916('0x12')](_0x3916('0xd'),_0x161c31,_0x10a63c[_0x3916('0x12')][_0x3916('0x13')]);return _0x47de2a(_0x10a63c[_0x3916('0x12')][_0x3916('0x13')]);}else{logger[_0x3916('0xc')]('License,\x20%s,\x20%s',_0x161c31,'request\x20sent');_0x47de2a(_0x10a63c[_0x3916('0x14')][_0x3916('0x13')]);}})['catch'](function(_0x23e018){logger[_0x3916('0x12')](_0x3916('0xd'),_0x161c31,_0x23e018);_0x4eeb80(_0x23e018);});});}