6d298efece2ee8439f7506966c05ba79aac33d81
[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 _0x5b17=['../../config/environment','client','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x5179a5,_0x419746){var _0x15c8ce=function(_0x1b13c4){while(--_0x1b13c4){_0x5179a5['push'](_0x5179a5['shift']());}};_0x15c8ce(++_0x419746);}(_0x5b17,0xf0));var _0x75b1=function(_0x3383c9,_0x279599){_0x3383c9=_0x3383c9-0x0;var _0x2db909=_0x5b17[_0x3383c9];return _0x2db909;};'use strict';var _=require(_0x75b1('0x0'));var util=require(_0x75b1('0x1'));var moment=require('moment');var BPromise=require(_0x75b1('0x2'));var rs=require(_0x75b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x75b1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x75b1('0x5'))(_0x75b1('0x6'));var config=require(_0x75b1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x75b1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53df73,_0xc6d7d7,_0x358fd6){return new BPromise(function(_0x3f4919,_0xc23455){return client[_0x75b1('0x9')](_0x53df73,_0x358fd6)['then'](function(_0x1e2695){logger[_0x75b1('0xa')](_0x75b1('0xb'),_0xc6d7d7,_0x75b1('0xc'));logger[_0x75b1('0xd')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0xc6d7d7,'request\x20sent',JSON['stringify'](_0x1e2695));if(_0x1e2695[_0x75b1('0xe')]){if(_0x1e2695[_0x75b1('0xe')][_0x75b1('0xf')]===0x1f4){logger[_0x75b1('0xe')]('SugarcrmField,\x20%s,\x20%s',_0xc6d7d7,_0x1e2695[_0x75b1('0xe')]['message']);return _0xc23455(_0x1e2695[_0x75b1('0xe')]['message']);}logger[_0x75b1('0xe')](_0x75b1('0xb'),_0xc6d7d7,_0x1e2695[_0x75b1('0xe')]['message']);return _0x3f4919(_0x1e2695[_0x75b1('0xe')][_0x75b1('0x10')]);}else{logger[_0x75b1('0xa')](_0x75b1('0xb'),_0xc6d7d7,_0x75b1('0xc'));_0x3f4919(_0x1e2695[_0x75b1('0x11')][_0x75b1('0x10')]);}})[_0x75b1('0x12')](function(_0x1a46c4){logger[_0x75b1('0xe')]('SugarcrmField,\x20%s,\x20%s',_0xc6d7d7,_0x1a46c4);_0xc23455(_0x1a46c4);});});}