9ad5600eede45c9932b2a1a31536322a0bc912e9
[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 _0x8c19=['rpc','jayson/promise','http','then','CmCompany,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2d7712,_0x39aba4){var _0x2efa08=function(_0xfbe847){while(--_0xfbe847){_0x2d7712['push'](_0x2d7712['shift']());}};_0x2efa08(++_0x39aba4);}(_0x8c19,0xca));var _0x98c1=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x8c19[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require('lodash');var util=require(_0x98c1('0x0'));var moment=require(_0x98c1('0x1'));var BPromise=require(_0x98c1('0x2'));var rs=require(_0x98c1('0x3'));var fs=require('fs');var Redis=require(_0x98c1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x98c1('0x5'));var logger=require(_0x98c1('0x6'))(_0x98c1('0x7'));var config=require('../../config/environment');var jayson=require(_0x98c1('0x8'));var client=jayson['client'][_0x98c1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xaf04b6,_0x5071d6,_0x20e06f){return new BPromise(function(_0x1f62c0,_0x507fa6){return client['request'](_0xaf04b6,_0x20e06f)[_0x98c1('0xa')](function(_0x190cf1){logger['info'](_0x98c1('0xb'),_0x5071d6,'request\x20sent');logger[_0x98c1('0xc')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x5071d6,_0x98c1('0xd'),JSON['stringify'](_0x190cf1));if(_0x190cf1[_0x98c1('0xe')]){if(_0x190cf1[_0x98c1('0xe')][_0x98c1('0xf')]===0x1f4){logger[_0x98c1('0xe')](_0x98c1('0xb'),_0x5071d6,_0x190cf1['error']['message']);return _0x507fa6(_0x190cf1[_0x98c1('0xe')][_0x98c1('0x10')]);}logger[_0x98c1('0xe')](_0x98c1('0xb'),_0x5071d6,_0x190cf1['error'][_0x98c1('0x10')]);return _0x1f62c0(_0x190cf1['error'][_0x98c1('0x10')]);}else{logger[_0x98c1('0x11')]('CmCompany,\x20%s,\x20%s',_0x5071d6,_0x98c1('0xd'));_0x1f62c0(_0x190cf1['result'][_0x98c1('0x10')]);}})[_0x98c1('0x12')](function(_0x22bcdf){logger['error']('CmCompany,\x20%s,\x20%s',_0x5071d6,_0x22bcdf);_0x507fa6(_0x22bcdf);});});}