43b3efa350f77f7ae5da1623c2ad951b7279300f
[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 _0xf50d=['message','UserNotification,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x10e0af,_0x35a91c){var _0x402a6f=function(_0x5f2313){while(--_0x5f2313){_0x10e0af['push'](_0x10e0af['shift']());}};_0x402a6f(++_0x35a91c);}(_0xf50d,0x86));var _0xdf50=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0xf50d[_0x12f688];return _0x59c3de;};'use strict';var _=require(_0xdf50('0x0'));var util=require(_0xdf50('0x1'));var moment=require('moment');var BPromise=require(_0xdf50('0x2'));var rs=require(_0xdf50('0x3'));var fs=require('fs');var Redis=require(_0xdf50('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf50('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xdf50('0x6'));var jayson=require(_0xdf50('0x7'));var client=jayson[_0xdf50('0x8')][_0xdf50('0x9')]({'port':0x232a});config['redis']=_[_0xdf50('0xa')](config['redis'],{'host':_0xdf50('0xb'),'port':0x18eb});var socket=require(_0xdf50('0xc'))(new Redis(config['redis']));require('./userNotification.socket')[_0xdf50('0xd')](socket);function respondWithRpcPromise(_0x15d602,_0x15dcde,_0x50dcb7){return new BPromise(function(_0x1cbbb8,_0x1ad7d2){return client[_0xdf50('0xe')](_0x15d602,_0x50dcb7)[_0xdf50('0xf')](function(_0x19ad21){logger[_0xdf50('0x10')]('UserNotification,\x20%s,\x20%s',_0x15dcde,_0xdf50('0x11'));logger[_0xdf50('0x12')](_0xdf50('0x13'),_0x15dcde,_0xdf50('0x11'),JSON[_0xdf50('0x14')](_0x19ad21));if(_0x19ad21[_0xdf50('0x15')]){if(_0x19ad21[_0xdf50('0x15')]['code']===0x1f4){logger['error']('UserNotification,\x20%s,\x20%s',_0x15dcde,_0x19ad21[_0xdf50('0x15')]['message']);return _0x1ad7d2(_0x19ad21[_0xdf50('0x15')][_0xdf50('0x16')]);}logger['error']('UserNotification,\x20%s,\x20%s',_0x15dcde,_0x19ad21[_0xdf50('0x15')][_0xdf50('0x16')]);return _0x1cbbb8(_0x19ad21['error'][_0xdf50('0x16')]);}else{logger[_0xdf50('0x10')](_0xdf50('0x17'),_0x15dcde,_0xdf50('0x11'));_0x1cbbb8(_0x19ad21[_0xdf50('0x18')][_0xdf50('0x16')]);}})[_0xdf50('0x19')](function(_0x1dc915){logger[_0xdf50('0x15')]('UserNotification,\x20%s,\x20%s',_0x15dcde,_0x1dc915);_0x1ad7d2(_0x1dc915);});});}