c43f676f08ba94e54bb6a13fac588e2e6608366b
[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 _0x0275=['request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerField,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info'];(function(_0x2ec9a4,_0x16f07c){var _0x284680=function(_0x142510){while(--_0x142510){_0x2ec9a4['push'](_0x2ec9a4['shift']());}};_0x284680(++_0x16f07c);}(_0x0275,0x183));var _0x5027=function(_0x7eba5c,_0x33b742){_0x7eba5c=_0x7eba5c-0x0;var _0x75cb1c=_0x0275[_0x7eba5c];return _0x75cb1c;};'use strict';var _=require(_0x5027('0x0'));var util=require(_0x5027('0x1'));var moment=require('moment');var BPromise=require(_0x5027('0x2'));var rs=require(_0x5027('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5027('0x4'))['db'];var utils=require(_0x5027('0x5'));var logger=require(_0x5027('0x6'))(_0x5027('0x7'));var config=require(_0x5027('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5027('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50dea0,_0x3411bf,_0x5aff83){return new BPromise(function(_0x55fad8,_0x54f3e4){return client[_0x5027('0xa')](_0x50dea0,_0x5aff83)['then'](function(_0x246983){logger[_0x5027('0xb')]('VtigerField,\x20%s,\x20%s',_0x3411bf,_0x5027('0xc'));logger[_0x5027('0xd')](_0x5027('0xe'),_0x3411bf,_0x5027('0xc'),JSON[_0x5027('0xf')](_0x246983));if(_0x246983['error']){if(_0x246983[_0x5027('0x10')][_0x5027('0x11')]===0x1f4){logger['error'](_0x5027('0x12'),_0x3411bf,_0x246983[_0x5027('0x10')][_0x5027('0x13')]);return _0x54f3e4(_0x246983[_0x5027('0x10')][_0x5027('0x13')]);}logger[_0x5027('0x10')](_0x5027('0x12'),_0x3411bf,_0x246983['error'][_0x5027('0x13')]);return _0x55fad8(_0x246983[_0x5027('0x10')][_0x5027('0x13')]);}else{logger[_0x5027('0xb')](_0x5027('0x12'),_0x3411bf,_0x5027('0xc'));_0x55fad8(_0x246983['result']['message']);}})[_0x5027('0x14')](function(_0x43d263){logger[_0x5027('0x10')](_0x5027('0x12'),_0x3411bf,_0x43d263);_0x54f3e4(_0x43d263);});});}