f7c2050fca59511d699f5e1af6564eb3c06e11fe
[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 _0xea4d=['request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x496c5b,_0x10945c){var _0x3efa66=function(_0x348530){while(--_0x348530){_0x496c5b['push'](_0x496c5b['shift']());}};_0x3efa66(++_0x10945c);}(_0xea4d,0x195));var _0xdea4=function(_0x4e4610,_0x5f399e){_0x4e4610=_0x4e4610-0x0;var _0x1db21c=_0xea4d[_0x4e4610];return _0x1db21c;};'use strict';var _=require(_0xdea4('0x0'));var util=require('util');var moment=require(_0xdea4('0x1'));var BPromise=require(_0xdea4('0x2'));var rs=require(_0xdea4('0x3'));var fs=require('fs');var Redis=require(_0xdea4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdea4('0x5'));var logger=require(_0xdea4('0x6'))('rpc');var config=require(_0xdea4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdea4('0x8')][_0xdea4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f457a,_0x1b866f,_0x2b8afd){return new BPromise(function(_0x2339c9,_0x2ce04b){return client[_0xdea4('0xa')](_0x2f457a,_0x2b8afd)[_0xdea4('0xb')](function(_0x464f03){logger['info'](_0xdea4('0xc'),_0x1b866f,_0xdea4('0xd'));logger[_0xdea4('0xe')](_0xdea4('0xf'),_0x1b866f,'request\x20sent',JSON[_0xdea4('0x10')](_0x464f03));if(_0x464f03[_0xdea4('0x11')]){if(_0x464f03[_0xdea4('0x11')][_0xdea4('0x12')]===0x1f4){logger['error'](_0xdea4('0xc'),_0x1b866f,_0x464f03[_0xdea4('0x11')][_0xdea4('0x13')]);return _0x2ce04b(_0x464f03[_0xdea4('0x11')]['message']);}logger[_0xdea4('0x11')](_0xdea4('0xc'),_0x1b866f,_0x464f03['error'][_0xdea4('0x13')]);return _0x2339c9(_0x464f03[_0xdea4('0x11')][_0xdea4('0x13')]);}else{logger[_0xdea4('0x14')](_0xdea4('0xc'),_0x1b866f,_0xdea4('0xd'));_0x2339c9(_0x464f03['result'][_0xdea4('0x13')]);}})[_0xdea4('0x15')](function(_0x4f255b){logger['error'](_0xdea4('0xc'),_0x1b866f,_0x4f255b);_0x2ce04b(_0x4f255b);});});}