Built motion from commit 2e4747fd.|2.6.7
[motion2.git] / server / api / intVtigerField / intVtigerField.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 _0xd96e=['then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xd96e,0x1d8));var _0xed96=function(_0x1ab6d1,_0x28eb53){_0x1ab6d1=_0x1ab6d1-0x0;var _0x314f92=_0xd96e[_0x1ab6d1];return _0x314f92;};'use strict';var _=require('lodash');var util=require(_0xed96('0x0'));var moment=require(_0xed96('0x1'));var BPromise=require('bluebird');var rs=require(_0xed96('0x2'));var fs=require('fs');var Redis=require(_0xed96('0x3'));var db=require(_0xed96('0x4'))['db'];var utils=require(_0xed96('0x5'));var logger=require(_0xed96('0x6'))(_0xed96('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xed96('0x8')][_0xed96('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5114e6,_0x2b4199,_0x2a01d7){return new BPromise(function(_0x5d4357,_0x1235f3){return client[_0xed96('0xa')](_0x5114e6,_0x2a01d7)[_0xed96('0xb')](function(_0x359a5f){logger['info'](_0xed96('0xc'),_0x2b4199,_0xed96('0xd'));logger[_0xed96('0xe')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x2b4199,_0xed96('0xd'),JSON['stringify'](_0x359a5f));if(_0x359a5f[_0xed96('0xf')]){if(_0x359a5f['error'][_0xed96('0x10')]===0x1f4){logger[_0xed96('0xf')]('VtigerField,\x20%s,\x20%s',_0x2b4199,_0x359a5f['error']['message']);return _0x1235f3(_0x359a5f['error'][_0xed96('0x11')]);}logger[_0xed96('0xf')]('VtigerField,\x20%s,\x20%s',_0x2b4199,_0x359a5f[_0xed96('0xf')]['message']);return _0x5d4357(_0x359a5f[_0xed96('0xf')][_0xed96('0x11')]);}else{logger[_0xed96('0x12')](_0xed96('0xc'),_0x2b4199,_0xed96('0xd'));_0x5d4357(_0x359a5f[_0xed96('0x13')][_0xed96('0x11')]);}})[_0xed96('0x14')](function(_0x1d371f){logger['error'](_0xed96('0xc'),_0x2b4199,_0x1d371f);_0x1235f3(_0x1d371f);});});}