bdf901839757257f14db176088aaafb48d929b0d
[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 _0x98a1=['info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','code','UserNotification,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','then'];(function(_0x1812d5,_0x43f247){var _0x2aca09=function(_0x593484){while(--_0x593484){_0x1812d5['push'](_0x1812d5['shift']());}};_0x2aca09(++_0x43f247);}(_0x98a1,0x176));var _0x198a=function(_0x296039,_0x3f3e50){_0x296039=_0x296039-0x0;var _0x16e440=_0x98a1[_0x296039];return _0x16e440;};'use strict';var _=require(_0x198a('0x0'));var util=require(_0x198a('0x1'));var moment=require(_0x198a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x198a('0x3'));var db=require(_0x198a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x198a('0x5'))('rpc');var config=require(_0x198a('0x6'));var jayson=require(_0x198a('0x7'));var client=jayson['client'][_0x198a('0x8')]({'port':0x232a});config[_0x198a('0x9')]=_[_0x198a('0xa')](config[_0x198a('0x9')],{'host':_0x198a('0xb'),'port':0x18eb});var socket=require(_0x198a('0xc'))(new Redis(config[_0x198a('0x9')]));require(_0x198a('0xd'))[_0x198a('0xe')](socket);function respondWithRpcPromise(_0x36c828,_0x53822f,_0x44676e){return new BPromise(function(_0x18e7a5,_0x3ad966){return client['request'](_0x36c828,_0x44676e)[_0x198a('0xf')](function(_0x110165){logger[_0x198a('0x10')]('UserNotification,\x20%s,\x20%s',_0x53822f,_0x198a('0x11'));logger[_0x198a('0x12')](_0x198a('0x13'),_0x53822f,_0x198a('0x11'),JSON['stringify'](_0x110165));if(_0x110165[_0x198a('0x14')]){if(_0x110165[_0x198a('0x14')][_0x198a('0x15')]===0x1f4){logger[_0x198a('0x14')](_0x198a('0x16'),_0x53822f,_0x110165['error'][_0x198a('0x17')]);return _0x3ad966(_0x110165['error'][_0x198a('0x17')]);}logger[_0x198a('0x14')](_0x198a('0x16'),_0x53822f,_0x110165[_0x198a('0x14')][_0x198a('0x17')]);return _0x18e7a5(_0x110165[_0x198a('0x14')][_0x198a('0x17')]);}else{logger[_0x198a('0x10')](_0x198a('0x16'),_0x53822f,'request\x20sent');_0x18e7a5(_0x110165[_0x198a('0x18')][_0x198a('0x17')]);}})[_0x198a('0x19')](function(_0xc71763){logger[_0x198a('0x14')](_0x198a('0x16'),_0x53822f,_0xc71763);_0x3ad966(_0xc71763);});});}