Built motion from commit b7e79837.|2.6.29
[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 _0xa27b=['CmCompany,\x20%s,\x20%s','message','catch','util','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','request','then','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x469ae2,_0x24cd30){var _0x5e33e4=function(_0x1aaeb1){while(--_0x1aaeb1){_0x469ae2['push'](_0x469ae2['shift']());}};_0x5e33e4(++_0x24cd30);}(_0xa27b,0x153));var _0xba27=function(_0x3f4166,_0x55fcea){_0x3f4166=_0x3f4166-0x0;var _0x2cad5e=_0xa27b[_0x3f4166];return _0x2cad5e;};'use strict';var _=require('lodash');var util=require(_0xba27('0x0'));var moment=require('moment');var BPromise=require(_0xba27('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba27('0x2'))['db'];var utils=require(_0xba27('0x3'));var logger=require('../../config/logger')(_0xba27('0x4'));var config=require('../../config/environment');var jayson=require(_0xba27('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5945ec,_0xbb0178,_0x40cfe6){return new BPromise(function(_0x546d18,_0x3c1812){return client[_0xba27('0x6')](_0x5945ec,_0x40cfe6)[_0xba27('0x7')](function(_0x1073ec){logger['info']('CmCompany,\x20%s,\x20%s',_0xbb0178,'request\x20sent');logger[_0xba27('0x8')](_0xba27('0x9'),_0xbb0178,'request\x20sent',JSON[_0xba27('0xa')](_0x1073ec));if(_0x1073ec[_0xba27('0xb')]){if(_0x1073ec[_0xba27('0xb')][_0xba27('0xc')]===0x1f4){logger[_0xba27('0xb')](_0xba27('0xd'),_0xbb0178,_0x1073ec['error'][_0xba27('0xe')]);return _0x3c1812(_0x1073ec[_0xba27('0xb')][_0xba27('0xe')]);}logger[_0xba27('0xb')](_0xba27('0xd'),_0xbb0178,_0x1073ec[_0xba27('0xb')][_0xba27('0xe')]);return _0x546d18(_0x1073ec['error'][_0xba27('0xe')]);}else{logger['info'](_0xba27('0xd'),_0xbb0178,'request\x20sent');_0x546d18(_0x1073ec['result']['message']);}})[_0xba27('0xf')](function(_0x3b19b3){logger[_0xba27('0xb')]('CmCompany,\x20%s,\x20%s',_0xbb0178,_0x3b19b3);_0x3c1812(_0x3b19b3);});});}