Built motion from commit d5e4af8c.|2.6.23
[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 _0xe9c4=['./userNotification.socket','register','request','then','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','redis'];(function(_0x4bdf64,_0x3022b2){var _0x9a1a19=function(_0x4e551b){while(--_0x4e551b){_0x4bdf64['push'](_0x4bdf64['shift']());}};_0x9a1a19(++_0x3022b2);}(_0xe9c4,0x1cd));var _0x4e9c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe9c4[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x4e9c('0x0'));var util=require('util');var moment=require(_0x4e9c('0x1'));var BPromise=require(_0x4e9c('0x2'));var rs=require(_0x4e9c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4e9c('0x4'));var logger=require(_0x4e9c('0x5'))(_0x4e9c('0x6'));var config=require(_0x4e9c('0x7'));var jayson=require(_0x4e9c('0x8'));var client=jayson[_0x4e9c('0x9')][_0x4e9c('0xa')]({'port':0x232a});config['redis']=_[_0x4e9c('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4e9c('0xc'))(new Redis(config[_0x4e9c('0xd')]));require(_0x4e9c('0xe'))[_0x4e9c('0xf')](socket);function respondWithRpcPromise(_0x1bce22,_0x25b12d,_0x54364e){return new BPromise(function(_0x43906c,_0x253eb1){return client[_0x4e9c('0x10')](_0x1bce22,_0x54364e)[_0x4e9c('0x11')](function(_0x1696fd){logger['info'](_0x4e9c('0x12'),_0x25b12d,_0x4e9c('0x13'));logger['debug'](_0x4e9c('0x14'),_0x25b12d,_0x4e9c('0x13'),JSON[_0x4e9c('0x15')](_0x1696fd));if(_0x1696fd[_0x4e9c('0x16')]){if(_0x1696fd[_0x4e9c('0x16')]['code']===0x1f4){logger[_0x4e9c('0x16')]('UserNotification,\x20%s,\x20%s',_0x25b12d,_0x1696fd['error'][_0x4e9c('0x17')]);return _0x253eb1(_0x1696fd[_0x4e9c('0x16')][_0x4e9c('0x17')]);}logger[_0x4e9c('0x16')]('UserNotification,\x20%s,\x20%s',_0x25b12d,_0x1696fd[_0x4e9c('0x16')][_0x4e9c('0x17')]);return _0x43906c(_0x1696fd['error'][_0x4e9c('0x17')]);}else{logger['info'](_0x4e9c('0x12'),_0x25b12d,_0x4e9c('0x13'));_0x43906c(_0x1696fd[_0x4e9c('0x18')][_0x4e9c('0x17')]);}})['catch'](function(_0xa69d7c){logger[_0x4e9c('0x16')](_0x4e9c('0x12'),_0x25b12d,_0xa69d7c);_0x253eb1(_0xa69d7c);});});}