bc01db709d8a57d98287e7867a869b5a83405adc
[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 _0x4d14=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x484626,_0x343080){var _0x151b6d=function(_0x2dbf03){while(--_0x2dbf03){_0x484626['push'](_0x484626['shift']());}};_0x151b6d(++_0x343080);}(_0x4d14,0x159));var _0x44d1=function(_0xe45118,_0x5dffbc){_0xe45118=_0xe45118-0x0;var _0x15e15d=_0x4d14[_0xe45118];return _0x15e15d;};'use strict';var _=require(_0x44d1('0x0'));var util=require(_0x44d1('0x1'));var moment=require(_0x44d1('0x2'));var BPromise=require('bluebird');var rs=require(_0x44d1('0x3'));var fs=require('fs');var Redis=require(_0x44d1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x44d1('0x5'));var logger=require(_0x44d1('0x6'))(_0x44d1('0x7'));var config=require(_0x44d1('0x8'));var jayson=require(_0x44d1('0x9'));var client=jayson[_0x44d1('0xa')][_0x44d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x450ba4,_0x13f0c1,_0x50a72e){return new BPromise(function(_0x431b19,_0x46ef15){return client[_0x44d1('0xc')](_0x450ba4,_0x50a72e)[_0x44d1('0xd')](function(_0x36014a){logger[_0x44d1('0xe')](_0x44d1('0xf'),_0x13f0c1,_0x44d1('0x10'));logger[_0x44d1('0x11')](_0x44d1('0x12'),_0x13f0c1,_0x44d1('0x10'),JSON[_0x44d1('0x13')](_0x36014a));if(_0x36014a['error']){if(_0x36014a[_0x44d1('0x14')][_0x44d1('0x15')]===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0x13f0c1,_0x36014a[_0x44d1('0x14')][_0x44d1('0x16')]);return _0x46ef15(_0x36014a[_0x44d1('0x14')][_0x44d1('0x16')]);}logger[_0x44d1('0x14')]('CmCompany,\x20%s,\x20%s',_0x13f0c1,_0x36014a[_0x44d1('0x14')][_0x44d1('0x16')]);return _0x431b19(_0x36014a['error'][_0x44d1('0x16')]);}else{logger[_0x44d1('0xe')](_0x44d1('0xf'),_0x13f0c1,_0x44d1('0x10'));_0x431b19(_0x36014a[_0x44d1('0x17')][_0x44d1('0x16')]);}})[_0x44d1('0x18')](function(_0x273790){logger[_0x44d1('0x14')](_0x44d1('0xf'),_0x13f0c1,_0x273790);_0x46ef15(_0x273790);});});}