000ccbc3feecf46825b2c23703d05e42bfb10cc5
[motion2.git] / server / api / intVtigerConfiguration / intVtigerConfiguration.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 _0x12f5=['code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','then','VtigerConfiguration,\x20%s,\x20%s','debug','request\x20sent','error'];(function(_0xbcb4bf,_0x5296ed){var _0x3932b3=function(_0x3df0f2){while(--_0x3df0f2){_0xbcb4bf['push'](_0xbcb4bf['shift']());}};_0x3932b3(++_0x5296ed);}(_0x12f5,0x16d));var _0x512f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x12f5[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x512f('0x0'));var util=require(_0x512f('0x1'));var moment=require(_0x512f('0x2'));var BPromise=require(_0x512f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x512f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x512f('0x5'));var logger=require(_0x512f('0x6'))('rpc');var config=require(_0x512f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x512f('0x8')][_0x512f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23670c,_0x22737e,_0x17e0ad){return new BPromise(function(_0x5740ce,_0x460251){return client['request'](_0x23670c,_0x17e0ad)[_0x512f('0xa')](function(_0x4e1079){logger['info'](_0x512f('0xb'),_0x22737e,'request\x20sent');logger[_0x512f('0xc')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x22737e,_0x512f('0xd'),JSON['stringify'](_0x4e1079));if(_0x4e1079[_0x512f('0xe')]){if(_0x4e1079[_0x512f('0xe')][_0x512f('0xf')]===0x1f4){logger['error'](_0x512f('0xb'),_0x22737e,_0x4e1079[_0x512f('0xe')][_0x512f('0x10')]);return _0x460251(_0x4e1079[_0x512f('0xe')][_0x512f('0x10')]);}logger[_0x512f('0xe')](_0x512f('0xb'),_0x22737e,_0x4e1079['error']['message']);return _0x5740ce(_0x4e1079[_0x512f('0xe')]['message']);}else{logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x22737e,_0x512f('0xd'));_0x5740ce(_0x4e1079[_0x512f('0x11')][_0x512f('0x10')]);}})[_0x512f('0x12')](function(_0x2d6cfb){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x22737e,_0x2d6cfb);_0x460251(_0x2d6cfb);});});}