28e2abce9edb1a0eaaca82977b257502283cc791
[motion2.git] / server / api / cmCompany / cmCompany.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 _0xd621=['../../config/logger','rpc','../../config/environment','request','info','request\x20sent','debug','stringify','error','message','CmCompany,\x20%s,\x20%s','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x2d51f2,_0x49e3cc){var _0x427f52=function(_0x38df2e){while(--_0x38df2e){_0x2d51f2['push'](_0x2d51f2['shift']());}};_0x427f52(++_0x49e3cc);}(_0xd621,0x109));var _0x1d62=function(_0x2e1af3,_0x2a077b){_0x2e1af3=_0x2e1af3-0x0;var _0x4150cd=_0xd621[_0x2e1af3];return _0x4150cd;};'use strict';var _=require(_0x1d62('0x0'));var util=require(_0x1d62('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1d62('0x2'));var fs=require('fs');var Redis=require(_0x1d62('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1d62('0x4'));var logger=require(_0x1d62('0x5'))(_0x1d62('0x6'));var config=require(_0x1d62('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x454c9c,_0x4a5d76,_0x2c3eb8){return new BPromise(function(_0x28e46d,_0x6d8900){return client[_0x1d62('0x8')](_0x454c9c,_0x2c3eb8)['then'](function(_0x78f02c){logger[_0x1d62('0x9')]('CmCompany,\x20%s,\x20%s',_0x4a5d76,_0x1d62('0xa'));logger[_0x1d62('0xb')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x4a5d76,_0x1d62('0xa'),JSON[_0x1d62('0xc')](_0x78f02c));if(_0x78f02c['error']){if(_0x78f02c[_0x1d62('0xd')]['code']===0x1f4){logger[_0x1d62('0xd')]('CmCompany,\x20%s,\x20%s',_0x4a5d76,_0x78f02c[_0x1d62('0xd')][_0x1d62('0xe')]);return _0x6d8900(_0x78f02c[_0x1d62('0xd')][_0x1d62('0xe')]);}logger[_0x1d62('0xd')](_0x1d62('0xf'),_0x4a5d76,_0x78f02c[_0x1d62('0xd')][_0x1d62('0xe')]);return _0x28e46d(_0x78f02c['error']['message']);}else{logger[_0x1d62('0x9')](_0x1d62('0xf'),_0x4a5d76,_0x1d62('0xa'));_0x28e46d(_0x78f02c[_0x1d62('0x10')][_0x1d62('0xe')]);}})[_0x1d62('0x11')](function(_0x5a580b){logger[_0x1d62('0xd')](_0x1d62('0xf'),_0x4a5d76,_0x5a580b);_0x6d8900(_0x5a580b);});});}