Built motion from commit bab6f49e.|2.6.17
[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 _0x500c=['debug','stringify','error','message','result','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','defaults','redis','localhost','./userNotification.socket','register','request','info','UserNotification,\x20%s,\x20%s','request\x20sent'];(function(_0x30ba85,_0x503490){var _0x58b533=function(_0x131acf){while(--_0x131acf){_0x30ba85['push'](_0x30ba85['shift']());}};_0x58b533(++_0x503490);}(_0x500c,0x16a));var _0xc500=function(_0x853c46,_0x4ecebe){_0x853c46=_0x853c46-0x0;var _0xc04277=_0x500c[_0x853c46];return _0xc04277;};'use strict';var _=require('lodash');var util=require(_0xc500('0x0'));var moment=require(_0xc500('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc500('0x2'));var db=require(_0xc500('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc500('0x4'))('rpc');var config=require(_0xc500('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xc500('0x6')]['http']({'port':0x232a});config['redis']=_[_0xc500('0x7')](config[_0xc500('0x8')],{'host':_0xc500('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc500('0x8')]));require(_0xc500('0xa'))[_0xc500('0xb')](socket);function respondWithRpcPromise(_0x2e53d8,_0x572c71,_0x40ff4d){return new BPromise(function(_0x19a205,_0x1dc716){return client[_0xc500('0xc')](_0x2e53d8,_0x40ff4d)['then'](function(_0x1bbee1){logger[_0xc500('0xd')](_0xc500('0xe'),_0x572c71,_0xc500('0xf'));logger[_0xc500('0x10')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x572c71,_0xc500('0xf'),JSON[_0xc500('0x11')](_0x1bbee1));if(_0x1bbee1[_0xc500('0x12')]){if(_0x1bbee1[_0xc500('0x12')]['code']===0x1f4){logger[_0xc500('0x12')](_0xc500('0xe'),_0x572c71,_0x1bbee1[_0xc500('0x12')][_0xc500('0x13')]);return _0x1dc716(_0x1bbee1[_0xc500('0x12')][_0xc500('0x13')]);}logger[_0xc500('0x12')](_0xc500('0xe'),_0x572c71,_0x1bbee1[_0xc500('0x12')][_0xc500('0x13')]);return _0x19a205(_0x1bbee1[_0xc500('0x12')][_0xc500('0x13')]);}else{logger['info'](_0xc500('0xe'),_0x572c71,_0xc500('0xf'));_0x19a205(_0x1bbee1[_0xc500('0x14')]['message']);}})['catch'](function(_0x35ca24){logger['error'](_0xc500('0xe'),_0x572c71,_0x35ca24);_0x1dc716(_0x35ca24);});});}