Built motion from commit 47436d59.|2.6.7
[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 _0xbf59=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmCompany,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x237973,_0x3b3285){var _0x3836c8=function(_0x1162fe){while(--_0x1162fe){_0x237973['push'](_0x237973['shift']());}};_0x3836c8(++_0x3b3285);}(_0xbf59,0x124));var _0x9bf5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf59[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9bf5('0x0'));var util=require(_0x9bf5('0x1'));var moment=require(_0x9bf5('0x2'));var BPromise=require(_0x9bf5('0x3'));var rs=require(_0x9bf5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9bf5('0x5'))['db'];var utils=require(_0x9bf5('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x9bf5('0x7'));var jayson=require(_0x9bf5('0x8'));var client=jayson[_0x9bf5('0x9')][_0x9bf5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39cd39,_0x114c81,_0x4f3969){return new BPromise(function(_0x43d916,_0x3fa745){return client[_0x9bf5('0xb')](_0x39cd39,_0x4f3969)[_0x9bf5('0xc')](function(_0x2552ff){logger[_0x9bf5('0xd')]('CmCompany,\x20%s,\x20%s',_0x114c81,_0x9bf5('0xe'));logger[_0x9bf5('0xf')](_0x9bf5('0x10'),_0x114c81,_0x9bf5('0xe'),JSON[_0x9bf5('0x11')](_0x2552ff));if(_0x2552ff[_0x9bf5('0x12')]){if(_0x2552ff[_0x9bf5('0x12')][_0x9bf5('0x13')]===0x1f4){logger[_0x9bf5('0x12')]('CmCompany,\x20%s,\x20%s',_0x114c81,_0x2552ff[_0x9bf5('0x12')]['message']);return _0x3fa745(_0x2552ff[_0x9bf5('0x12')][_0x9bf5('0x14')]);}logger[_0x9bf5('0x12')](_0x9bf5('0x15'),_0x114c81,_0x2552ff[_0x9bf5('0x12')][_0x9bf5('0x14')]);return _0x43d916(_0x2552ff['error']['message']);}else{logger[_0x9bf5('0xd')](_0x9bf5('0x15'),_0x114c81,_0x9bf5('0xe'));_0x43d916(_0x2552ff[_0x9bf5('0x16')][_0x9bf5('0x14')]);}})['catch'](function(_0x2a4f47){logger[_0x9bf5('0x12')](_0x9bf5('0x15'),_0x114c81,_0x2a4f47);_0x3fa745(_0x2a4f47);});});}