8370848e451a4279fa12c9bf80367f88d91702cd
[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 _0x72a2=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','randomstring'];(function(_0x198f1c,_0x4f760f){var _0xd00475=function(_0x25c9b7){while(--_0x25c9b7){_0x198f1c['push'](_0x198f1c['shift']());}};_0xd00475(++_0x4f760f);}(_0x72a2,0x178));var _0x272a=function(_0x332a47,_0x5ce163){_0x332a47=_0x332a47-0x0;var _0x310607=_0x72a2[_0x332a47];return _0x310607;};'use strict';var _=require(_0x272a('0x0'));var util=require(_0x272a('0x1'));var moment=require('moment');var BPromise=require(_0x272a('0x2'));var rs=require(_0x272a('0x3'));var fs=require('fs');var Redis=require(_0x272a('0x4'));var db=require(_0x272a('0x5'))['db'];var utils=require(_0x272a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x272a('0x7'));var jayson=require(_0x272a('0x8'));var client=jayson[_0x272a('0x9')][_0x272a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58fd5e,_0x95cfae,_0x258921){return new BPromise(function(_0x574eeb,_0x416994){return client['request'](_0x58fd5e,_0x258921)[_0x272a('0xb')](function(_0x1fed97){logger['info'](_0x272a('0xc'),_0x95cfae,_0x272a('0xd'));logger['debug'](_0x272a('0xe'),_0x95cfae,_0x272a('0xd'),JSON['stringify'](_0x1fed97));if(_0x1fed97['error']){if(_0x1fed97[_0x272a('0xf')][_0x272a('0x10')]===0x1f4){logger['error']('License,\x20%s,\x20%s',_0x95cfae,_0x1fed97[_0x272a('0xf')][_0x272a('0x11')]);return _0x416994(_0x1fed97['error'][_0x272a('0x11')]);}logger[_0x272a('0xf')](_0x272a('0xc'),_0x95cfae,_0x1fed97[_0x272a('0xf')][_0x272a('0x11')]);return _0x574eeb(_0x1fed97[_0x272a('0xf')][_0x272a('0x11')]);}else{logger['info'](_0x272a('0xc'),_0x95cfae,_0x272a('0xd'));_0x574eeb(_0x1fed97['result'][_0x272a('0x11')]);}})[_0x272a('0x12')](function(_0x5d31c9){logger[_0x272a('0xf')](_0x272a('0xc'),_0x95cfae,_0x5d31c9);_0x416994(_0x5d31c9);});});}