Built motion from commit a134ab58.|2.6.29
[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 _0xd47e=['rpc','jayson/promise','http','request','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd47e,0x67));var _0xed47=function(_0x3ff4bc,_0x1aebe2){_0x3ff4bc=_0x3ff4bc-0x0;var _0x3297fa=_0xd47e[_0x3ff4bc];return _0x3297fa;};'use strict';var _=require(_0xed47('0x0'));var util=require(_0xed47('0x1'));var moment=require(_0xed47('0x2'));var BPromise=require('bluebird');var rs=require(_0xed47('0x3'));var fs=require('fs');var Redis=require(_0xed47('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xed47('0x5'));var logger=require(_0xed47('0x6'))(_0xed47('0x7'));var config=require('../../config/environment');var jayson=require(_0xed47('0x8'));var client=jayson['client'][_0xed47('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x490f65,_0x507f12,_0x58aeb9){return new BPromise(function(_0x10df06,_0x18f67a){return client[_0xed47('0xa')](_0x490f65,_0x58aeb9)['then'](function(_0x11b7c2){logger['info'](_0xed47('0xb'),_0x507f12,_0xed47('0xc'));logger[_0xed47('0xd')](_0xed47('0xe'),_0x507f12,_0xed47('0xc'),JSON[_0xed47('0xf')](_0x11b7c2));if(_0x11b7c2['error']){if(_0x11b7c2['error'][_0xed47('0x10')]===0x1f4){logger[_0xed47('0x11')](_0xed47('0xb'),_0x507f12,_0x11b7c2[_0xed47('0x11')][_0xed47('0x12')]);return _0x18f67a(_0x11b7c2['error']['message']);}logger[_0xed47('0x11')](_0xed47('0xb'),_0x507f12,_0x11b7c2[_0xed47('0x11')]['message']);return _0x10df06(_0x11b7c2[_0xed47('0x11')][_0xed47('0x12')]);}else{logger[_0xed47('0x13')](_0xed47('0xb'),_0x507f12,'request\x20sent');_0x10df06(_0x11b7c2[_0xed47('0x14')][_0xed47('0x12')]);}})[_0xed47('0x15')](function(_0x431d67){logger[_0xed47('0x11')](_0xed47('0xb'),_0x507f12,_0x431d67);_0x18f67a(_0x431d67);});});}