Built motion from commit 9d1906d1.|2.5.40
[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 _0x2c25=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird'];(function(_0x564821,_0x4d037e){var _0x2b604d=function(_0x26fabf){while(--_0x26fabf){_0x564821['push'](_0x564821['shift']());}};_0x2b604d(++_0x4d037e);}(_0x2c25,0xc2));var _0x52c2=function(_0x1a62bb,_0x157e87){_0x1a62bb=_0x1a62bb-0x0;var _0x4ade6f=_0x2c25[_0x1a62bb];return _0x4ade6f;};'use strict';var _=require(_0x52c2('0x0'));var util=require(_0x52c2('0x1'));var moment=require(_0x52c2('0x2'));var BPromise=require(_0x52c2('0x3'));var rs=require(_0x52c2('0x4'));var fs=require('fs');var Redis=require(_0x52c2('0x5'));var db=require(_0x52c2('0x6'))['db'];var utils=require(_0x52c2('0x7'));var logger=require(_0x52c2('0x8'))(_0x52c2('0x9'));var config=require(_0x52c2('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d800c,_0x3f44a7,_0x3ef258){return new BPromise(function(_0x55e52a,_0x204fd8){return client[_0x52c2('0xb')](_0x1d800c,_0x3ef258)[_0x52c2('0xc')](function(_0x48f58a){logger['info'](_0x52c2('0xd'),_0x3f44a7,_0x52c2('0xe'));logger['debug'](_0x52c2('0xf'),_0x3f44a7,_0x52c2('0xe'),JSON[_0x52c2('0x10')](_0x48f58a));if(_0x48f58a[_0x52c2('0x11')]){if(_0x48f58a[_0x52c2('0x11')][_0x52c2('0x12')]===0x1f4){logger[_0x52c2('0x11')](_0x52c2('0xd'),_0x3f44a7,_0x48f58a[_0x52c2('0x11')][_0x52c2('0x13')]);return _0x204fd8(_0x48f58a[_0x52c2('0x11')][_0x52c2('0x13')]);}logger[_0x52c2('0x11')](_0x52c2('0xd'),_0x3f44a7,_0x48f58a[_0x52c2('0x11')][_0x52c2('0x13')]);return _0x55e52a(_0x48f58a['error'][_0x52c2('0x13')]);}else{logger[_0x52c2('0x14')](_0x52c2('0xd'),_0x3f44a7,_0x52c2('0xe'));_0x55e52a(_0x48f58a[_0x52c2('0x15')][_0x52c2('0x13')]);}})['catch'](function(_0xa92b68){logger[_0x52c2('0x11')](_0x52c2('0xd'),_0x3f44a7,_0xa92b68);_0x204fd8(_0xa92b68);});});}