Built motion from commit b0a9a629.|2.6.33
[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 _0x770b=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x179c4a,_0x10eb06){var _0x5d1879=function(_0x1f1dcd){while(--_0x1f1dcd){_0x179c4a['push'](_0x179c4a['shift']());}};_0x5d1879(++_0x10eb06);}(_0x770b,0x123));var _0xb770=function(_0x479372,_0x1bb4d3){_0x479372=_0x479372-0x0;var _0x3a9b00=_0x770b[_0x479372];return _0x3a9b00;};'use strict';var _=require('lodash');var util=require(_0xb770('0x0'));var moment=require(_0xb770('0x1'));var BPromise=require(_0xb770('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb770('0x3'))['db'];var utils=require(_0xb770('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xb770('0x5'));var jayson=require(_0xb770('0x6'));var client=jayson[_0xb770('0x7')][_0xb770('0x8')]({'port':0x232a});config[_0xb770('0x9')]=_[_0xb770('0xa')](config['redis'],{'host':_0xb770('0xb'),'port':0x18eb});var socket=require(_0xb770('0xc'))(new Redis(config[_0xb770('0x9')]));require(_0xb770('0xd'))[_0xb770('0xe')](socket);function respondWithRpcPromise(_0x26a1c4,_0x28491f,_0x2cf49e){return new BPromise(function(_0x2cbe2c,_0x44ebe3){return client[_0xb770('0xf')](_0x26a1c4,_0x2cf49e)[_0xb770('0x10')](function(_0x4300e7){logger[_0xb770('0x11')](_0xb770('0x12'),_0x28491f,_0xb770('0x13'));logger[_0xb770('0x14')](_0xb770('0x15'),_0x28491f,_0xb770('0x13'),JSON[_0xb770('0x16')](_0x4300e7));if(_0x4300e7[_0xb770('0x17')]){if(_0x4300e7[_0xb770('0x17')]['code']===0x1f4){logger[_0xb770('0x17')]('UserNotification,\x20%s,\x20%s',_0x28491f,_0x4300e7[_0xb770('0x17')][_0xb770('0x18')]);return _0x44ebe3(_0x4300e7[_0xb770('0x17')][_0xb770('0x18')]);}logger[_0xb770('0x17')](_0xb770('0x12'),_0x28491f,_0x4300e7['error'][_0xb770('0x18')]);return _0x2cbe2c(_0x4300e7['error'][_0xb770('0x18')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x28491f,_0xb770('0x13'));_0x2cbe2c(_0x4300e7[_0xb770('0x19')][_0xb770('0x18')]);}})[_0xb770('0x1a')](function(_0xac0d6){logger[_0xb770('0x17')](_0xb770('0x12'),_0x28491f,_0xac0d6);_0x44ebe3(_0xac0d6);});});}