68f267ae267bbc9e449a5df4947f5ce6b7d97430
[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 _0x132e=['then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x132e,0x140));var _0xe132=function(_0x1e399a,_0x351c59){_0x1e399a=_0x1e399a-0x0;var _0x539897=_0x132e[_0x1e399a];return _0x539897;};'use strict';var _=require(_0xe132('0x0'));var util=require('util');var moment=require(_0xe132('0x1'));var BPromise=require(_0xe132('0x2'));var rs=require(_0xe132('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe132('0x4'))['db'];var utils=require(_0xe132('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe132('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe132('0x7')][_0xe132('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1cd30d,_0x136d6c,_0x50647c){return new BPromise(function(_0xb508b0,_0x22f0eb){return client[_0xe132('0x9')](_0x1cd30d,_0x50647c)[_0xe132('0xa')](function(_0x682a57){logger[_0xe132('0xb')](_0xe132('0xc'),_0x136d6c,_0xe132('0xd'));logger[_0xe132('0xe')](_0xe132('0xf'),_0x136d6c,_0xe132('0xd'),JSON[_0xe132('0x10')](_0x682a57));if(_0x682a57[_0xe132('0x11')]){if(_0x682a57[_0xe132('0x11')][_0xe132('0x12')]===0x1f4){logger[_0xe132('0x11')](_0xe132('0xc'),_0x136d6c,_0x682a57[_0xe132('0x11')][_0xe132('0x13')]);return _0x22f0eb(_0x682a57['error'][_0xe132('0x13')]);}logger['error'](_0xe132('0xc'),_0x136d6c,_0x682a57[_0xe132('0x11')][_0xe132('0x13')]);return _0xb508b0(_0x682a57[_0xe132('0x11')][_0xe132('0x13')]);}else{logger[_0xe132('0xb')]('CmCompany,\x20%s,\x20%s',_0x136d6c,'request\x20sent');_0xb508b0(_0x682a57[_0xe132('0x14')]['message']);}})[_0xe132('0x15')](function(_0x2a4b7f){logger[_0xe132('0x11')](_0xe132('0xc'),_0x136d6c,_0x2a4b7f);_0x22f0eb(_0x2a4b7f);});});}