Built motion from commit da24aabd.|2.6.20
[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 _0x41f2=['../../config/logger','rpc','../../config/environment','client','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','../../mysqldb'];(function(_0x2e88a9,_0x1af88b){var _0x3032e9=function(_0x51f335){while(--_0x51f335){_0x2e88a9['push'](_0x2e88a9['shift']());}};_0x3032e9(++_0x1af88b);}(_0x41f2,0x12f));var _0x241f=function(_0x3eee8e,_0x5cd9a5){_0x3eee8e=_0x3eee8e-0x0;var _0x1ff3c9=_0x41f2[_0x3eee8e];return _0x1ff3c9;};'use strict';var _=require(_0x241f('0x0'));var util=require(_0x241f('0x1'));var moment=require(_0x241f('0x2'));var BPromise=require('bluebird');var rs=require(_0x241f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x241f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x241f('0x5'))(_0x241f('0x6'));var config=require(_0x241f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x241f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a3256,_0x29c5ea,_0x2598e9){return new BPromise(function(_0x61d7f7,_0x1d62f6){return client[_0x241f('0x9')](_0x4a3256,_0x2598e9)[_0x241f('0xa')](function(_0xb2f985){logger[_0x241f('0xb')](_0x241f('0xc'),_0x29c5ea,_0x241f('0xd'));logger[_0x241f('0xe')](_0x241f('0xf'),_0x29c5ea,_0x241f('0xd'),JSON[_0x241f('0x10')](_0xb2f985));if(_0xb2f985['error']){if(_0xb2f985[_0x241f('0x11')][_0x241f('0x12')]===0x1f4){logger['error'](_0x241f('0xc'),_0x29c5ea,_0xb2f985[_0x241f('0x11')][_0x241f('0x13')]);return _0x1d62f6(_0xb2f985[_0x241f('0x11')][_0x241f('0x13')]);}logger[_0x241f('0x11')]('CmCompany,\x20%s,\x20%s',_0x29c5ea,_0xb2f985[_0x241f('0x11')][_0x241f('0x13')]);return _0x61d7f7(_0xb2f985[_0x241f('0x11')][_0x241f('0x13')]);}else{logger[_0x241f('0xb')](_0x241f('0xc'),_0x29c5ea,'request\x20sent');_0x61d7f7(_0xb2f985[_0x241f('0x14')]['message']);}})[_0x241f('0x15')](function(_0x4afe6d){logger[_0x241f('0x11')](_0x241f('0xc'),_0x29c5ea,_0x4afe6d);_0x1d62f6(_0x4afe6d);});});}