Built motion from commit 753c950e.|2.5.42
[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 _0xaf1c=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','socket.io-emitter','register','request','then','UserNotification,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','util','moment'];(function(_0x2e7841,_0x45c538){var _0x5d3a42=function(_0x31261b){while(--_0x31261b){_0x2e7841['push'](_0x2e7841['shift']());}};_0x5d3a42(++_0x45c538);}(_0xaf1c,0xf0));var _0xcaf1=function(_0x3d7450,_0x263fbc){_0x3d7450=_0x3d7450-0x0;var _0x2abf69=_0xaf1c[_0x3d7450];return _0x2abf69;};'use strict';var _=require('lodash');var util=require(_0xcaf1('0x0'));var moment=require(_0xcaf1('0x1'));var BPromise=require(_0xcaf1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcaf1('0x3'));var db=require(_0xcaf1('0x4'))['db'];var utils=require(_0xcaf1('0x5'));var logger=require('../../config/logger')(_0xcaf1('0x6'));var config=require(_0xcaf1('0x7'));var jayson=require(_0xcaf1('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xcaf1('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xcaf1('0xa'))(new Redis(config[_0xcaf1('0x9')]));require('./userNotification.socket')[_0xcaf1('0xb')](socket);function respondWithRpcPromise(_0x47f049,_0xf56225,_0x4c7ab4){return new BPromise(function(_0x8cdbca,_0x5b69f5){return client[_0xcaf1('0xc')](_0x47f049,_0x4c7ab4)[_0xcaf1('0xd')](function(_0xd099a4){logger['info'](_0xcaf1('0xe'),_0xf56225,_0xcaf1('0xf'));logger[_0xcaf1('0x10')]('UserNotification,\x20%s,\x20%s,\x20%s',_0xf56225,_0xcaf1('0xf'),JSON['stringify'](_0xd099a4));if(_0xd099a4[_0xcaf1('0x11')]){if(_0xd099a4['error'][_0xcaf1('0x12')]===0x1f4){logger['error']('UserNotification,\x20%s,\x20%s',_0xf56225,_0xd099a4[_0xcaf1('0x11')][_0xcaf1('0x13')]);return _0x5b69f5(_0xd099a4[_0xcaf1('0x11')]['message']);}logger[_0xcaf1('0x11')](_0xcaf1('0xe'),_0xf56225,_0xd099a4[_0xcaf1('0x11')][_0xcaf1('0x13')]);return _0x8cdbca(_0xd099a4[_0xcaf1('0x11')][_0xcaf1('0x13')]);}else{logger[_0xcaf1('0x14')](_0xcaf1('0xe'),_0xf56225,_0xcaf1('0xf'));_0x8cdbca(_0xd099a4['result'][_0xcaf1('0x13')]);}})[_0xcaf1('0x15')](function(_0x4f1118){logger[_0xcaf1('0x11')](_0xcaf1('0xe'),_0xf56225,_0x4f1118);_0x5b69f5(_0x4f1118);});});}