Built motion from commit da617fac.|2.6.6
[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 _0x5eac=['http','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','message','result','util','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5eac,0x15f));var _0xc5ea=function(_0x365802,_0x47d9e8){_0x365802=_0x365802-0x0;var _0x6db0bc=_0x5eac[_0x365802];return _0x6db0bc;};'use strict';var _=require('lodash');var util=require(_0xc5ea('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5ea('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc5ea('0x2'))(_0xc5ea('0x3'));var config=require(_0xc5ea('0x4'));var jayson=require(_0xc5ea('0x5'));var client=jayson['client'][_0xc5ea('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1d4cde,_0x53baf1,_0x4372c5){return new BPromise(function(_0x294941,_0x161145){return client[_0xc5ea('0x7')](_0x1d4cde,_0x4372c5)['then'](function(_0x1936d5){logger[_0xc5ea('0x8')](_0xc5ea('0x9'),_0x53baf1,_0xc5ea('0xa'));logger[_0xc5ea('0xb')](_0xc5ea('0xc'),_0x53baf1,'request\x20sent',JSON['stringify'](_0x1936d5));if(_0x1936d5[_0xc5ea('0xd')]){if(_0x1936d5[_0xc5ea('0xd')][_0xc5ea('0xe')]===0x1f4){logger[_0xc5ea('0xd')](_0xc5ea('0x9'),_0x53baf1,_0x1936d5['error'][_0xc5ea('0xf')]);return _0x161145(_0x1936d5[_0xc5ea('0xd')][_0xc5ea('0xf')]);}logger[_0xc5ea('0xd')](_0xc5ea('0x9'),_0x53baf1,_0x1936d5[_0xc5ea('0xd')][_0xc5ea('0xf')]);return _0x294941(_0x1936d5[_0xc5ea('0xd')][_0xc5ea('0xf')]);}else{logger[_0xc5ea('0x8')](_0xc5ea('0x9'),_0x53baf1,'request\x20sent');_0x294941(_0x1936d5[_0xc5ea('0x10')][_0xc5ea('0xf')]);}})['catch'](function(_0x2ec766){logger[_0xc5ea('0xd')](_0xc5ea('0x9'),_0x53baf1,_0x2ec766);_0x161145(_0x2ec766);});});}