Built motion from commit 85328c08.|2.5.50
[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 _0x4eac=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','UserNotification,\x20%s,\x20%s','message','info','result','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4eac,0x1b9));var _0xc4ea=function(_0x6835c8,_0x15fd4d){_0x6835c8=_0x6835c8-0x0;var _0xbe7cc=_0x4eac[_0x6835c8];return _0xbe7cc;};'use strict';var _=require('lodash');var util=require(_0xc4ea('0x0'));var moment=require(_0xc4ea('0x1'));var BPromise=require(_0xc4ea('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc4ea('0x3'));var db=require(_0xc4ea('0x4'))['db'];var utils=require(_0xc4ea('0x5'));var logger=require(_0xc4ea('0x6'))('rpc');var config=require(_0xc4ea('0x7'));var jayson=require(_0xc4ea('0x8'));var client=jayson[_0xc4ea('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xc4ea('0xa')],{'host':_0xc4ea('0xb'),'port':0x18eb});var socket=require(_0xc4ea('0xc'))(new Redis(config['redis']));require(_0xc4ea('0xd'))[_0xc4ea('0xe')](socket);function respondWithRpcPromise(_0x43f36d,_0x37710a,_0x441683){return new BPromise(function(_0x430122,_0x4d6da0){return client[_0xc4ea('0xf')](_0x43f36d,_0x441683)['then'](function(_0x8428f7){logger['info']('UserNotification,\x20%s,\x20%s',_0x37710a,_0xc4ea('0x10'));logger[_0xc4ea('0x11')](_0xc4ea('0x12'),_0x37710a,_0xc4ea('0x10'),JSON[_0xc4ea('0x13')](_0x8428f7));if(_0x8428f7[_0xc4ea('0x14')]){if(_0x8428f7['error'][_0xc4ea('0x15')]===0x1f4){logger[_0xc4ea('0x14')](_0xc4ea('0x16'),_0x37710a,_0x8428f7[_0xc4ea('0x14')]['message']);return _0x4d6da0(_0x8428f7[_0xc4ea('0x14')][_0xc4ea('0x17')]);}logger[_0xc4ea('0x14')](_0xc4ea('0x16'),_0x37710a,_0x8428f7[_0xc4ea('0x14')]['message']);return _0x430122(_0x8428f7[_0xc4ea('0x14')][_0xc4ea('0x17')]);}else{logger[_0xc4ea('0x18')](_0xc4ea('0x16'),_0x37710a,_0xc4ea('0x10'));_0x430122(_0x8428f7[_0xc4ea('0x19')]['message']);}})['catch'](function(_0x236e9f){logger[_0xc4ea('0x14')](_0xc4ea('0x16'),_0x37710a,_0x236e9f);_0x4d6da0(_0x236e9f);});});}