Built motion from commit 5b761a7b.|2.5.36
[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 _0x2085=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','code','error','CmCompany,\x20%s,\x20%s','message','catch','lodash','util','moment'];(function(_0x345a1b,_0x189c9e){var _0x1b24ec=function(_0x4437af){while(--_0x4437af){_0x345a1b['push'](_0x345a1b['shift']());}};_0x1b24ec(++_0x189c9e);}(_0x2085,0x147));var _0x5208=function(_0x14c0e0,_0x3ad847){_0x14c0e0=_0x14c0e0-0x0;var _0x4cbd72=_0x2085[_0x14c0e0];return _0x4cbd72;};'use strict';var _=require(_0x5208('0x0'));var util=require(_0x5208('0x1'));var moment=require(_0x5208('0x2'));var BPromise=require(_0x5208('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5208('0x4'));var db=require(_0x5208('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5208('0x6'))(_0x5208('0x7'));var config=require('../../config/environment');var jayson=require(_0x5208('0x8'));var client=jayson[_0x5208('0x9')][_0x5208('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1227bb,_0x12e9f9,_0xd86c7d){return new BPromise(function(_0x388f25,_0x3520ed){return client[_0x5208('0xb')](_0x1227bb,_0xd86c7d)[_0x5208('0xc')](function(_0x11119e){logger[_0x5208('0xd')]('CmCompany,\x20%s,\x20%s',_0x12e9f9,_0x5208('0xe'));logger[_0x5208('0xf')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x12e9f9,_0x5208('0xe'),JSON[_0x5208('0x10')](_0x11119e));if(_0x11119e['error']){if(_0x11119e['error'][_0x5208('0x11')]===0x1f4){logger[_0x5208('0x12')](_0x5208('0x13'),_0x12e9f9,_0x11119e[_0x5208('0x12')][_0x5208('0x14')]);return _0x3520ed(_0x11119e['error'][_0x5208('0x14')]);}logger[_0x5208('0x12')](_0x5208('0x13'),_0x12e9f9,_0x11119e['error'][_0x5208('0x14')]);return _0x388f25(_0x11119e[_0x5208('0x12')][_0x5208('0x14')]);}else{logger[_0x5208('0xd')]('CmCompany,\x20%s,\x20%s',_0x12e9f9,_0x5208('0xe'));_0x388f25(_0x11119e['result']['message']);}})[_0x5208('0x15')](function(_0x2f8984){logger[_0x5208('0x12')](_0x5208('0x13'),_0x12e9f9,_0x2f8984);_0x3520ed(_0x2f8984);});});}