Built motion from commit (unavailable).|2.5.21
[motion2.git] / server / api / notification / notification.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 _0x8654=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./notification.socket','register','request','then','info','debug','request\x20sent','stringify','error','code','message','Notification,\x20%s,\x20%s','util'];(function(_0x2e5610,_0x2316e2){var _0x4ff7fd=function(_0x59937b){while(--_0x59937b){_0x2e5610['push'](_0x2e5610['shift']());}};_0x4ff7fd(++_0x2316e2);}(_0x8654,0x9b));var _0x4865=function(_0x519db3,_0x1d196d){_0x519db3=_0x519db3-0x0;var _0x43df8b=_0x8654[_0x519db3];return _0x43df8b;};'use strict';var _=require('lodash');var util=require(_0x4865('0x0'));var moment=require(_0x4865('0x1'));var BPromise=require(_0x4865('0x2'));var rs=require(_0x4865('0x3'));var fs=require('fs');var Redis=require(_0x4865('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4865('0x5'));var config=require(_0x4865('0x6'));var jayson=require(_0x4865('0x7'));var client=jayson[_0x4865('0x8')][_0x4865('0x9')]({'port':0x232a});config[_0x4865('0xa')]=_[_0x4865('0xb')](config[_0x4865('0xa')],{'host':_0x4865('0xc'),'port':0x18eb});var socket=require(_0x4865('0xd'))(new Redis(config[_0x4865('0xa')]));require(_0x4865('0xe'))[_0x4865('0xf')](socket);function respondWithRpcPromise(_0x488332,_0x200bff,_0x574137){return new BPromise(function(_0x3e7266,_0x72836b){return client[_0x4865('0x10')](_0x488332,_0x574137)[_0x4865('0x11')](function(_0x1f3df4){logger[_0x4865('0x12')]('Notification,\x20%s,\x20%s',_0x200bff,'request\x20sent');logger[_0x4865('0x13')]('Notification,\x20%s,\x20%s,\x20%s',_0x200bff,_0x4865('0x14'),JSON[_0x4865('0x15')](_0x1f3df4));if(_0x1f3df4[_0x4865('0x16')]){if(_0x1f3df4['error'][_0x4865('0x17')]===0x1f4){logger[_0x4865('0x16')]('Notification,\x20%s,\x20%s',_0x200bff,_0x1f3df4['error'][_0x4865('0x18')]);return _0x72836b(_0x1f3df4[_0x4865('0x16')][_0x4865('0x18')]);}logger[_0x4865('0x16')](_0x4865('0x19'),_0x200bff,_0x1f3df4[_0x4865('0x16')][_0x4865('0x18')]);return _0x3e7266(_0x1f3df4[_0x4865('0x16')][_0x4865('0x18')]);}else{logger[_0x4865('0x12')](_0x4865('0x19'),_0x200bff,_0x4865('0x14'));_0x3e7266(_0x1f3df4['result'][_0x4865('0x18')]);}})['catch'](function(_0x1ce1a5){logger[_0x4865('0x16')](_0x4865('0x19'),_0x200bff,_0x1ce1a5);_0x72836b(_0x1ce1a5);});});}