2f37aca1b62a87eb7e1cb52b338fec96d3fd333c
[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 _0xd52e=['stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s'];(function(_0x56c537,_0x462fba){var _0x4a4a1e=function(_0x12e2c1){while(--_0x12e2c1){_0x56c537['push'](_0x56c537['shift']());}};_0x4a4a1e(++_0x462fba);}(_0xd52e,0x195));var _0xed52=function(_0x3667e1,_0x44ac8d){_0x3667e1=_0x3667e1-0x0;var _0x22bfe3=_0xd52e[_0x3667e1];return _0x22bfe3;};'use strict';var _=require(_0xed52('0x0'));var util=require(_0xed52('0x1'));var moment=require(_0xed52('0x2'));var BPromise=require(_0xed52('0x3'));var rs=require(_0xed52('0x4'));var fs=require('fs');var Redis=require(_0xed52('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xed52('0x6'));var logger=require('../../config/logger')(_0xed52('0x7'));var config=require(_0xed52('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x50cc77,_0x25f1fc,_0xbab94){return new BPromise(function(_0x563b1f,_0x30cd8e){return client[_0xed52('0x9')](_0x50cc77,_0xbab94)['then'](function(_0xadf161){logger[_0xed52('0xa')](_0xed52('0xb'),_0x25f1fc,_0xed52('0xc'));logger[_0xed52('0xd')](_0xed52('0xe'),_0x25f1fc,_0xed52('0xc'),JSON[_0xed52('0xf')](_0xadf161));if(_0xadf161[_0xed52('0x10')]){if(_0xadf161['error']['code']===0x1f4){logger[_0xed52('0x10')](_0xed52('0xb'),_0x25f1fc,_0xadf161[_0xed52('0x10')][_0xed52('0x11')]);return _0x30cd8e(_0xadf161['error']['message']);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x25f1fc,_0xadf161[_0xed52('0x10')]['message']);return _0x563b1f(_0xadf161[_0xed52('0x10')][_0xed52('0x11')]);}else{logger[_0xed52('0xa')]('SugarcrmField,\x20%s,\x20%s',_0x25f1fc,_0xed52('0xc'));_0x563b1f(_0xadf161[_0xed52('0x12')]['message']);}})[_0xed52('0x13')](function(_0x58bac0){logger[_0xed52('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x25f1fc,_0x58bac0);_0x30cd8e(_0x58bac0);});});}