2c0630355634dd250826e3ae7f5237fbcb434861
[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 _0xa7c7=['lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','client','http','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa7c7,0x17c));var _0x7a7c=function(_0x4e392b,_0x7a71db){_0x4e392b=_0x4e392b-0x0;var _0x449ee1=_0xa7c7[_0x4e392b];return _0x449ee1;};'use strict';var _=require(_0x7a7c('0x0'));var util=require(_0x7a7c('0x1'));var moment=require('moment');var BPromise=require(_0x7a7c('0x2'));var rs=require(_0x7a7c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7a7c('0x4'));var logger=require(_0x7a7c('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7a7c('0x6')][_0x7a7c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2ce124,_0x53dfaa,_0x7034c2){return new BPromise(function(_0x416f17,_0x2b5fbe){return client['request'](_0x2ce124,_0x7034c2)['then'](function(_0x14fc56){logger[_0x7a7c('0x8')](_0x7a7c('0x9'),_0x53dfaa,_0x7a7c('0xa'));logger[_0x7a7c('0xb')](_0x7a7c('0xc'),_0x53dfaa,'request\x20sent',JSON[_0x7a7c('0xd')](_0x14fc56));if(_0x14fc56[_0x7a7c('0xe')]){if(_0x14fc56['error'][_0x7a7c('0xf')]===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x53dfaa,_0x14fc56['error']['message']);return _0x2b5fbe(_0x14fc56[_0x7a7c('0xe')][_0x7a7c('0x10')]);}logger[_0x7a7c('0xe')](_0x7a7c('0x9'),_0x53dfaa,_0x14fc56[_0x7a7c('0xe')]['message']);return _0x416f17(_0x14fc56[_0x7a7c('0xe')][_0x7a7c('0x10')]);}else{logger[_0x7a7c('0x8')](_0x7a7c('0x9'),_0x53dfaa,_0x7a7c('0xa'));_0x416f17(_0x14fc56[_0x7a7c('0x11')]['message']);}})[_0x7a7c('0x12')](function(_0x5158fc){logger[_0x7a7c('0xe')](_0x7a7c('0x9'),_0x53dfaa,_0x5158fc);_0x2b5fbe(_0x5158fc);});});}