Built motion from commit 0900f080.|2.5.45
[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 _0x0934=['UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserNotification,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','redis','defaults','localhost','./userNotification.socket','register','then','info','debug'];(function(_0x34a087,_0x4bd68e){var _0x5c15d7=function(_0x152823){while(--_0x152823){_0x34a087['push'](_0x34a087['shift']());}};_0x5c15d7(++_0x4bd68e);}(_0x0934,0x168));var _0x4093=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x0934[_0x494d1f];return _0x457b6e;};'use strict';var _=require(_0x4093('0x0'));var util=require(_0x4093('0x1'));var moment=require(_0x4093('0x2'));var BPromise=require(_0x4093('0x3'));var rs=require(_0x4093('0x4'));var fs=require('fs');var Redis=require(_0x4093('0x5'));var db=require(_0x4093('0x6'))['db'];var utils=require(_0x4093('0x7'));var logger=require(_0x4093('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4093('0x9')]['http']({'port':0x232a});config[_0x4093('0xa')]=_[_0x4093('0xb')](config[_0x4093('0xa')],{'host':_0x4093('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4093('0xa')]));require(_0x4093('0xd'))[_0x4093('0xe')](socket);function respondWithRpcPromise(_0x59bbfb,_0x3ae94e,_0x270d3e){return new BPromise(function(_0x45eb96,_0xb2107d){return client['request'](_0x59bbfb,_0x270d3e)[_0x4093('0xf')](function(_0x3fd6ed){logger[_0x4093('0x10')]('UserNotification,\x20%s,\x20%s',_0x3ae94e,'request\x20sent');logger[_0x4093('0x11')](_0x4093('0x12'),_0x3ae94e,_0x4093('0x13'),JSON[_0x4093('0x14')](_0x3fd6ed));if(_0x3fd6ed[_0x4093('0x15')]){if(_0x3fd6ed[_0x4093('0x15')][_0x4093('0x16')]===0x1f4){logger[_0x4093('0x15')](_0x4093('0x17'),_0x3ae94e,_0x3fd6ed[_0x4093('0x15')][_0x4093('0x18')]);return _0xb2107d(_0x3fd6ed[_0x4093('0x15')][_0x4093('0x18')]);}logger[_0x4093('0x15')](_0x4093('0x17'),_0x3ae94e,_0x3fd6ed[_0x4093('0x15')][_0x4093('0x18')]);return _0x45eb96(_0x3fd6ed[_0x4093('0x15')][_0x4093('0x18')]);}else{logger['info'](_0x4093('0x17'),_0x3ae94e,_0x4093('0x13'));_0x45eb96(_0x3fd6ed[_0x4093('0x19')][_0x4093('0x18')]);}})[_0x4093('0x1a')](function(_0x3016ee){logger[_0x4093('0x15')](_0x4093('0x17'),_0x3ae94e,_0x3016ee);_0xb2107d(_0x3016ee);});});}