5bd22e30b1622563b32099e653df752e5bb37852
[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 _0xae8a=['request\x20sent','debug','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info'];(function(_0x5a0f1b,_0x316fc6){var _0x20666f=function(_0x180300){while(--_0x180300){_0x5a0f1b['push'](_0x5a0f1b['shift']());}};_0x20666f(++_0x316fc6);}(_0xae8a,0xb1));var _0xaae8=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xae8a[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xaae8('0x0'));var util=require(_0xaae8('0x1'));var moment=require(_0xaae8('0x2'));var BPromise=require(_0xaae8('0x3'));var rs=require(_0xaae8('0x4'));var fs=require('fs');var Redis=require(_0xaae8('0x5'));var db=require(_0xaae8('0x6'))['db'];var utils=require(_0xaae8('0x7'));var logger=require('../../config/logger')(_0xaae8('0x8'));var config=require(_0xaae8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaae8('0xa')][_0xaae8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52b63e,_0x109fed,_0x2471a9){return new BPromise(function(_0xbd070d,_0x40cf75){return client[_0xaae8('0xc')](_0x52b63e,_0x2471a9)[_0xaae8('0xd')](function(_0x4f8f91){logger[_0xaae8('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x109fed,_0xaae8('0xf'));logger[_0xaae8('0x10')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x109fed,_0xaae8('0xf'),JSON[_0xaae8('0x11')](_0x4f8f91));if(_0x4f8f91[_0xaae8('0x12')]){if(_0x4f8f91[_0xaae8('0x12')][_0xaae8('0x13')]===0x1f4){logger[_0xaae8('0x12')](_0xaae8('0x14'),_0x109fed,_0x4f8f91[_0xaae8('0x12')][_0xaae8('0x15')]);return _0x40cf75(_0x4f8f91[_0xaae8('0x12')][_0xaae8('0x15')]);}logger[_0xaae8('0x12')](_0xaae8('0x14'),_0x109fed,_0x4f8f91[_0xaae8('0x12')]['message']);return _0xbd070d(_0x4f8f91[_0xaae8('0x12')]['message']);}else{logger['info'](_0xaae8('0x14'),_0x109fed,_0xaae8('0xf'));_0xbd070d(_0x4f8f91[_0xaae8('0x16')][_0xaae8('0x15')]);}})[_0xaae8('0x17')](function(_0x13c7fd){logger['error'](_0xaae8('0x14'),_0x109fed,_0x13c7fd);_0x40cf75(_0x13c7fd);});});}