Built motion from commit (unavailable).|2.5.25
[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 _0x31a0=['stringify','error','message','request\x20sent','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s'];(function(_0x2d706c,_0x3e0026){var _0x48fdcb=function(_0x571b50){while(--_0x571b50){_0x2d706c['push'](_0x2d706c['shift']());}};_0x48fdcb(++_0x3e0026);}(_0x31a0,0x155));var _0x031a=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x31a0[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0x031a('0x0'));var util=require(_0x031a('0x1'));var moment=require(_0x031a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x031a('0x3'));var db=require(_0x031a('0x4'))['db'];var utils=require(_0x031a('0x5'));var logger=require(_0x031a('0x6'))(_0x031a('0x7'));var config=require(_0x031a('0x8'));var jayson=require(_0x031a('0x9'));var client=jayson[_0x031a('0xa')][_0x031a('0xb')]({'port':0x232a});config['redis']=_[_0x031a('0xc')](config[_0x031a('0xd')],{'host':_0x031a('0xe'),'port':0x18eb});var socket=require(_0x031a('0xf'))(new Redis(config['redis']));require(_0x031a('0x10'))['register'](socket);function respondWithRpcPromise(_0x937112,_0x6ee81b,_0xd67a73){return new BPromise(function(_0x2a441c,_0x1622fb){return client[_0x031a('0x11')](_0x937112,_0xd67a73)[_0x031a('0x12')](function(_0x45528a){logger[_0x031a('0x13')](_0x031a('0x14'),_0x6ee81b,'request\x20sent');logger[_0x031a('0x15')](_0x031a('0x16'),_0x6ee81b,'request\x20sent',JSON[_0x031a('0x17')](_0x45528a));if(_0x45528a['error']){if(_0x45528a[_0x031a('0x18')]['code']===0x1f4){logger[_0x031a('0x18')](_0x031a('0x14'),_0x6ee81b,_0x45528a[_0x031a('0x18')]['message']);return _0x1622fb(_0x45528a[_0x031a('0x18')][_0x031a('0x19')]);}logger['error'](_0x031a('0x14'),_0x6ee81b,_0x45528a['error'][_0x031a('0x19')]);return _0x2a441c(_0x45528a['error']['message']);}else{logger[_0x031a('0x13')]('UserNotification,\x20%s,\x20%s',_0x6ee81b,_0x031a('0x1a'));_0x2a441c(_0x45528a[_0x031a('0x1b')][_0x031a('0x19')]);}})['catch'](function(_0x4f38a1){logger['error'](_0x031a('0x14'),_0x6ee81b,_0x4f38a1);_0x1622fb(_0x4f38a1);});});}