949ca38d724a7c547c29c6517960391a8fc60da9
[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 _0xf2ba=['register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket'];(function(_0x2ed5d3,_0x1728ec){var _0x287c1b=function(_0x42b2fc){while(--_0x42b2fc){_0x2ed5d3['push'](_0x2ed5d3['shift']());}};_0x287c1b(++_0x1728ec);}(_0xf2ba,0x138));var _0xaf2b=function(_0x3df685,_0x4439dd){_0x3df685=_0x3df685-0x0;var _0x219d6d=_0xf2ba[_0x3df685];return _0x219d6d;};'use strict';var _=require(_0xaf2b('0x0'));var util=require('util');var moment=require(_0xaf2b('0x1'));var BPromise=require(_0xaf2b('0x2'));var rs=require(_0xaf2b('0x3'));var fs=require('fs');var Redis=require(_0xaf2b('0x4'));var db=require(_0xaf2b('0x5'))['db'];var utils=require(_0xaf2b('0x6'));var logger=require(_0xaf2b('0x7'))(_0xaf2b('0x8'));var config=require(_0xaf2b('0x9'));var jayson=require(_0xaf2b('0xa'));var client=jayson[_0xaf2b('0xb')][_0xaf2b('0xc')]({'port':0x232a});config[_0xaf2b('0xd')]=_[_0xaf2b('0xe')](config[_0xaf2b('0xd')],{'host':_0xaf2b('0xf'),'port':0x18eb});var socket=require(_0xaf2b('0x10'))(new Redis(config['redis']));require(_0xaf2b('0x11'))[_0xaf2b('0x12')](socket);function respondWithRpcPromise(_0x42e1e1,_0xbd4de1,_0x3d739c){return new BPromise(function(_0x2333ff,_0x14abc4){return client[_0xaf2b('0x13')](_0x42e1e1,_0x3d739c)[_0xaf2b('0x14')](function(_0x52da25){logger[_0xaf2b('0x15')](_0xaf2b('0x16'),_0xbd4de1,_0xaf2b('0x17'));logger['debug'](_0xaf2b('0x18'),_0xbd4de1,'request\x20sent',JSON[_0xaf2b('0x19')](_0x52da25));if(_0x52da25[_0xaf2b('0x1a')]){if(_0x52da25['error']['code']===0x1f4){logger[_0xaf2b('0x1a')]('UserNotification,\x20%s,\x20%s',_0xbd4de1,_0x52da25['error'][_0xaf2b('0x1b')]);return _0x14abc4(_0x52da25[_0xaf2b('0x1a')][_0xaf2b('0x1b')]);}logger[_0xaf2b('0x1a')](_0xaf2b('0x16'),_0xbd4de1,_0x52da25[_0xaf2b('0x1a')][_0xaf2b('0x1b')]);return _0x2333ff(_0x52da25['error'][_0xaf2b('0x1b')]);}else{logger[_0xaf2b('0x15')]('UserNotification,\x20%s,\x20%s',_0xbd4de1,'request\x20sent');_0x2333ff(_0x52da25[_0xaf2b('0x1c')][_0xaf2b('0x1b')]);}})[_0xaf2b('0x1d')](function(_0x44dc94){logger['error']('UserNotification,\x20%s,\x20%s',_0xbd4de1,_0x44dc94);_0x14abc4(_0x44dc94);});});}