d5ed86e796f0a7d29fe3a2ecfd8cfd576fc4b1bf
[motion2.git] / server / api / userProfile / userProfile.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 _0x7eff=['../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','then','request\x20sent','stringify','error','code','UserProfile,\x20%s,\x20%s','message','info','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x7eff,0x162));var _0xf7ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7eff[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xf7ef('0x0'));var moment=require(_0xf7ef('0x1'));var BPromise=require(_0xf7ef('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf7ef('0x3'));var db=require(_0xf7ef('0x4'))['db'];var utils=require(_0xf7ef('0x5'));var logger=require(_0xf7ef('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf7ef('0x7'));var client=jayson[_0xf7ef('0x8')][_0xf7ef('0x9')]({'port':0x232a});config[_0xf7ef('0xa')]=_[_0xf7ef('0xb')](config[_0xf7ef('0xa')],{'host':_0xf7ef('0xc'),'port':0x18eb});var socket=require(_0xf7ef('0xd'))(new Redis(config['redis']));require(_0xf7ef('0xe'))[_0xf7ef('0xf')](socket);function respondWithRpcPromise(_0x48c84f,_0x25c6c5,_0x5bbb90){return new BPromise(function(_0x5044c4,_0x598fc5){return client['request'](_0x48c84f,_0x5bbb90)[_0xf7ef('0x10')](function(_0x4a7d97){logger['info']('UserProfile,\x20%s,\x20%s',_0x25c6c5,_0xf7ef('0x11'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x25c6c5,'request\x20sent',JSON[_0xf7ef('0x12')](_0x4a7d97));if(_0x4a7d97[_0xf7ef('0x13')]){if(_0x4a7d97[_0xf7ef('0x13')][_0xf7ef('0x14')]===0x1f4){logger['error'](_0xf7ef('0x15'),_0x25c6c5,_0x4a7d97['error'][_0xf7ef('0x16')]);return _0x598fc5(_0x4a7d97[_0xf7ef('0x13')]['message']);}logger[_0xf7ef('0x13')]('UserProfile,\x20%s,\x20%s',_0x25c6c5,_0x4a7d97[_0xf7ef('0x13')][_0xf7ef('0x16')]);return _0x5044c4(_0x4a7d97[_0xf7ef('0x13')][_0xf7ef('0x16')]);}else{logger[_0xf7ef('0x17')](_0xf7ef('0x15'),_0x25c6c5,_0xf7ef('0x11'));_0x5044c4(_0x4a7d97['result']['message']);}})['catch'](function(_0x3138a3){logger['error'](_0xf7ef('0x15'),_0x25c6c5,_0x3138a3);_0x598fc5(_0x3138a3);});});}