9795fc7f7f5cbad2c4172b5d66320954724cbc0a
[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 _0xdc50=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','message','catch'];(function(_0x1abeb2,_0x79f462){var _0x48da20=function(_0x42a90b){while(--_0x42a90b){_0x1abeb2['push'](_0x1abeb2['shift']());}};_0x48da20(++_0x79f462);}(_0xdc50,0x143));var _0x0dc5=function(_0xcddf7d,_0x4f3044){_0xcddf7d=_0xcddf7d-0x0;var _0x1b401=_0xdc50[_0xcddf7d];return _0x1b401;};'use strict';var _=require(_0x0dc5('0x0'));var util=require(_0x0dc5('0x1'));var moment=require(_0x0dc5('0x2'));var BPromise=require('bluebird');var rs=require(_0x0dc5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0dc5('0x4'))['db'];var utils=require(_0x0dc5('0x5'));var logger=require('../../config/logger')(_0x0dc5('0x6'));var config=require(_0x0dc5('0x7'));var jayson=require(_0x0dc5('0x8'));var client=jayson[_0x0dc5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x171fb0,_0x637deb,_0x39a16b){return new BPromise(function(_0x583222,_0x5da9d2){return client[_0x0dc5('0xa')](_0x171fb0,_0x39a16b)[_0x0dc5('0xb')](function(_0x2d234c){logger['info'](_0x0dc5('0xc'),_0x637deb,_0x0dc5('0xd'));logger[_0x0dc5('0xe')](_0x0dc5('0xf'),_0x637deb,_0x0dc5('0xd'),JSON['stringify'](_0x2d234c));if(_0x2d234c[_0x0dc5('0x10')]){if(_0x2d234c[_0x0dc5('0x10')]['code']===0x1f4){logger[_0x0dc5('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x637deb,_0x2d234c[_0x0dc5('0x10')]['message']);return _0x5da9d2(_0x2d234c['error']['message']);}logger[_0x0dc5('0x10')](_0x0dc5('0xc'),_0x637deb,_0x2d234c['error'][_0x0dc5('0x11')]);return _0x583222(_0x2d234c[_0x0dc5('0x10')][_0x0dc5('0x11')]);}else{logger['info']('UserProfileSection,\x20%s,\x20%s',_0x637deb,'request\x20sent');_0x583222(_0x2d234c['result'][_0x0dc5('0x11')]);}})[_0x0dc5('0x12')](function(_0x31ee2b){logger['error'](_0x0dc5('0xc'),_0x637deb,_0x31ee2b);_0x5da9d2(_0x31ee2b);});});}