aa482d9bf9feaecc483a5c51991af47984aa69b7
[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 _0x2472=['request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x196bae,_0x48fc7a){var _0x1f3115=function(_0x3e86d5){while(--_0x3e86d5){_0x196bae['push'](_0x196bae['shift']());}};_0x1f3115(++_0x48fc7a);}(_0x2472,0x18f));var _0x2247=function(_0x4f6645,_0x4c81c9){_0x4f6645=_0x4f6645-0x0;var _0x3ffe4d=_0x2472[_0x4f6645];return _0x3ffe4d;};'use strict';var _=require(_0x2247('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2247('0x1'));var fs=require('fs');var Redis=require(_0x2247('0x2'));var db=require(_0x2247('0x3'))['db'];var utils=require(_0x2247('0x4'));var logger=require(_0x2247('0x5'))(_0x2247('0x6'));var config=require(_0x2247('0x7'));var jayson=require(_0x2247('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4f6aba,_0x4c0b30,_0x29e6da){return new BPromise(function(_0x12ff39,_0x2779fe){return client[_0x2247('0x9')](_0x4f6aba,_0x29e6da)[_0x2247('0xa')](function(_0x5476ab){logger[_0x2247('0xb')](_0x2247('0xc'),_0x4c0b30,_0x2247('0xd'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x4c0b30,'request\x20sent',JSON[_0x2247('0xe')](_0x5476ab));if(_0x5476ab[_0x2247('0xf')]){if(_0x5476ab['error']['code']===0x1f4){logger[_0x2247('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x4c0b30,_0x5476ab['error'][_0x2247('0x10')]);return _0x2779fe(_0x5476ab[_0x2247('0xf')]['message']);}logger['error'](_0x2247('0xc'),_0x4c0b30,_0x5476ab[_0x2247('0xf')]['message']);return _0x12ff39(_0x5476ab['error']['message']);}else{logger['info'](_0x2247('0xc'),_0x4c0b30,_0x2247('0xd'));_0x12ff39(_0x5476ab['result'][_0x2247('0x10')]);}})['catch'](function(_0xaec128){logger[_0x2247('0xf')](_0x2247('0xc'),_0x4c0b30,_0xaec128);_0x2779fe(_0xaec128);});});}