Built motion from commit 25580385.|2.6.2
[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 _0x576f=['code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./userNotification.socket','register','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5a076c,_0x222cb0){var _0x5036c1=function(_0xff953b){while(--_0xff953b){_0x5a076c['push'](_0x5a076c['shift']());}};_0x5036c1(++_0x222cb0);}(_0x576f,0x1f0));var _0xf576=function(_0x540dec,_0x575191){_0x540dec=_0x540dec-0x0;var _0x513899=_0x576f[_0x540dec];return _0x513899;};'use strict';var _=require(_0xf576('0x0'));var util=require(_0xf576('0x1'));var moment=require(_0xf576('0x2'));var BPromise=require(_0xf576('0x3'));var rs=require(_0xf576('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf576('0x5'))['db'];var utils=require(_0xf576('0x6'));var logger=require(_0xf576('0x7'))(_0xf576('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf576('0x9')][_0xf576('0xa')]({'port':0x232a});config[_0xf576('0xb')]=_[_0xf576('0xc')](config[_0xf576('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xf576('0xd'))(new Redis(config[_0xf576('0xb')]));require(_0xf576('0xe'))[_0xf576('0xf')](socket);function respondWithRpcPromise(_0x57df91,_0x31a64f,_0x4b5a98){return new BPromise(function(_0x20e2c2,_0x47070c){return client['request'](_0x57df91,_0x4b5a98)[_0xf576('0x10')](function(_0x3f0797){logger[_0xf576('0x11')](_0xf576('0x12'),_0x31a64f,_0xf576('0x13'));logger[_0xf576('0x14')](_0xf576('0x15'),_0x31a64f,_0xf576('0x13'),JSON[_0xf576('0x16')](_0x3f0797));if(_0x3f0797[_0xf576('0x17')]){if(_0x3f0797[_0xf576('0x17')][_0xf576('0x18')]===0x1f4){logger[_0xf576('0x17')](_0xf576('0x12'),_0x31a64f,_0x3f0797[_0xf576('0x17')]['message']);return _0x47070c(_0x3f0797[_0xf576('0x17')][_0xf576('0x19')]);}logger[_0xf576('0x17')]('UserNotification,\x20%s,\x20%s',_0x31a64f,_0x3f0797['error']['message']);return _0x20e2c2(_0x3f0797[_0xf576('0x17')][_0xf576('0x19')]);}else{logger[_0xf576('0x11')]('UserNotification,\x20%s,\x20%s',_0x31a64f,_0xf576('0x13'));_0x20e2c2(_0x3f0797['result'][_0xf576('0x19')]);}})['catch'](function(_0xe50f4f){logger['error']('UserNotification,\x20%s,\x20%s',_0x31a64f,_0xe50f4f);_0x47070c(_0xe50f4f);});});}