534ebecc7ec7cd552830e4fd727a249def9b9c13
[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 _0x032b=['error','code','message','result','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x032b,0x101));var _0xb032=function(_0x438e07,_0x590a1b){_0x438e07=_0x438e07-0x0;var _0x28f1a4=_0x032b[_0x438e07];return _0x28f1a4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb032('0x0'));var BPromise=require('bluebird');var rs=require(_0xb032('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb032('0x2'))['db'];var utils=require(_0xb032('0x3'));var logger=require(_0xb032('0x4'))(_0xb032('0x5'));var config=require(_0xb032('0x6'));var jayson=require(_0xb032('0x7'));var client=jayson['client'][_0xb032('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x38c1cc,_0x9b1bb5,_0x5d9f95){return new BPromise(function(_0x4d3e1f,_0x1201b3){return client[_0xb032('0x9')](_0x38c1cc,_0x5d9f95)[_0xb032('0xa')](function(_0x4e84d6){logger[_0xb032('0xb')](_0xb032('0xc'),_0x9b1bb5,_0xb032('0xd'));logger['debug'](_0xb032('0xe'),_0x9b1bb5,_0xb032('0xd'),JSON[_0xb032('0xf')](_0x4e84d6));if(_0x4e84d6[_0xb032('0x10')]){if(_0x4e84d6[_0xb032('0x10')][_0xb032('0x11')]===0x1f4){logger[_0xb032('0x10')](_0xb032('0xc'),_0x9b1bb5,_0x4e84d6[_0xb032('0x10')]['message']);return _0x1201b3(_0x4e84d6['error'][_0xb032('0x12')]);}logger[_0xb032('0x10')](_0xb032('0xc'),_0x9b1bb5,_0x4e84d6[_0xb032('0x10')][_0xb032('0x12')]);return _0x4d3e1f(_0x4e84d6[_0xb032('0x10')][_0xb032('0x12')]);}else{logger['info'](_0xb032('0xc'),_0x9b1bb5,_0xb032('0xd'));_0x4d3e1f(_0x4e84d6[_0xb032('0x13')][_0xb032('0x12')]);}})[_0xb032('0x14')](function(_0x1222b5){logger[_0xb032('0x10')](_0xb032('0xc'),_0x9b1bb5,_0x1222b5);_0x1201b3(_0x1222b5);});});}