Built motion from commit 43538d75.|2.5.35
[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 _0x1435=['util','moment','../../mysqldb','rpc','../../config/environment','client','http','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x356ddc,_0x110988){var _0x20b31a=function(_0x1130b8){while(--_0x1130b8){_0x356ddc['push'](_0x356ddc['shift']());}};_0x20b31a(++_0x110988);}(_0x1435,0x18e));var _0x5143=function(_0x17b9ee,_0x2a1900){_0x17b9ee=_0x17b9ee-0x0;var _0x2e2e2d=_0x1435[_0x17b9ee];return _0x2e2e2d;};'use strict';var _=require(_0x5143('0x0'));var util=require(_0x5143('0x1'));var moment=require(_0x5143('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5143('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5143('0x4'));var config=require(_0x5143('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x5143('0x6')][_0x5143('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4df3ac,_0x55f9b6,_0x27d225){return new BPromise(function(_0x284658,_0x43f2b1){return client['request'](_0x4df3ac,_0x27d225)[_0x5143('0x8')](function(_0x48a29e){logger[_0x5143('0x9')](_0x5143('0xa'),_0x55f9b6,_0x5143('0xb'));logger[_0x5143('0xc')](_0x5143('0xd'),_0x55f9b6,_0x5143('0xb'),JSON[_0x5143('0xe')](_0x48a29e));if(_0x48a29e['error']){if(_0x48a29e[_0x5143('0xf')][_0x5143('0x10')]===0x1f4){logger[_0x5143('0xf')](_0x5143('0xa'),_0x55f9b6,_0x48a29e[_0x5143('0xf')]['message']);return _0x43f2b1(_0x48a29e['error'][_0x5143('0x11')]);}logger['error'](_0x5143('0xa'),_0x55f9b6,_0x48a29e[_0x5143('0xf')]['message']);return _0x284658(_0x48a29e[_0x5143('0xf')][_0x5143('0x11')]);}else{logger[_0x5143('0x9')](_0x5143('0xa'),_0x55f9b6,'request\x20sent');_0x284658(_0x48a29e['result'][_0x5143('0x11')]);}})[_0x5143('0x12')](function(_0x57febb){logger[_0x5143('0xf')](_0x5143('0xa'),_0x55f9b6,_0x57febb);_0x43f2b1(_0x57febb);});});}