f7c4f713993cc5683ab1416cde45eca33719d7f1
[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 _0x9652=['stringify','error','code','message','result','catch','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2aea64,_0x32a66f){var _0x375247=function(_0x178a6a){while(--_0x178a6a){_0x2aea64['push'](_0x2aea64['shift']());}};_0x375247(++_0x32a66f);}(_0x9652,0x9e));var _0x2965=function(_0x3a2e49,_0x21ebea){_0x3a2e49=_0x3a2e49-0x0;var _0x257140=_0x9652[_0x3a2e49];return _0x257140;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2965('0x0'));var db=require('../../mysqldb')['db'];var utils=require(_0x2965('0x1'));var logger=require(_0x2965('0x2'))(_0x2965('0x3'));var config=require(_0x2965('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x2965('0x5')][_0x2965('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1a711f,_0x23cd31,_0x3dc0c4){return new BPromise(function(_0x13a130,_0x4ffffa){return client[_0x2965('0x7')](_0x1a711f,_0x3dc0c4)[_0x2965('0x8')](function(_0x308d6f){logger[_0x2965('0x9')](_0x2965('0xa'),_0x23cd31,_0x2965('0xb'));logger[_0x2965('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x23cd31,_0x2965('0xb'),JSON[_0x2965('0xd')](_0x308d6f));if(_0x308d6f[_0x2965('0xe')]){if(_0x308d6f[_0x2965('0xe')][_0x2965('0xf')]===0x1f4){logger[_0x2965('0xe')](_0x2965('0xa'),_0x23cd31,_0x308d6f[_0x2965('0xe')][_0x2965('0x10')]);return _0x4ffffa(_0x308d6f['error'][_0x2965('0x10')]);}logger['error'](_0x2965('0xa'),_0x23cd31,_0x308d6f[_0x2965('0xe')][_0x2965('0x10')]);return _0x13a130(_0x308d6f['error'][_0x2965('0x10')]);}else{logger[_0x2965('0x9')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x23cd31,_0x2965('0xb'));_0x13a130(_0x308d6f[_0x2965('0x11')][_0x2965('0x10')]);}})[_0x2965('0x12')](function(_0x61540b){logger[_0x2965('0xe')](_0x2965('0xa'),_0x23cd31,_0x61540b);_0x4ffffa(_0x61540b);});});}