74fa5ce43f505613d12c605b3ed92da945872146
[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 _0x07a8=['catch','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xd2f4ac,_0x5aa8e5){var _0x9757b2=function(_0x442ced){while(--_0x442ced){_0xd2f4ac['push'](_0xd2f4ac['shift']());}};_0x9757b2(++_0x5aa8e5);}(_0x07a8,0xd0));var _0x807a=function(_0x2811a0,_0x205266){_0x2811a0=_0x2811a0-0x0;var _0x596793=_0x07a8[_0x2811a0];return _0x596793;};'use strict';var _=require('lodash');var util=require(_0x807a('0x0'));var moment=require('moment');var BPromise=require(_0x807a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x807a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x807a('0x3'));var logger=require(_0x807a('0x4'))(_0x807a('0x5'));var config=require(_0x807a('0x6'));var jayson=require(_0x807a('0x7'));var client=jayson[_0x807a('0x8')][_0x807a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2cb2c8,_0x300976,_0xd048e3){return new BPromise(function(_0x19cad3,_0xdcbb99){return client[_0x807a('0xa')](_0x2cb2c8,_0xd048e3)[_0x807a('0xb')](function(_0x1c58d8){logger[_0x807a('0xc')](_0x807a('0xd'),_0x300976,_0x807a('0xe'));logger[_0x807a('0xf')](_0x807a('0x10'),_0x300976,_0x807a('0xe'),JSON[_0x807a('0x11')](_0x1c58d8));if(_0x1c58d8[_0x807a('0x12')]){if(_0x1c58d8[_0x807a('0x12')][_0x807a('0x13')]===0x1f4){logger['error'](_0x807a('0xd'),_0x300976,_0x1c58d8[_0x807a('0x12')][_0x807a('0x14')]);return _0xdcbb99(_0x1c58d8[_0x807a('0x12')]['message']);}logger[_0x807a('0x12')](_0x807a('0xd'),_0x300976,_0x1c58d8[_0x807a('0x12')]['message']);return _0x19cad3(_0x1c58d8[_0x807a('0x12')]['message']);}else{logger[_0x807a('0xc')](_0x807a('0xd'),_0x300976,_0x807a('0xe'));_0x19cad3(_0x1c58d8[_0x807a('0x15')][_0x807a('0x14')]);}})[_0x807a('0x16')](function(_0x10164a){logger[_0x807a('0x12')](_0x807a('0xd'),_0x300976,_0x10164a);_0xdcbb99(_0x10164a);});});}