4c9de353a74de8e71d17584b08805ec8e56182af
[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 _0x4f05=['register','request','then','info','Notification,\x20%s,\x20%s','debug','Notification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter'];(function(_0xcc00d0,_0x1bb0d6){var _0x1fb86a=function(_0x51e9bd){while(--_0x51e9bd){_0xcc00d0['push'](_0xcc00d0['shift']());}};_0x1fb86a(++_0x1bb0d6);}(_0x4f05,0xee));var _0x54f0=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x4f05[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x54f0('0x0'));var util=require(_0x54f0('0x1'));var moment=require(_0x54f0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x54f0('0x3'));var db=require(_0x54f0('0x4'))['db'];var utils=require(_0x54f0('0x5'));var logger=require('../../config/logger')(_0x54f0('0x6'));var config=require(_0x54f0('0x7'));var jayson=require(_0x54f0('0x8'));var client=jayson[_0x54f0('0x9')]['http']({'port':0x232a});config[_0x54f0('0xa')]=_[_0x54f0('0xb')](config[_0x54f0('0xa')],{'host':_0x54f0('0xc'),'port':0x18eb});var socket=require(_0x54f0('0xd'))(new Redis(config[_0x54f0('0xa')]));require('./notification.socket')[_0x54f0('0xe')](socket);function respondWithRpcPromise(_0x373a38,_0x396a01,_0x502edf){return new BPromise(function(_0x2733d8,_0xf541f8){return client[_0x54f0('0xf')](_0x373a38,_0x502edf)[_0x54f0('0x10')](function(_0x421cc1){logger[_0x54f0('0x11')](_0x54f0('0x12'),_0x396a01,'request\x20sent');logger[_0x54f0('0x13')](_0x54f0('0x14'),_0x396a01,_0x54f0('0x15'),JSON[_0x54f0('0x16')](_0x421cc1));if(_0x421cc1[_0x54f0('0x17')]){if(_0x421cc1[_0x54f0('0x17')][_0x54f0('0x18')]===0x1f4){logger[_0x54f0('0x17')]('Notification,\x20%s,\x20%s',_0x396a01,_0x421cc1[_0x54f0('0x17')][_0x54f0('0x19')]);return _0xf541f8(_0x421cc1[_0x54f0('0x17')][_0x54f0('0x19')]);}logger['error'](_0x54f0('0x12'),_0x396a01,_0x421cc1[_0x54f0('0x17')][_0x54f0('0x19')]);return _0x2733d8(_0x421cc1[_0x54f0('0x17')][_0x54f0('0x19')]);}else{logger[_0x54f0('0x11')](_0x54f0('0x12'),_0x396a01,'request\x20sent');_0x2733d8(_0x421cc1[_0x54f0('0x1a')][_0x54f0('0x19')]);}})[_0x54f0('0x1b')](function(_0x21d061){logger[_0x54f0('0x17')](_0x54f0('0x12'),_0x396a01,_0x21d061);_0xf541f8(_0x21d061);});});}