a69a33645dbe03cac9f96fda797d8554bd8c2041
[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 _0xf9ef=['catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x960205,_0x54f13e){var _0x12135d=function(_0x5518c7){while(--_0x5518c7){_0x960205['push'](_0x960205['shift']());}};_0x12135d(++_0x54f13e);}(_0xf9ef,0x157));var _0xff9e=function(_0x574c32,_0x4a083b){_0x574c32=_0x574c32-0x0;var _0x1ad6c2=_0xf9ef[_0x574c32];return _0x1ad6c2;};'use strict';var _=require(_0xff9e('0x0'));var util=require(_0xff9e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff9e('0x2'));var db=require(_0xff9e('0x3'))['db'];var utils=require(_0xff9e('0x4'));var logger=require(_0xff9e('0x5'))(_0xff9e('0x6'));var config=require(_0xff9e('0x7'));var jayson=require(_0xff9e('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5cb61f,_0x2859f9,_0x224d9e){return new BPromise(function(_0x59fbc3,_0x54f7c2){return client[_0xff9e('0x9')](_0x5cb61f,_0x224d9e)[_0xff9e('0xa')](function(_0x4c54a8){logger[_0xff9e('0xb')](_0xff9e('0xc'),_0x2859f9,_0xff9e('0xd'));logger[_0xff9e('0xe')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x2859f9,'request\x20sent',JSON['stringify'](_0x4c54a8));if(_0x4c54a8['error']){if(_0x4c54a8[_0xff9e('0xf')][_0xff9e('0x10')]===0x1f4){logger[_0xff9e('0xf')](_0xff9e('0xc'),_0x2859f9,_0x4c54a8[_0xff9e('0xf')]['message']);return _0x54f7c2(_0x4c54a8['error']['message']);}logger[_0xff9e('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x2859f9,_0x4c54a8[_0xff9e('0xf')][_0xff9e('0x11')]);return _0x59fbc3(_0x4c54a8[_0xff9e('0xf')][_0xff9e('0x11')]);}else{logger[_0xff9e('0xb')](_0xff9e('0xc'),_0x2859f9,_0xff9e('0xd'));_0x59fbc3(_0x4c54a8['result'][_0xff9e('0x11')]);}})[_0xff9e('0x12')](function(_0x4162a8){logger[_0xff9e('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x2859f9,_0x4162a8);_0x54f7c2(_0x4162a8);});});}