Built motion from commit 994c64e1.|2.6.1
[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 _0x1750=['request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','SugarcrmField,\x20%s,\x20%s'];(function(_0x1a1f84,_0x2fdb14){var _0x561040=function(_0xd9f736){while(--_0xd9f736){_0x1a1f84['push'](_0x1a1f84['shift']());}};_0x561040(++_0x2fdb14);}(_0x1750,0x1c1));var _0x0175=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x1750[_0x29b609];return _0x54c952;};'use strict';var _=require(_0x0175('0x0'));var util=require(_0x0175('0x1'));var moment=require('moment');var BPromise=require(_0x0175('0x2'));var rs=require(_0x0175('0x3'));var fs=require('fs');var Redis=require(_0x0175('0x4'));var db=require(_0x0175('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0175('0x6'))('rpc');var config=require(_0x0175('0x7'));var jayson=require(_0x0175('0x8'));var client=jayson['client'][_0x0175('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19b355,_0x5eb241,_0x124880){return new BPromise(function(_0xeaf8fd,_0x5bea3b){return client[_0x0175('0xa')](_0x19b355,_0x124880)[_0x0175('0xb')](function(_0x2805d8){logger['info'](_0x0175('0xc'),_0x5eb241,_0x0175('0xd'));logger[_0x0175('0xe')](_0x0175('0xf'),_0x5eb241,_0x0175('0xd'),JSON[_0x0175('0x10')](_0x2805d8));if(_0x2805d8[_0x0175('0x11')]){if(_0x2805d8['error'][_0x0175('0x12')]===0x1f4){logger[_0x0175('0x11')](_0x0175('0xc'),_0x5eb241,_0x2805d8[_0x0175('0x11')][_0x0175('0x13')]);return _0x5bea3b(_0x2805d8[_0x0175('0x11')]['message']);}logger[_0x0175('0x11')](_0x0175('0xc'),_0x5eb241,_0x2805d8[_0x0175('0x11')][_0x0175('0x13')]);return _0xeaf8fd(_0x2805d8[_0x0175('0x11')][_0x0175('0x13')]);}else{logger['info']('SugarcrmField,\x20%s,\x20%s',_0x5eb241,_0x0175('0xd'));_0xeaf8fd(_0x2805d8[_0x0175('0x14')][_0x0175('0x13')]);}})[_0x0175('0x15')](function(_0x220108){logger[_0x0175('0x11')](_0x0175('0xc'),_0x5eb241,_0x220108);_0x5bea3b(_0x220108);});});}