e2310e2111fbe05134739db311603191638c0f1c
[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 _0x3011=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3011,0x14c));var _0x1301=function(_0x248d46,_0xba08ec){_0x248d46=_0x248d46-0x0;var _0x354942=_0x3011[_0x248d46];return _0x354942;};'use strict';var _=require(_0x1301('0x0'));var util=require(_0x1301('0x1'));var moment=require(_0x1301('0x2'));var BPromise=require(_0x1301('0x3'));var rs=require(_0x1301('0x4'));var fs=require('fs');var Redis=require(_0x1301('0x5'));var db=require(_0x1301('0x6'))['db'];var utils=require(_0x1301('0x7'));var logger=require(_0x1301('0x8'))(_0x1301('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1301('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x547fe2,_0x4d1f4d,_0x4cfe69){return new BPromise(function(_0x49780b,_0x1884be){return client[_0x1301('0xb')](_0x547fe2,_0x4cfe69)[_0x1301('0xc')](function(_0x417a9e){logger[_0x1301('0xd')](_0x1301('0xe'),_0x4d1f4d,_0x1301('0xf'));logger[_0x1301('0x10')](_0x1301('0x11'),_0x4d1f4d,_0x1301('0xf'),JSON[_0x1301('0x12')](_0x417a9e));if(_0x417a9e[_0x1301('0x13')]){if(_0x417a9e['error'][_0x1301('0x14')]===0x1f4){logger['error'](_0x1301('0xe'),_0x4d1f4d,_0x417a9e[_0x1301('0x13')][_0x1301('0x15')]);return _0x1884be(_0x417a9e[_0x1301('0x13')][_0x1301('0x15')]);}logger[_0x1301('0x13')](_0x1301('0xe'),_0x4d1f4d,_0x417a9e[_0x1301('0x13')][_0x1301('0x15')]);return _0x49780b(_0x417a9e[_0x1301('0x13')][_0x1301('0x15')]);}else{logger[_0x1301('0xd')](_0x1301('0xe'),_0x4d1f4d,_0x1301('0xf'));_0x49780b(_0x417a9e[_0x1301('0x16')]['message']);}})[_0x1301('0x17')](function(_0x3b57a4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x4d1f4d,_0x3b57a4);_0x1884be(_0x3b57a4);});});}