Built motion from commit 9d7072cc.|2.5.39
[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 _0x641f=['catch','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x5334ab,_0x1a9476){var _0x42a1c4=function(_0x23b1ad){while(--_0x23b1ad){_0x5334ab['push'](_0x5334ab['shift']());}};_0x42a1c4(++_0x1a9476);}(_0x641f,0x1e1));var _0xf641=function(_0x1970e2,_0x21221f){_0x1970e2=_0x1970e2-0x0;var _0x25e6fc=_0x641f[_0x1970e2];return _0x25e6fc;};'use strict';var _=require(_0xf641('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf641('0x1'));var db=require(_0xf641('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xf641('0x3'))(_0xf641('0x4'));var config=require(_0xf641('0x5'));var jayson=require(_0xf641('0x6'));var client=jayson[_0xf641('0x7')][_0xf641('0x8')]({'port':0x232a});config[_0xf641('0x9')]=_[_0xf641('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf641('0x9')]));require(_0xf641('0xb'))[_0xf641('0xc')](socket);function respondWithRpcPromise(_0x4fe188,_0x404d6f,_0x4f254d){return new BPromise(function(_0x4947fe,_0x1c2d18){return client[_0xf641('0xd')](_0x4fe188,_0x4f254d)[_0xf641('0xe')](function(_0x5d49ed){logger[_0xf641('0xf')](_0xf641('0x10'),_0x404d6f,_0xf641('0x11'));logger[_0xf641('0x12')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x404d6f,'request\x20sent',JSON[_0xf641('0x13')](_0x5d49ed));if(_0x5d49ed[_0xf641('0x14')]){if(_0x5d49ed['error']['code']===0x1f4){logger[_0xf641('0x14')](_0xf641('0x10'),_0x404d6f,_0x5d49ed[_0xf641('0x14')]['message']);return _0x1c2d18(_0x5d49ed[_0xf641('0x14')]['message']);}logger[_0xf641('0x14')](_0xf641('0x10'),_0x404d6f,_0x5d49ed[_0xf641('0x14')][_0xf641('0x15')]);return _0x4947fe(_0x5d49ed[_0xf641('0x14')][_0xf641('0x15')]);}else{logger[_0xf641('0xf')]('UserNotification,\x20%s,\x20%s',_0x404d6f,'request\x20sent');_0x4947fe(_0x5d49ed[_0xf641('0x16')][_0xf641('0x15')]);}})[_0xf641('0x17')](function(_0x4471b6){logger[_0xf641('0x14')](_0xf641('0x10'),_0x404d6f,_0x4471b6);_0x1c2d18(_0x4471b6);});});}