Built motion from commit 19a84241.|2.5.34
[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 _0x3e8f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','client','redis','defaults','localhost','./userNotification.socket','register','request','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring'];(function(_0x3d8ca8,_0x1a9764){var _0x517e45=function(_0x641ad9){while(--_0x641ad9){_0x3d8ca8['push'](_0x3d8ca8['shift']());}};_0x517e45(++_0x1a9764);}(_0x3e8f,0x9c));var _0xf3e8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e8f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf3e8('0x0'));var util=require(_0xf3e8('0x1'));var moment=require(_0xf3e8('0x2'));var BPromise=require(_0xf3e8('0x3'));var rs=require(_0xf3e8('0x4'));var fs=require('fs');var Redis=require(_0xf3e8('0x5'));var db=require(_0xf3e8('0x6'))['db'];var utils=require(_0xf3e8('0x7'));var logger=require(_0xf3e8('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf3e8('0x9')]['http']({'port':0x232a});config[_0xf3e8('0xa')]=_[_0xf3e8('0xb')](config[_0xf3e8('0xa')],{'host':_0xf3e8('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf3e8('0xa')]));require(_0xf3e8('0xd'))[_0xf3e8('0xe')](socket);function respondWithRpcPromise(_0x2769ba,_0x4f52b1,_0x3d41d7){return new BPromise(function(_0x597b7f,_0x19bd43){return client[_0xf3e8('0xf')](_0x2769ba,_0x3d41d7)['then'](function(_0x2b5539){logger[_0xf3e8('0x10')](_0xf3e8('0x11'),_0x4f52b1,_0xf3e8('0x12'));logger['debug'](_0xf3e8('0x13'),_0x4f52b1,_0xf3e8('0x12'),JSON[_0xf3e8('0x14')](_0x2b5539));if(_0x2b5539[_0xf3e8('0x15')]){if(_0x2b5539['error']['code']===0x1f4){logger['error'](_0xf3e8('0x11'),_0x4f52b1,_0x2b5539[_0xf3e8('0x15')]['message']);return _0x19bd43(_0x2b5539[_0xf3e8('0x15')]['message']);}logger[_0xf3e8('0x15')](_0xf3e8('0x11'),_0x4f52b1,_0x2b5539[_0xf3e8('0x15')][_0xf3e8('0x16')]);return _0x597b7f(_0x2b5539[_0xf3e8('0x15')][_0xf3e8('0x16')]);}else{logger['info'](_0xf3e8('0x11'),_0x4f52b1,_0xf3e8('0x12'));_0x597b7f(_0x2b5539['result'][_0xf3e8('0x16')]);}})['catch'](function(_0x3f2726){logger['error'](_0xf3e8('0x11'),_0x4f52b1,_0x3f2726);_0x19bd43(_0x3f2726);});});}