Built motion from commit f541bb3b.|2.6.14
[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 _0xffb9=['rpc','../../config/environment','client','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x503050,_0x2ec99a){var _0x2099c8=function(_0x4517f0){while(--_0x4517f0){_0x503050['push'](_0x503050['shift']());}};_0x2099c8(++_0x2ec99a);}(_0xffb9,0x10a));var _0x9ffb=function(_0x2ea53c,_0x1a4fc4){_0x2ea53c=_0x2ea53c-0x0;var _0x104c71=_0xffb9[_0x2ea53c];return _0x104c71;};'use strict';var _=require('lodash');var util=require(_0x9ffb('0x0'));var moment=require(_0x9ffb('0x1'));var BPromise=require(_0x9ffb('0x2'));var rs=require(_0x9ffb('0x3'));var fs=require('fs');var Redis=require(_0x9ffb('0x4'));var db=require(_0x9ffb('0x5'))['db'];var utils=require(_0x9ffb('0x6'));var logger=require('../../config/logger')(_0x9ffb('0x7'));var config=require(_0x9ffb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9ffb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27c0a6,_0x2d8e23,_0x440442){return new BPromise(function(_0x3c4b3d,_0x2effad){return client[_0x9ffb('0xa')](_0x27c0a6,_0x440442)[_0x9ffb('0xb')](function(_0x44fe9e){logger[_0x9ffb('0xc')](_0x9ffb('0xd'),_0x2d8e23,_0x9ffb('0xe'));logger[_0x9ffb('0xf')](_0x9ffb('0x10'),_0x2d8e23,'request\x20sent',JSON['stringify'](_0x44fe9e));if(_0x44fe9e[_0x9ffb('0x11')]){if(_0x44fe9e['error'][_0x9ffb('0x12')]===0x1f4){logger[_0x9ffb('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2d8e23,_0x44fe9e[_0x9ffb('0x11')]['message']);return _0x2effad(_0x44fe9e[_0x9ffb('0x11')][_0x9ffb('0x13')]);}logger[_0x9ffb('0x11')](_0x9ffb('0xd'),_0x2d8e23,_0x44fe9e[_0x9ffb('0x11')][_0x9ffb('0x13')]);return _0x3c4b3d(_0x44fe9e[_0x9ffb('0x11')]['message']);}else{logger[_0x9ffb('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2d8e23,_0x9ffb('0xe'));_0x3c4b3d(_0x44fe9e['result'][_0x9ffb('0x13')]);}})[_0x9ffb('0x14')](function(_0x428fb4){logger['error'](_0x9ffb('0xd'),_0x2d8e23,_0x428fb4);_0x2effad(_0x428fb4);});});}