c00f793a88ba67da159745c6a332c71ce5acbf5c
[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 _0x427e=['request','then','info','SugarcrmField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x427e,0xc4));var _0xe427=function(_0x323ced,_0x481bf0){_0x323ced=_0x323ced-0x0;var _0x545bec=_0x427e[_0x323ced];return _0x545bec;};'use strict';var _=require(_0xe427('0x0'));var util=require(_0xe427('0x1'));var moment=require(_0xe427('0x2'));var BPromise=require(_0xe427('0x3'));var rs=require(_0xe427('0x4'));var fs=require('fs');var Redis=require(_0xe427('0x5'));var db=require(_0xe427('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe427('0x7'))(_0xe427('0x8'));var config=require('../../config/environment');var jayson=require(_0xe427('0x9'));var client=jayson['client'][_0xe427('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xcd2178,_0x3f315,_0x5b9785){return new BPromise(function(_0x5ca89f,_0x5d2695){return client[_0xe427('0xb')](_0xcd2178,_0x5b9785)[_0xe427('0xc')](function(_0x17c1e8){logger[_0xe427('0xd')](_0xe427('0xe'),_0x3f315,'request\x20sent');logger[_0xe427('0xf')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x3f315,_0xe427('0x10'),JSON[_0xe427('0x11')](_0x17c1e8));if(_0x17c1e8[_0xe427('0x12')]){if(_0x17c1e8['error'][_0xe427('0x13')]===0x1f4){logger[_0xe427('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x3f315,_0x17c1e8[_0xe427('0x12')][_0xe427('0x14')]);return _0x5d2695(_0x17c1e8[_0xe427('0x12')]['message']);}logger[_0xe427('0x12')](_0xe427('0xe'),_0x3f315,_0x17c1e8[_0xe427('0x12')][_0xe427('0x14')]);return _0x5ca89f(_0x17c1e8[_0xe427('0x12')]['message']);}else{logger[_0xe427('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x3f315,_0xe427('0x10'));_0x5ca89f(_0x17c1e8[_0xe427('0x15')][_0xe427('0x14')]);}})[_0xe427('0x16')](function(_0x19d679){logger[_0xe427('0x12')](_0xe427('0xe'),_0x3f315,_0x19d679);_0x5d2695(_0x19d679);});});}