Built motion from commit efa66e19.|2.6.22
[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 _0x7a07=['rpc','../../config/environment','jayson/promise','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x308374,_0x550e85){var _0x1f71e0=function(_0x18377d){while(--_0x18377d){_0x308374['push'](_0x308374['shift']());}};_0x1f71e0(++_0x550e85);}(_0x7a07,0x19f));var _0x77a0=function(_0x44fbe2,_0x143626){_0x44fbe2=_0x44fbe2-0x0;var _0x1b74be=_0x7a07[_0x44fbe2];return _0x1b74be;};'use strict';var _=require(_0x77a0('0x0'));var util=require(_0x77a0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x77a0('0x2'))['db'];var utils=require(_0x77a0('0x3'));var logger=require(_0x77a0('0x4'))(_0x77a0('0x5'));var config=require(_0x77a0('0x6'));var jayson=require(_0x77a0('0x7'));var client=jayson[_0x77a0('0x8')][_0x77a0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x207a42,_0x21b07a,_0x3e464a){return new BPromise(function(_0x25f92b,_0x3f5028){return client[_0x77a0('0xa')](_0x207a42,_0x3e464a)[_0x77a0('0xb')](function(_0x231655){logger['info'](_0x77a0('0xc'),_0x21b07a,_0x77a0('0xd'));logger[_0x77a0('0xe')](_0x77a0('0xf'),_0x21b07a,_0x77a0('0xd'),JSON[_0x77a0('0x10')](_0x231655));if(_0x231655[_0x77a0('0x11')]){if(_0x231655['error'][_0x77a0('0x12')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x21b07a,_0x231655[_0x77a0('0x11')]['message']);return _0x3f5028(_0x231655[_0x77a0('0x11')][_0x77a0('0x13')]);}logger[_0x77a0('0x11')](_0x77a0('0xc'),_0x21b07a,_0x231655[_0x77a0('0x11')]['message']);return _0x25f92b(_0x231655[_0x77a0('0x11')]['message']);}else{logger['info'](_0x77a0('0xc'),_0x21b07a,'request\x20sent');_0x25f92b(_0x231655['result']['message']);}})[_0x77a0('0x14')](function(_0x32ce7e){logger[_0x77a0('0x11')](_0x77a0('0xc'),_0x21b07a,_0x32ce7e);_0x3f5028(_0x32ce7e);});});}