116e6271a17f4aeb846bd0c6b6ec246768255a3b
[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 _0x0165=['result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0165,0xde));var _0x5016=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0165[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x5016('0x0'));var util=require(_0x5016('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5016('0x2'));var fs=require('fs');var Redis=require(_0x5016('0x3'));var db=require(_0x5016('0x4'))['db'];var utils=require(_0x5016('0x5'));var logger=require('../../config/logger')(_0x5016('0x6'));var config=require(_0x5016('0x7'));var jayson=require(_0x5016('0x8'));var client=jayson[_0x5016('0x9')][_0x5016('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33a8bb,_0x3076e6,_0x6ed40){return new BPromise(function(_0x27e6c7,_0x42bc41){return client[_0x5016('0xb')](_0x33a8bb,_0x6ed40)[_0x5016('0xc')](function(_0x3b02f8){logger['info'](_0x5016('0xd'),_0x3076e6,_0x5016('0xe'));logger[_0x5016('0xf')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x3076e6,'request\x20sent',JSON[_0x5016('0x10')](_0x3b02f8));if(_0x3b02f8[_0x5016('0x11')]){if(_0x3b02f8[_0x5016('0x11')][_0x5016('0x12')]===0x1f4){logger['error'](_0x5016('0xd'),_0x3076e6,_0x3b02f8[_0x5016('0x11')][_0x5016('0x13')]);return _0x42bc41(_0x3b02f8[_0x5016('0x11')][_0x5016('0x13')]);}logger['error'](_0x5016('0xd'),_0x3076e6,_0x3b02f8[_0x5016('0x11')]['message']);return _0x27e6c7(_0x3b02f8[_0x5016('0x11')][_0x5016('0x13')]);}else{logger['info'](_0x5016('0xd'),_0x3076e6,_0x5016('0xe'));_0x27e6c7(_0x3b02f8[_0x5016('0x14')][_0x5016('0x13')]);}})[_0x5016('0x15')](function(_0x446202){logger[_0x5016('0x11')](_0x5016('0xd'),_0x3076e6,_0x446202);_0x42bc41(_0x446202);});});}