Built motion from commit (unavailable).|2.5.31
[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 _0xf0b9=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','CmCompany,\x20%s,\x20%s','message','info','result','util','randomstring','ioredis'];(function(_0x386e88,_0x26ac2e){var _0x2b3208=function(_0x42b498){while(--_0x42b498){_0x386e88['push'](_0x386e88['shift']());}};_0x2b3208(++_0x26ac2e);}(_0xf0b9,0x140));var _0x9f0b=function(_0x304aa0,_0x48b6dd){_0x304aa0=_0x304aa0-0x0;var _0x23fa38=_0xf0b9[_0x304aa0];return _0x23fa38;};'use strict';var _=require('lodash');var util=require(_0x9f0b('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9f0b('0x1'));var fs=require('fs');var Redis=require(_0x9f0b('0x2'));var db=require(_0x9f0b('0x3'))['db'];var utils=require(_0x9f0b('0x4'));var logger=require(_0x9f0b('0x5'))(_0x9f0b('0x6'));var config=require(_0x9f0b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9f0b('0x8')][_0x9f0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20625c,_0x3fa6b7,_0x35ef61){return new BPromise(function(_0x49d1ed,_0x453aa9){return client['request'](_0x20625c,_0x35ef61)['then'](function(_0x167379){logger['info']('CmCompany,\x20%s,\x20%s',_0x3fa6b7,_0x9f0b('0xa'));logger[_0x9f0b('0xb')](_0x9f0b('0xc'),_0x3fa6b7,'request\x20sent',JSON['stringify'](_0x167379));if(_0x167379[_0x9f0b('0xd')]){if(_0x167379['error'][_0x9f0b('0xe')]===0x1f4){logger[_0x9f0b('0xd')](_0x9f0b('0xf'),_0x3fa6b7,_0x167379['error'][_0x9f0b('0x10')]);return _0x453aa9(_0x167379[_0x9f0b('0xd')][_0x9f0b('0x10')]);}logger[_0x9f0b('0xd')](_0x9f0b('0xf'),_0x3fa6b7,_0x167379[_0x9f0b('0xd')]['message']);return _0x49d1ed(_0x167379[_0x9f0b('0xd')][_0x9f0b('0x10')]);}else{logger[_0x9f0b('0x11')](_0x9f0b('0xf'),_0x3fa6b7,'request\x20sent');_0x49d1ed(_0x167379[_0x9f0b('0x12')][_0x9f0b('0x10')]);}})['catch'](function(_0x57d182){logger[_0x9f0b('0xd')](_0x9f0b('0xf'),_0x3fa6b7,_0x57d182);_0x453aa9(_0x57d182);});});}