e7ed8cd6c6c61e6fed1adaa9ba04d82d99f713b6
[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 _0x2f59=['http','request','then','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x1fc1f9,_0x454fb2){var _0x4987ca=function(_0x5e90dd){while(--_0x5e90dd){_0x1fc1f9['push'](_0x1fc1f9['shift']());}};_0x4987ca(++_0x454fb2);}(_0x2f59,0x157));var _0x92f5=function(_0xd9f102,_0x5a0d28){_0xd9f102=_0xd9f102-0x0;var _0x2652e4=_0x2f59[_0xd9f102];return _0x2652e4;};'use strict';var _=require(_0x92f5('0x0'));var util=require(_0x92f5('0x1'));var moment=require('moment');var BPromise=require(_0x92f5('0x2'));var rs=require(_0x92f5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92f5('0x4'))['db'];var utils=require(_0x92f5('0x5'));var logger=require('../../config/logger')(_0x92f5('0x6'));var config=require(_0x92f5('0x7'));var jayson=require(_0x92f5('0x8'));var client=jayson['client'][_0x92f5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2bd197,_0x176bf1,_0x1e17e1){return new BPromise(function(_0x5d2dba,_0x3b4767){return client[_0x92f5('0xa')](_0x2bd197,_0x1e17e1)[_0x92f5('0xb')](function(_0x401a2b){logger[_0x92f5('0xc')](_0x92f5('0xd'),_0x176bf1,'request\x20sent');logger[_0x92f5('0xe')](_0x92f5('0xf'),_0x176bf1,_0x92f5('0x10'),JSON['stringify'](_0x401a2b));if(_0x401a2b[_0x92f5('0x11')]){if(_0x401a2b['error'][_0x92f5('0x12')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x176bf1,_0x401a2b[_0x92f5('0x11')][_0x92f5('0x13')]);return _0x3b4767(_0x401a2b[_0x92f5('0x11')][_0x92f5('0x13')]);}logger['error'](_0x92f5('0xd'),_0x176bf1,_0x401a2b['error'][_0x92f5('0x13')]);return _0x5d2dba(_0x401a2b[_0x92f5('0x11')][_0x92f5('0x13')]);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0x176bf1,_0x92f5('0x10'));_0x5d2dba(_0x401a2b[_0x92f5('0x14')][_0x92f5('0x13')]);}})[_0x92f5('0x15')](function(_0x467021){logger['error'](_0x92f5('0xd'),_0x176bf1,_0x467021);_0x3b4767(_0x467021);});});}