84cd644224e00a7f5176c64790920ceed3d111fd
[motion2.git] / server / api / intSugarcrmField / intSugarcrmField.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 _0xb57e=['SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0xda461f,_0x11bd61){var _0x271218=function(_0x5263ea){while(--_0x5263ea){_0xda461f['push'](_0xda461f['shift']());}};_0x271218(++_0x11bd61);}(_0xb57e,0x128));var _0xeb57=function(_0x545a77,_0x5b2165){_0x545a77=_0x545a77-0x0;var _0x3e0449=_0xb57e[_0x545a77];return _0x3e0449;};'use strict';var _=require(_0xeb57('0x0'));var util=require(_0xeb57('0x1'));var moment=require(_0xeb57('0x2'));var BPromise=require(_0xeb57('0x3'));var rs=require(_0xeb57('0x4'));var fs=require('fs');var Redis=require(_0xeb57('0x5'));var db=require(_0xeb57('0x6'))['db'];var utils=require(_0xeb57('0x7'));var logger=require(_0xeb57('0x8'))(_0xeb57('0x9'));var config=require(_0xeb57('0xa'));var jayson=require(_0xeb57('0xb'));var client=jayson[_0xeb57('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d162e,_0x5285df,_0x41e60f){return new BPromise(function(_0x1e06e0,_0xa42f5d){return client[_0xeb57('0xd')](_0x2d162e,_0x41e60f)[_0xeb57('0xe')](function(_0x1ce297){logger[_0xeb57('0xf')](_0xeb57('0x10'),_0x5285df,_0xeb57('0x11'));logger[_0xeb57('0x12')](_0xeb57('0x13'),_0x5285df,_0xeb57('0x11'),JSON[_0xeb57('0x14')](_0x1ce297));if(_0x1ce297[_0xeb57('0x15')]){if(_0x1ce297[_0xeb57('0x15')][_0xeb57('0x16')]===0x1f4){logger[_0xeb57('0x15')]('SugarcrmField,\x20%s,\x20%s',_0x5285df,_0x1ce297[_0xeb57('0x15')][_0xeb57('0x17')]);return _0xa42f5d(_0x1ce297[_0xeb57('0x15')][_0xeb57('0x17')]);}logger[_0xeb57('0x15')]('SugarcrmField,\x20%s,\x20%s',_0x5285df,_0x1ce297[_0xeb57('0x15')][_0xeb57('0x17')]);return _0x1e06e0(_0x1ce297[_0xeb57('0x15')]['message']);}else{logger[_0xeb57('0xf')](_0xeb57('0x10'),_0x5285df,_0xeb57('0x11'));_0x1e06e0(_0x1ce297[_0xeb57('0x18')][_0xeb57('0x17')]);}})[_0xeb57('0x19')](function(_0x46a4d9){logger[_0xeb57('0x15')](_0xeb57('0x10'),_0x5285df,_0x46a4d9);_0xa42f5d(_0x46a4d9);});});}