7edc6ad8e3de03081f178d43931714d867b6529f
[motion2.git] / server / api / userProfileSection / userProfileSection.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 _0x9ff9=['http','UserProfileSection,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0xa2f68b,_0x5c5c5b){var _0x554d04=function(_0x393cc7){while(--_0x393cc7){_0xa2f68b['push'](_0xa2f68b['shift']());}};_0x554d04(++_0x5c5c5b);}(_0x9ff9,0x1c3));var _0x99ff=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x9ff9[_0x55f8b4];return _0x2475f9;};'use strict';var _=require('lodash');var util=require(_0x99ff('0x0'));var moment=require('moment');var BPromise=require(_0x99ff('0x1'));var rs=require(_0x99ff('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x99ff('0x3'))['db'];var utils=require(_0x99ff('0x4'));var logger=require(_0x99ff('0x5'))(_0x99ff('0x6'));var config=require('../../config/environment');var jayson=require(_0x99ff('0x7'));var client=jayson[_0x99ff('0x8')][_0x99ff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e3d41,_0x2d9fe5,_0x5dff10){return new BPromise(function(_0x21b6e8,_0x1be218){return client['request'](_0x1e3d41,_0x5dff10)['then'](function(_0x289c4f){logger['info'](_0x99ff('0xa'),_0x2d9fe5,'request\x20sent');logger[_0x99ff('0xb')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x2d9fe5,_0x99ff('0xc'),JSON[_0x99ff('0xd')](_0x289c4f));if(_0x289c4f[_0x99ff('0xe')]){if(_0x289c4f['error'][_0x99ff('0xf')]===0x1f4){logger[_0x99ff('0xe')](_0x99ff('0xa'),_0x2d9fe5,_0x289c4f[_0x99ff('0xe')]['message']);return _0x1be218(_0x289c4f[_0x99ff('0xe')][_0x99ff('0x10')]);}logger['error'](_0x99ff('0xa'),_0x2d9fe5,_0x289c4f['error']['message']);return _0x21b6e8(_0x289c4f[_0x99ff('0xe')][_0x99ff('0x10')]);}else{logger[_0x99ff('0x11')](_0x99ff('0xa'),_0x2d9fe5,_0x99ff('0xc'));_0x21b6e8(_0x289c4f[_0x99ff('0x12')][_0x99ff('0x10')]);}})[_0x99ff('0x13')](function(_0x5c0f5a){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x2d9fe5,_0x5c0f5a);_0x1be218(_0x5c0f5a);});});}