Built motion from commit (unavailable).|2.5.27
[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 _0x61cd=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','ioredis'];(function(_0x3da144,_0x578cbd){var _0x13fdc7=function(_0x2d2919){while(--_0x2d2919){_0x3da144['push'](_0x3da144['shift']());}};_0x13fdc7(++_0x578cbd);}(_0x61cd,0x11b));var _0xd61c=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x61cd[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xd61c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd61c('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xd61c('0x2'));var logger=require(_0xd61c('0x3'))('rpc');var config=require(_0xd61c('0x4'));var jayson=require(_0xd61c('0x5'));var client=jayson[_0xd61c('0x6')][_0xd61c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3a533c,_0x1dfaad,_0x13abfd){return new BPromise(function(_0x37674a,_0x59858b){return client['request'](_0x3a533c,_0x13abfd)[_0xd61c('0x8')](function(_0xd1184a){logger['info'](_0xd61c('0x9'),_0x1dfaad,_0xd61c('0xa'));logger[_0xd61c('0xb')](_0xd61c('0xc'),_0x1dfaad,_0xd61c('0xa'),JSON[_0xd61c('0xd')](_0xd1184a));if(_0xd1184a['error']){if(_0xd1184a[_0xd61c('0xe')][_0xd61c('0xf')]===0x1f4){logger[_0xd61c('0xe')](_0xd61c('0x9'),_0x1dfaad,_0xd1184a[_0xd61c('0xe')][_0xd61c('0x10')]);return _0x59858b(_0xd1184a[_0xd61c('0xe')][_0xd61c('0x10')]);}logger[_0xd61c('0xe')]('CmCompany,\x20%s,\x20%s',_0x1dfaad,_0xd1184a['error'][_0xd61c('0x10')]);return _0x37674a(_0xd1184a[_0xd61c('0xe')][_0xd61c('0x10')]);}else{logger[_0xd61c('0x11')](_0xd61c('0x9'),_0x1dfaad,'request\x20sent');_0x37674a(_0xd1184a[_0xd61c('0x12')][_0xd61c('0x10')]);}})['catch'](function(_0xabd2ce){logger[_0xd61c('0xe')](_0xd61c('0x9'),_0x1dfaad,_0xabd2ce);_0x59858b(_0xabd2ce);});});}