Built motion from commit 9d1906d1.|2.5.40
[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 _0xbb2f=['defaults','socket.io-emitter','./userNotification.socket','register','request','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','code','message','error','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x5cba6d,_0x16c6ca){var _0x57aae4=function(_0x2de051){while(--_0x2de051){_0x5cba6d['push'](_0x5cba6d['shift']());}};_0x57aae4(++_0x16c6ca);}(_0xbb2f,0xbe));var _0xfbb2=function(_0x4d92ca,_0x9575f9){_0x4d92ca=_0x4d92ca-0x0;var _0x4ac25d=_0xbb2f[_0x4d92ca];return _0x4ac25d;};'use strict';var _=require(_0xfbb2('0x0'));var util=require('util');var moment=require(_0xfbb2('0x1'));var BPromise=require('bluebird');var rs=require(_0xfbb2('0x2'));var fs=require('fs');var Redis=require(_0xfbb2('0x3'));var db=require(_0xfbb2('0x4'))['db'];var utils=require(_0xfbb2('0x5'));var logger=require(_0xfbb2('0x6'))(_0xfbb2('0x7'));var config=require(_0xfbb2('0x8'));var jayson=require(_0xfbb2('0x9'));var client=jayson[_0xfbb2('0xa')][_0xfbb2('0xb')]({'port':0x232a});config[_0xfbb2('0xc')]=_[_0xfbb2('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfbb2('0xe'))(new Redis(config[_0xfbb2('0xc')]));require(_0xfbb2('0xf'))[_0xfbb2('0x10')](socket);function respondWithRpcPromise(_0x5c0459,_0x4159f3,_0x4a5016){return new BPromise(function(_0x4945b4,_0xf2d4f3){return client[_0xfbb2('0x11')](_0x5c0459,_0x4a5016)['then'](function(_0x3f0537){logger[_0xfbb2('0x12')](_0xfbb2('0x13'),_0x4159f3,_0xfbb2('0x14'));logger[_0xfbb2('0x15')](_0xfbb2('0x16'),_0x4159f3,_0xfbb2('0x14'),JSON[_0xfbb2('0x17')](_0x3f0537));if(_0x3f0537['error']){if(_0x3f0537['error'][_0xfbb2('0x18')]===0x1f4){logger['error'](_0xfbb2('0x13'),_0x4159f3,_0x3f0537['error'][_0xfbb2('0x19')]);return _0xf2d4f3(_0x3f0537['error'][_0xfbb2('0x19')]);}logger[_0xfbb2('0x1a')](_0xfbb2('0x13'),_0x4159f3,_0x3f0537[_0xfbb2('0x1a')][_0xfbb2('0x19')]);return _0x4945b4(_0x3f0537[_0xfbb2('0x1a')][_0xfbb2('0x19')]);}else{logger['info'](_0xfbb2('0x13'),_0x4159f3,_0xfbb2('0x14'));_0x4945b4(_0x3f0537[_0xfbb2('0x1b')]['message']);}})[_0xfbb2('0x1c')](function(_0x17137c){logger[_0xfbb2('0x1a')](_0xfbb2('0x13'),_0x4159f3,_0x17137c);_0xf2d4f3(_0x17137c);});});}