803431f4ea719f8bc98f7570b2e3f13f20d9195a
[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 _0x85e1=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x3df29d,_0x38f3d1){var _0x2b4a4f=function(_0x4d92e7){while(--_0x4d92e7){_0x3df29d['push'](_0x3df29d['shift']());}};_0x2b4a4f(++_0x38f3d1);}(_0x85e1,0x1c6));var _0x185e=function(_0x41ca6c,_0x53b190){_0x41ca6c=_0x41ca6c-0x0;var _0x125422=_0x85e1[_0x41ca6c];return _0x125422;};'use strict';var _=require(_0x185e('0x0'));var util=require(_0x185e('0x1'));var moment=require(_0x185e('0x2'));var BPromise=require(_0x185e('0x3'));var rs=require(_0x185e('0x4'));var fs=require('fs');var Redis=require(_0x185e('0x5'));var db=require(_0x185e('0x6'))['db'];var utils=require(_0x185e('0x7'));var logger=require('../../config/logger')(_0x185e('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1894da,_0x222646,_0x41aae5){return new BPromise(function(_0x54133b,_0x190326){return client[_0x185e('0x9')](_0x1894da,_0x41aae5)['then'](function(_0x3959c2){logger[_0x185e('0xa')](_0x185e('0xb'),_0x222646,_0x185e('0xc'));logger['debug'](_0x185e('0xd'),_0x222646,_0x185e('0xc'),JSON[_0x185e('0xe')](_0x3959c2));if(_0x3959c2[_0x185e('0xf')]){if(_0x3959c2['error'][_0x185e('0x10')]===0x1f4){logger['error'](_0x185e('0xb'),_0x222646,_0x3959c2[_0x185e('0xf')][_0x185e('0x11')]);return _0x190326(_0x3959c2[_0x185e('0xf')]['message']);}logger[_0x185e('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x222646,_0x3959c2[_0x185e('0xf')][_0x185e('0x11')]);return _0x54133b(_0x3959c2['error'][_0x185e('0x11')]);}else{logger[_0x185e('0xa')](_0x185e('0xb'),_0x222646,_0x185e('0xc'));_0x54133b(_0x3959c2['result']['message']);}})[_0x185e('0x12')](function(_0x45708e){logger[_0x185e('0xf')](_0x185e('0xb'),_0x222646,_0x45708e);_0x190326(_0x45708e);});});}