Built motion from commit d1eab355.|2.6.28
[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 _0x1226=['randomstring','../../config/utils','../../config/logger','client','http','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','moment'];(function(_0x4db46b,_0xadcb1a){var _0x565be8=function(_0x5d2e50){while(--_0x5d2e50){_0x4db46b['push'](_0x4db46b['shift']());}};_0x565be8(++_0xadcb1a);}(_0x1226,0x173));var _0x6122=function(_0x1d98e9,_0x4acbad){_0x1d98e9=_0x1d98e9-0x0;var _0x59c8c9=_0x1226[_0x1d98e9];return _0x59c8c9;};'use strict';var _=require(_0x6122('0x0'));var util=require(_0x6122('0x1'));var moment=require(_0x6122('0x2'));var BPromise=require('bluebird');var rs=require(_0x6122('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6122('0x4'));var logger=require(_0x6122('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6122('0x6')][_0x6122('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2d7df5,_0x5e32d4,_0x3c71bd){return new BPromise(function(_0x3aff2e,_0x44a021){return client[_0x6122('0x8')](_0x2d7df5,_0x3c71bd)['then'](function(_0x5d1374){logger[_0x6122('0x9')](_0x6122('0xa'),_0x5e32d4,_0x6122('0xb'));logger[_0x6122('0xc')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x5e32d4,'request\x20sent',JSON['stringify'](_0x5d1374));if(_0x5d1374[_0x6122('0xd')]){if(_0x5d1374['error'][_0x6122('0xe')]===0x1f4){logger[_0x6122('0xd')](_0x6122('0xa'),_0x5e32d4,_0x5d1374[_0x6122('0xd')][_0x6122('0xf')]);return _0x44a021(_0x5d1374[_0x6122('0xd')][_0x6122('0xf')]);}logger[_0x6122('0xd')](_0x6122('0xa'),_0x5e32d4,_0x5d1374[_0x6122('0xd')]['message']);return _0x3aff2e(_0x5d1374['error']['message']);}else{logger[_0x6122('0x9')](_0x6122('0xa'),_0x5e32d4,_0x6122('0xb'));_0x3aff2e(_0x5d1374['result']['message']);}})[_0x6122('0x10')](function(_0x591807){logger['error'](_0x6122('0xa'),_0x5e32d4,_0x591807);_0x44a021(_0x591807);});});}