Built motion from commit 753c950e.|2.5.42
[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 _0x96c3=['error','code','message','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x96c3,0x1df));var _0x396c=function(_0x3a94b2,_0x233396){_0x3a94b2=_0x3a94b2-0x0;var _0x63c015=_0x96c3[_0x3a94b2];return _0x63c015;};'use strict';var _=require('lodash');var util=require(_0x396c('0x0'));var moment=require('moment');var BPromise=require(_0x396c('0x1'));var rs=require(_0x396c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x396c('0x3'))['db'];var utils=require(_0x396c('0x4'));var logger=require(_0x396c('0x5'))(_0x396c('0x6'));var config=require('../../config/environment');var jayson=require(_0x396c('0x7'));var client=jayson['client'][_0x396c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24580b,_0x86216e,_0x4c0f89){return new BPromise(function(_0x4d0e04,_0x20c62f){return client[_0x396c('0x9')](_0x24580b,_0x4c0f89)[_0x396c('0xa')](function(_0x457967){logger['info'](_0x396c('0xb'),_0x86216e,_0x396c('0xc'));logger[_0x396c('0xd')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x86216e,_0x396c('0xc'),JSON[_0x396c('0xe')](_0x457967));if(_0x457967[_0x396c('0xf')]){if(_0x457967[_0x396c('0xf')][_0x396c('0x10')]===0x1f4){logger[_0x396c('0xf')](_0x396c('0xb'),_0x86216e,_0x457967[_0x396c('0xf')][_0x396c('0x11')]);return _0x20c62f(_0x457967[_0x396c('0xf')][_0x396c('0x11')]);}logger[_0x396c('0xf')]('VtigerField,\x20%s,\x20%s',_0x86216e,_0x457967[_0x396c('0xf')][_0x396c('0x11')]);return _0x4d0e04(_0x457967[_0x396c('0xf')][_0x396c('0x11')]);}else{logger['info'](_0x396c('0xb'),_0x86216e,'request\x20sent');_0x4d0e04(_0x457967['result']['message']);}})[_0x396c('0x12')](function(_0x52ab7f){logger['error'](_0x396c('0xb'),_0x86216e,_0x52ab7f);_0x20c62f(_0x52ab7f);});});}