Built motion from commit f74363e9.|2.6.34
[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 _0x4b88=['code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','info','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x4b88,0x8f));var _0x84b8=function(_0x19fe7e,_0x5c1483){_0x19fe7e=_0x19fe7e-0x0;var _0x3b1770=_0x4b88[_0x19fe7e];return _0x3b1770;};'use strict';var _=require(_0x84b8('0x0'));var util=require('util');var moment=require(_0x84b8('0x1'));var BPromise=require(_0x84b8('0x2'));var rs=require(_0x84b8('0x3'));var fs=require('fs');var Redis=require(_0x84b8('0x4'));var db=require(_0x84b8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x84b8('0x6'))('rpc');var config=require(_0x84b8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x84b8('0x8')][_0x84b8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x373fb8,_0x2b2320,_0x244b05){return new BPromise(function(_0x4c186a,_0x1e8c19){return client[_0x84b8('0xa')](_0x373fb8,_0x244b05)['then'](function(_0x3ae38f){logger[_0x84b8('0xb')](_0x84b8('0xc'),_0x2b2320,'request\x20sent');logger[_0x84b8('0xd')](_0x84b8('0xe'),_0x2b2320,_0x84b8('0xf'),JSON['stringify'](_0x3ae38f));if(_0x3ae38f['error']){if(_0x3ae38f[_0x84b8('0x10')][_0x84b8('0x11')]===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x2b2320,_0x3ae38f[_0x84b8('0x10')][_0x84b8('0x12')]);return _0x1e8c19(_0x3ae38f[_0x84b8('0x10')][_0x84b8('0x12')]);}logger[_0x84b8('0x10')](_0x84b8('0xc'),_0x2b2320,_0x3ae38f['error'][_0x84b8('0x12')]);return _0x4c186a(_0x3ae38f[_0x84b8('0x10')][_0x84b8('0x12')]);}else{logger[_0x84b8('0xb')](_0x84b8('0xc'),_0x2b2320,_0x84b8('0xf'));_0x4c186a(_0x3ae38f['result'][_0x84b8('0x12')]);}})[_0x84b8('0x13')](function(_0x3723f5){logger[_0x84b8('0x10')](_0x84b8('0xc'),_0x2b2320,_0x3723f5);_0x1e8c19(_0x3723f5);});});}