Built motion from commit da617fac.|2.6.6
[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 _0xbf77=['catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','socket.io-emitter','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x183d0a,_0x55b0c6){var _0x4dda40=function(_0x7701fc){while(--_0x7701fc){_0x183d0a['push'](_0x183d0a['shift']());}};_0x4dda40(++_0x55b0c6);}(_0xbf77,0x114));var _0x7bf7=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xbf77[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0x7bf7('0x0'));var util=require(_0x7bf7('0x1'));var moment=require('moment');var BPromise=require(_0x7bf7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7bf7('0x3'));var db=require(_0x7bf7('0x4'))['db'];var utils=require(_0x7bf7('0x5'));var logger=require(_0x7bf7('0x6'))('rpc');var config=require(_0x7bf7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7bf7('0x8')]['http']({'port':0x232a});config[_0x7bf7('0x9')]=_[_0x7bf7('0xa')](config[_0x7bf7('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x7bf7('0xb'))(new Redis(config[_0x7bf7('0x9')]));require('./userNotification.socket')[_0x7bf7('0xc')](socket);function respondWithRpcPromise(_0x367da6,_0x58bc3b,_0x28192f){return new BPromise(function(_0x52b978,_0x3b5ce2){return client[_0x7bf7('0xd')](_0x367da6,_0x28192f)[_0x7bf7('0xe')](function(_0x4779a5){logger[_0x7bf7('0xf')](_0x7bf7('0x10'),_0x58bc3b,_0x7bf7('0x11'));logger[_0x7bf7('0x12')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x58bc3b,_0x7bf7('0x11'),JSON[_0x7bf7('0x13')](_0x4779a5));if(_0x4779a5[_0x7bf7('0x14')]){if(_0x4779a5[_0x7bf7('0x14')][_0x7bf7('0x15')]===0x1f4){logger['error'](_0x7bf7('0x10'),_0x58bc3b,_0x4779a5[_0x7bf7('0x14')][_0x7bf7('0x16')]);return _0x3b5ce2(_0x4779a5[_0x7bf7('0x14')][_0x7bf7('0x16')]);}logger[_0x7bf7('0x14')](_0x7bf7('0x10'),_0x58bc3b,_0x4779a5['error']['message']);return _0x52b978(_0x4779a5[_0x7bf7('0x14')][_0x7bf7('0x16')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x58bc3b,'request\x20sent');_0x52b978(_0x4779a5[_0x7bf7('0x17')]['message']);}})[_0x7bf7('0x18')](function(_0x4d8475){logger[_0x7bf7('0x14')](_0x7bf7('0x10'),_0x58bc3b,_0x4d8475);_0x3b5ce2(_0x4d8475);});});}