Built motion from commit b5a10faa.|2.6.13
[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 _0x19f5=['then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request'];(function(_0x52b0fc,_0x44be2c){var _0x415fb1=function(_0x33402c){while(--_0x33402c){_0x52b0fc['push'](_0x52b0fc['shift']());}};_0x415fb1(++_0x44be2c);}(_0x19f5,0x14a));var _0x519f=function(_0x58366f,_0x3f03b9){_0x58366f=_0x58366f-0x0;var _0x49a2b3=_0x19f5[_0x58366f];return _0x49a2b3;};'use strict';var _=require(_0x519f('0x0'));var util=require(_0x519f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x519f('0x2'));var fs=require('fs');var Redis=require(_0x519f('0x3'));var db=require(_0x519f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x519f('0x5'))('rpc');var config=require(_0x519f('0x6'));var jayson=require(_0x519f('0x7'));var client=jayson[_0x519f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d6b4a,_0x5bed9e,_0x4d4d80){return new BPromise(function(_0x34d680,_0x4ab5b6){return client[_0x519f('0x9')](_0x4d6b4a,_0x4d4d80)[_0x519f('0xa')](function(_0x1834c7){logger[_0x519f('0xb')](_0x519f('0xc'),_0x5bed9e,_0x519f('0xd'));logger['debug'](_0x519f('0xe'),_0x5bed9e,_0x519f('0xd'),JSON[_0x519f('0xf')](_0x1834c7));if(_0x1834c7[_0x519f('0x10')]){if(_0x1834c7[_0x519f('0x10')]['code']===0x1f4){logger[_0x519f('0x10')](_0x519f('0xc'),_0x5bed9e,_0x1834c7[_0x519f('0x10')][_0x519f('0x11')]);return _0x4ab5b6(_0x1834c7[_0x519f('0x10')]['message']);}logger['error'](_0x519f('0xc'),_0x5bed9e,_0x1834c7['error'][_0x519f('0x11')]);return _0x34d680(_0x1834c7[_0x519f('0x10')][_0x519f('0x11')]);}else{logger[_0x519f('0xb')](_0x519f('0xc'),_0x5bed9e,_0x519f('0xd'));_0x34d680(_0x1834c7[_0x519f('0x12')][_0x519f('0x11')]);}})[_0x519f('0x13')](function(_0x1c8ad0){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x5bed9e,_0x1c8ad0);_0x4ab5b6(_0x1c8ad0);});});}