Built motion from commit 43538d75.|2.5.35
[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 _0x792e=['socket.io-emitter','./userNotification.socket','register','request','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','UserNotification,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x158586,_0x85a73a){var _0x259213=function(_0x1768c5){while(--_0x1768c5){_0x158586['push'](_0x158586['shift']());}};_0x259213(++_0x85a73a);}(_0x792e,0x1a3));var _0xe792=function(_0x2ffde9,_0x13a4ef){_0x2ffde9=_0x2ffde9-0x0;var _0x3fa06a=_0x792e[_0x2ffde9];return _0x3fa06a;};'use strict';var _=require(_0xe792('0x0'));var util=require(_0xe792('0x1'));var moment=require(_0xe792('0x2'));var BPromise=require(_0xe792('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe792('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe792('0x5'))('rpc');var config=require(_0xe792('0x6'));var jayson=require(_0xe792('0x7'));var client=jayson[_0xe792('0x8')][_0xe792('0x9')]({'port':0x232a});config[_0xe792('0xa')]=_[_0xe792('0xb')](config['redis'],{'host':_0xe792('0xc'),'port':0x18eb});var socket=require(_0xe792('0xd'))(new Redis(config[_0xe792('0xa')]));require(_0xe792('0xe'))[_0xe792('0xf')](socket);function respondWithRpcPromise(_0x159604,_0x9bbc7d,_0x400a95){return new BPromise(function(_0x15092b,_0x35bec3){return client[_0xe792('0x10')](_0x159604,_0x400a95)['then'](function(_0x4edba9){logger[_0xe792('0x11')]('UserNotification,\x20%s,\x20%s',_0x9bbc7d,_0xe792('0x12'));logger[_0xe792('0x13')](_0xe792('0x14'),_0x9bbc7d,_0xe792('0x12'),JSON[_0xe792('0x15')](_0x4edba9));if(_0x4edba9[_0xe792('0x16')]){if(_0x4edba9[_0xe792('0x16')]['code']===0x1f4){logger[_0xe792('0x16')](_0xe792('0x17'),_0x9bbc7d,_0x4edba9[_0xe792('0x16')][_0xe792('0x18')]);return _0x35bec3(_0x4edba9[_0xe792('0x16')][_0xe792('0x18')]);}logger['error'](_0xe792('0x17'),_0x9bbc7d,_0x4edba9[_0xe792('0x16')][_0xe792('0x18')]);return _0x15092b(_0x4edba9['error']['message']);}else{logger[_0xe792('0x11')]('UserNotification,\x20%s,\x20%s',_0x9bbc7d,'request\x20sent');_0x15092b(_0x4edba9[_0xe792('0x19')][_0xe792('0x18')]);}})[_0xe792('0x1a')](function(_0x5f1cda){logger[_0xe792('0x16')](_0xe792('0x17'),_0x9bbc7d,_0x5f1cda);_0x35bec3(_0x5f1cda);});});}