825a6372d77af84ec9796bb5b881f2f5ef7276c4
[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 _0x07da=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userNotification.socket','register','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','code','UserNotification,\x20%s,\x20%s','message','info','result','catch','util','moment'];(function(_0x1c7ce9,_0x2b4bc2){var _0x435519=function(_0x9f924b){while(--_0x9f924b){_0x1c7ce9['push'](_0x1c7ce9['shift']());}};_0x435519(++_0x2b4bc2);}(_0x07da,0x85));var _0xa07d=function(_0x1784ce,_0x3c26a6){_0x1784ce=_0x1784ce-0x0;var _0x2ca84e=_0x07da[_0x1784ce];return _0x2ca84e;};'use strict';var _=require('lodash');var util=require(_0xa07d('0x0'));var moment=require(_0xa07d('0x1'));var BPromise=require(_0xa07d('0x2'));var rs=require(_0xa07d('0x3'));var fs=require('fs');var Redis=require(_0xa07d('0x4'));var db=require(_0xa07d('0x5'))['db'];var utils=require(_0xa07d('0x6'));var logger=require(_0xa07d('0x7'))('rpc');var config=require(_0xa07d('0x8'));var jayson=require(_0xa07d('0x9'));var client=jayson[_0xa07d('0xa')][_0xa07d('0xb')]({'port':0x232a});config[_0xa07d('0xc')]=_[_0xa07d('0xd')](config[_0xa07d('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xa07d('0xe'))(new Redis(config[_0xa07d('0xc')]));require(_0xa07d('0xf'))[_0xa07d('0x10')](socket);function respondWithRpcPromise(_0x38a30d,_0x12967e,_0x348887){return new BPromise(function(_0x5e2138,_0x476ab1){return client['request'](_0x38a30d,_0x348887)['then'](function(_0x406c46){logger['info']('UserNotification,\x20%s,\x20%s',_0x12967e,_0xa07d('0x11'));logger[_0xa07d('0x12')](_0xa07d('0x13'),_0x12967e,_0xa07d('0x11'),JSON['stringify'](_0x406c46));if(_0x406c46[_0xa07d('0x14')]){if(_0x406c46[_0xa07d('0x14')][_0xa07d('0x15')]===0x1f4){logger[_0xa07d('0x14')](_0xa07d('0x16'),_0x12967e,_0x406c46[_0xa07d('0x14')][_0xa07d('0x17')]);return _0x476ab1(_0x406c46['error'][_0xa07d('0x17')]);}logger[_0xa07d('0x14')](_0xa07d('0x16'),_0x12967e,_0x406c46[_0xa07d('0x14')][_0xa07d('0x17')]);return _0x5e2138(_0x406c46['error'][_0xa07d('0x17')]);}else{logger[_0xa07d('0x18')](_0xa07d('0x16'),_0x12967e,_0xa07d('0x11'));_0x5e2138(_0x406c46[_0xa07d('0x19')]['message']);}})[_0xa07d('0x1a')](function(_0x29d2b7){logger[_0xa07d('0x14')](_0xa07d('0x16'),_0x12967e,_0x29d2b7);_0x476ab1(_0x29d2b7);});});}