75ba0120f686108840a2468aceec86a32ed00371
[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 _0x7204=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x58b6a8,_0x307021){var _0xc566dc=function(_0x59bd76){while(--_0x59bd76){_0x58b6a8['push'](_0x58b6a8['shift']());}};_0xc566dc(++_0x307021);}(_0x7204,0x110));var _0x4720=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x7204[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x4720('0x0'));var util=require(_0x4720('0x1'));var moment=require(_0x4720('0x2'));var BPromise=require(_0x4720('0x3'));var rs=require(_0x4720('0x4'));var fs=require('fs');var Redis=require(_0x4720('0x5'));var db=require(_0x4720('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4720('0x7'))(_0x4720('0x8'));var config=require(_0x4720('0x9'));var jayson=require(_0x4720('0xa'));var client=jayson['client'][_0x4720('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16f042,_0xdba91d,_0x3fe95c){return new BPromise(function(_0x548c68,_0x229237){return client[_0x4720('0xc')](_0x16f042,_0x3fe95c)['then'](function(_0x2e5ca2){logger[_0x4720('0xd')](_0x4720('0xe'),_0xdba91d,_0x4720('0xf'));logger[_0x4720('0x10')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0xdba91d,'request\x20sent',JSON[_0x4720('0x11')](_0x2e5ca2));if(_0x2e5ca2['error']){if(_0x2e5ca2[_0x4720('0x12')][_0x4720('0x13')]===0x1f4){logger['error'](_0x4720('0xe'),_0xdba91d,_0x2e5ca2[_0x4720('0x12')][_0x4720('0x14')]);return _0x229237(_0x2e5ca2[_0x4720('0x12')][_0x4720('0x14')]);}logger[_0x4720('0x12')](_0x4720('0xe'),_0xdba91d,_0x2e5ca2[_0x4720('0x12')][_0x4720('0x14')]);return _0x548c68(_0x2e5ca2[_0x4720('0x12')][_0x4720('0x14')]);}else{logger[_0x4720('0xd')](_0x4720('0xe'),_0xdba91d,_0x4720('0xf'));_0x548c68(_0x2e5ca2[_0x4720('0x15')][_0x4720('0x14')]);}})[_0x4720('0x16')](function(_0x22297f){logger['error']('SugarcrmField,\x20%s,\x20%s',_0xdba91d,_0x22297f);_0x229237(_0x22297f);});});}