09d8554cc2c35fa3244c12fa4daa993d4f23a9b1
[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 _0x7b2d=['code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','defaults','socket.io-emitter','redis','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7b2d,0x170));var _0xd7b2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7b2d[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0xd7b2('0x0'));var moment=require(_0xd7b2('0x1'));var BPromise=require(_0xd7b2('0x2'));var rs=require(_0xd7b2('0x3'));var fs=require('fs');var Redis=require(_0xd7b2('0x4'));var db=require(_0xd7b2('0x5'))['db'];var utils=require(_0xd7b2('0x6'));var logger=require('../../config/logger')(_0xd7b2('0x7'));var config=require(_0xd7b2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd7b2('0x9')]['http']({'port':0x232a});config['redis']=_[_0xd7b2('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd7b2('0xb'))(new Redis(config[_0xd7b2('0xc')]));require(_0xd7b2('0xd'))['register'](socket);function respondWithRpcPromise(_0x2eae5f,_0x240a5b,_0xc2cd25){return new BPromise(function(_0x37d21f,_0x587744){return client[_0xd7b2('0xe')](_0x2eae5f,_0xc2cd25)[_0xd7b2('0xf')](function(_0x5d94b4){logger[_0xd7b2('0x10')](_0xd7b2('0x11'),_0x240a5b,_0xd7b2('0x12'));logger['debug'](_0xd7b2('0x13'),_0x240a5b,_0xd7b2('0x12'),JSON[_0xd7b2('0x14')](_0x5d94b4));if(_0x5d94b4[_0xd7b2('0x15')]){if(_0x5d94b4[_0xd7b2('0x15')][_0xd7b2('0x16')]===0x1f4){logger['error']('UserNotification,\x20%s,\x20%s',_0x240a5b,_0x5d94b4[_0xd7b2('0x15')][_0xd7b2('0x17')]);return _0x587744(_0x5d94b4['error']['message']);}logger[_0xd7b2('0x15')](_0xd7b2('0x11'),_0x240a5b,_0x5d94b4['error']['message']);return _0x37d21f(_0x5d94b4[_0xd7b2('0x15')][_0xd7b2('0x17')]);}else{logger[_0xd7b2('0x10')](_0xd7b2('0x11'),_0x240a5b,_0xd7b2('0x12'));_0x37d21f(_0x5d94b4[_0xd7b2('0x18')][_0xd7b2('0x17')]);}})[_0xd7b2('0x19')](function(_0x265827){logger[_0xd7b2('0x15')](_0xd7b2('0x11'),_0x240a5b,_0x265827);_0x587744(_0x265827);});});}