43c6538c94dbbeda69daadc7469dfbc875da766c
[motion2.git] / server / api / intSugarcrmConfiguration / intSugarcrmConfiguration.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 _0xa50d=['catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa50d,0xfe));var _0xda50=function(_0x13fdb1,_0x1c6fba){_0x13fdb1=_0x13fdb1-0x0;var _0x55f710=_0xa50d[_0x13fdb1];return _0x55f710;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xda50('0x0'));var BPromise=require(_0xda50('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda50('0x2'));var db=require(_0xda50('0x3'))['db'];var utils=require(_0xda50('0x4'));var logger=require(_0xda50('0x5'))(_0xda50('0x6'));var config=require(_0xda50('0x7'));var jayson=require(_0xda50('0x8'));var client=jayson[_0xda50('0x9')][_0xda50('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a10a0,_0x12b307,_0xaef15e){return new BPromise(function(_0x1ed78b,_0x53abf0){return client[_0xda50('0xb')](_0x2a10a0,_0xaef15e)[_0xda50('0xc')](function(_0x291a11){logger[_0xda50('0xd')](_0xda50('0xe'),_0x12b307,_0xda50('0xf'));logger['debug'](_0xda50('0x10'),_0x12b307,_0xda50('0xf'),JSON[_0xda50('0x11')](_0x291a11));if(_0x291a11['error']){if(_0x291a11[_0xda50('0x12')][_0xda50('0x13')]===0x1f4){logger[_0xda50('0x12')](_0xda50('0xe'),_0x12b307,_0x291a11[_0xda50('0x12')]['message']);return _0x53abf0(_0x291a11[_0xda50('0x12')][_0xda50('0x14')]);}logger[_0xda50('0x12')](_0xda50('0xe'),_0x12b307,_0x291a11[_0xda50('0x12')][_0xda50('0x14')]);return _0x1ed78b(_0x291a11[_0xda50('0x12')][_0xda50('0x14')]);}else{logger[_0xda50('0xd')](_0xda50('0xe'),_0x12b307,_0xda50('0xf'));_0x1ed78b(_0x291a11[_0xda50('0x15')]['message']);}})[_0xda50('0x16')](function(_0x43ba08){logger[_0xda50('0x12')](_0xda50('0xe'),_0x12b307,_0x43ba08);_0x53abf0(_0x43ba08);});});}