Built motion from commit 3e059bc2.|2.5.32
[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 _0xf0c5=['error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s'];(function(_0x4dea17,_0x4eda3a){var _0x4d390c=function(_0x2e3757){while(--_0x2e3757){_0x4dea17['push'](_0x4dea17['shift']());}};_0x4d390c(++_0x4eda3a);}(_0xf0c5,0x16c));var _0x5f0c=function(_0x241cd3,_0x4dcef2){_0x241cd3=_0x241cd3-0x0;var _0x5b4cdc=_0xf0c5[_0x241cd3];return _0x5b4cdc;};'use strict';var _=require('lodash');var util=require(_0x5f0c('0x0'));var moment=require(_0x5f0c('0x1'));var BPromise=require(_0x5f0c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f0c('0x3'));var db=require(_0x5f0c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5f0c('0x5'))('rpc');var config=require(_0x5f0c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5f0c('0x7')][_0x5f0c('0x8')]({'port':0x232a});config[_0x5f0c('0x9')]=_[_0x5f0c('0xa')](config[_0x5f0c('0x9')],{'host':_0x5f0c('0xb'),'port':0x18eb});var socket=require(_0x5f0c('0xc'))(new Redis(config['redis']));require(_0x5f0c('0xd'))[_0x5f0c('0xe')](socket);function respondWithRpcPromise(_0xe19ebc,_0x3adf0c,_0x42f28f){return new BPromise(function(_0x2975b2,_0x1ded99){return client[_0x5f0c('0xf')](_0xe19ebc,_0x42f28f)['then'](function(_0x2ec6f7){logger[_0x5f0c('0x10')](_0x5f0c('0x11'),_0x3adf0c,_0x5f0c('0x12'));logger['debug'](_0x5f0c('0x13'),_0x3adf0c,_0x5f0c('0x12'),JSON['stringify'](_0x2ec6f7));if(_0x2ec6f7['error']){if(_0x2ec6f7[_0x5f0c('0x14')]['code']===0x1f4){logger[_0x5f0c('0x14')]('UserNotification,\x20%s,\x20%s',_0x3adf0c,_0x2ec6f7[_0x5f0c('0x14')][_0x5f0c('0x15')]);return _0x1ded99(_0x2ec6f7['error'][_0x5f0c('0x15')]);}logger[_0x5f0c('0x14')]('UserNotification,\x20%s,\x20%s',_0x3adf0c,_0x2ec6f7[_0x5f0c('0x14')][_0x5f0c('0x15')]);return _0x2975b2(_0x2ec6f7[_0x5f0c('0x14')][_0x5f0c('0x15')]);}else{logger[_0x5f0c('0x10')](_0x5f0c('0x11'),_0x3adf0c,_0x5f0c('0x12'));_0x2975b2(_0x2ec6f7[_0x5f0c('0x16')][_0x5f0c('0x15')]);}})[_0x5f0c('0x17')](function(_0x5550db){logger[_0x5f0c('0x14')](_0x5f0c('0x11'),_0x3adf0c,_0x5550db);_0x1ded99(_0x5550db);});});}