7625cc6ad556072c2688dd6662cb7984c7da8585
[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 _0xae78=['../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./userNotification.socket','register','request','then','UserNotification,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x560f44,_0x4b68ee){var _0x158ed4=function(_0x19f119){while(--_0x19f119){_0x560f44['push'](_0x560f44['shift']());}};_0x158ed4(++_0x4b68ee);}(_0xae78,0x1c9));var _0x8ae7=function(_0x2d543b,_0x23fe15){_0x2d543b=_0x2d543b-0x0;var _0x15af72=_0xae78[_0x2d543b];return _0x15af72;};'use strict';var _=require(_0x8ae7('0x0'));var util=require(_0x8ae7('0x1'));var moment=require('moment');var BPromise=require(_0x8ae7('0x2'));var rs=require(_0x8ae7('0x3'));var fs=require('fs');var Redis=require(_0x8ae7('0x4'));var db=require(_0x8ae7('0x5'))['db'];var utils=require(_0x8ae7('0x6'));var logger=require(_0x8ae7('0x7'))(_0x8ae7('0x8'));var config=require(_0x8ae7('0x9'));var jayson=require(_0x8ae7('0xa'));var client=jayson['client'][_0x8ae7('0xb')]({'port':0x232a});config['redis']=_[_0x8ae7('0xc')](config[_0x8ae7('0xd')],{'host':_0x8ae7('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8ae7('0xd')]));require(_0x8ae7('0xf'))[_0x8ae7('0x10')](socket);function respondWithRpcPromise(_0x53a943,_0x53a8bb,_0x5b42c5){return new BPromise(function(_0x4de771,_0x711daa){return client[_0x8ae7('0x11')](_0x53a943,_0x5b42c5)[_0x8ae7('0x12')](function(_0x557272){logger['info'](_0x8ae7('0x13'),_0x53a8bb,_0x8ae7('0x14'));logger[_0x8ae7('0x15')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x53a8bb,_0x8ae7('0x14'),JSON[_0x8ae7('0x16')](_0x557272));if(_0x557272[_0x8ae7('0x17')]){if(_0x557272[_0x8ae7('0x17')][_0x8ae7('0x18')]===0x1f4){logger[_0x8ae7('0x17')](_0x8ae7('0x13'),_0x53a8bb,_0x557272['error'][_0x8ae7('0x19')]);return _0x711daa(_0x557272[_0x8ae7('0x17')][_0x8ae7('0x19')]);}logger[_0x8ae7('0x17')](_0x8ae7('0x13'),_0x53a8bb,_0x557272[_0x8ae7('0x17')][_0x8ae7('0x19')]);return _0x4de771(_0x557272[_0x8ae7('0x17')][_0x8ae7('0x19')]);}else{logger[_0x8ae7('0x1a')]('UserNotification,\x20%s,\x20%s',_0x53a8bb,_0x8ae7('0x14'));_0x4de771(_0x557272[_0x8ae7('0x1b')][_0x8ae7('0x19')]);}})[_0x8ae7('0x1c')](function(_0x3a3d08){logger['error'](_0x8ae7('0x13'),_0x53a8bb,_0x3a3d08);_0x711daa(_0x3a3d08);});});}