Built motion from commit eddce310.|2.6.12
[motion2.git] / server / api / userNotification / userNotification.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 _0xebc2=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','then','info','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserNotification,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis'];(function(_0x54856c,_0xfa85b){var _0x2ca74b=function(_0x33ed88){while(--_0x33ed88){_0x54856c['push'](_0x54856c['shift']());}};_0x2ca74b(++_0xfa85b);}(_0xebc2,0x1a0));var _0x2ebc=function(_0x2b8894,_0x2aa8e8){_0x2b8894=_0x2b8894-0x0;var _0x389679=_0xebc2[_0x2b8894];return _0x389679;};'use strict';var _=require('lodash');var util=require(_0x2ebc('0x0'));var moment=require(_0x2ebc('0x1'));var BPromise=require(_0x2ebc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ebc('0x3'));var db=require(_0x2ebc('0x4'))['db'];var utils=require(_0x2ebc('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x2ebc('0x6'));var jayson=require(_0x2ebc('0x7'));var client=jayson[_0x2ebc('0x8')][_0x2ebc('0x9')]({'port':0x232a});config['redis']=_[_0x2ebc('0xa')](config[_0x2ebc('0xb')],{'host':_0x2ebc('0xc'),'port':0x18eb});var socket=require(_0x2ebc('0xd'))(new Redis(config[_0x2ebc('0xb')]));require(_0x2ebc('0xe'))[_0x2ebc('0xf')](socket);function respondWithRpcPromise(_0x428085,_0x2a7d80,_0x19fced){return new BPromise(function(_0x20eef3,_0x30c8f8){return client['request'](_0x428085,_0x19fced)[_0x2ebc('0x10')](function(_0x407b92){logger[_0x2ebc('0x11')]('UserNotification,\x20%s,\x20%s',_0x2a7d80,'request\x20sent');logger[_0x2ebc('0x12')](_0x2ebc('0x13'),_0x2a7d80,_0x2ebc('0x14'),JSON[_0x2ebc('0x15')](_0x407b92));if(_0x407b92[_0x2ebc('0x16')]){if(_0x407b92['error'][_0x2ebc('0x17')]===0x1f4){logger[_0x2ebc('0x16')](_0x2ebc('0x18'),_0x2a7d80,_0x407b92[_0x2ebc('0x16')][_0x2ebc('0x19')]);return _0x30c8f8(_0x407b92[_0x2ebc('0x16')][_0x2ebc('0x19')]);}logger['error']('UserNotification,\x20%s,\x20%s',_0x2a7d80,_0x407b92[_0x2ebc('0x16')]['message']);return _0x20eef3(_0x407b92[_0x2ebc('0x16')][_0x2ebc('0x19')]);}else{logger['info'](_0x2ebc('0x18'),_0x2a7d80,_0x2ebc('0x14'));_0x20eef3(_0x407b92[_0x2ebc('0x1a')][_0x2ebc('0x19')]);}})[_0x2ebc('0x1b')](function(_0x5ec751){logger[_0x2ebc('0x16')](_0x2ebc('0x18'),_0x2a7d80,_0x5ec751);_0x30c8f8(_0x5ec751);});});}