Built motion from commit b0a9a629.|2.6.33
[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 _0x064e=['SugarcrmConfiguration,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error'];(function(_0x3999ac,_0x56f9d4){var _0x4a73e7=function(_0x3a081c){while(--_0x3a081c){_0x3999ac['push'](_0x3999ac['shift']());}};_0x4a73e7(++_0x56f9d4);}(_0x064e,0x12f));var _0xe064=function(_0x225f2f,_0x243686){_0x225f2f=_0x225f2f-0x0;var _0x27b19a=_0x064e[_0x225f2f];return _0x27b19a;};'use strict';var _=require('lodash');var util=require(_0xe064('0x0'));var moment=require(_0xe064('0x1'));var BPromise=require(_0xe064('0x2'));var rs=require(_0xe064('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe064('0x4'));var logger=require(_0xe064('0x5'))(_0xe064('0x6'));var config=require('../../config/environment');var jayson=require(_0xe064('0x7'));var client=jayson[_0xe064('0x8')][_0xe064('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5611b1,_0x1492dd,_0x1ffed3){return new BPromise(function(_0x2edb22,_0x36208a){return client[_0xe064('0xa')](_0x5611b1,_0x1ffed3)[_0xe064('0xb')](function(_0x143202){logger[_0xe064('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1492dd,_0xe064('0xd'));logger[_0xe064('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x1492dd,'request\x20sent',JSON[_0xe064('0xf')](_0x143202));if(_0x143202['error']){if(_0x143202[_0xe064('0x10')]['code']===0x1f4){logger[_0xe064('0x10')](_0xe064('0x11'),_0x1492dd,_0x143202[_0xe064('0x10')]['message']);return _0x36208a(_0x143202[_0xe064('0x10')][_0xe064('0x12')]);}logger[_0xe064('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1492dd,_0x143202[_0xe064('0x10')][_0xe064('0x12')]);return _0x2edb22(_0x143202[_0xe064('0x10')][_0xe064('0x12')]);}else{logger[_0xe064('0xc')](_0xe064('0x11'),_0x1492dd,'request\x20sent');_0x2edb22(_0x143202['result']['message']);}})[_0xe064('0x13')](function(_0x4c28ab){logger[_0xe064('0x10')](_0xe064('0x11'),_0x1492dd,_0x4c28ab);_0x36208a(_0x4c28ab);});});}