c1de07025441074115f16fc3fe6d773645c06a25
[motion2.git] / server / api / intFreshsalesConfiguration / intFreshsalesConfiguration.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 _0x3a64=['jayson/promise','http','request','then','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','FreshsalesConfiguration,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x544463,_0x214963){var _0x1add2a=function(_0x5e1006){while(--_0x5e1006){_0x544463['push'](_0x544463['shift']());}};_0x1add2a(++_0x214963);}(_0x3a64,0x92));var _0x43a6=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0x3a64[_0x4ed520];return _0x4415a6;};'use strict';var _=require(_0x43a6('0x0'));var util=require(_0x43a6('0x1'));var moment=require(_0x43a6('0x2'));var BPromise=require(_0x43a6('0x3'));var rs=require(_0x43a6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x43a6('0x5'))['db'];var utils=require(_0x43a6('0x6'));var logger=require(_0x43a6('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x43a6('0x8'));var client=jayson['client'][_0x43a6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39ec04,_0x585a87,_0x50afb3){return new BPromise(function(_0x4427eb,_0x9d8bf0){return client[_0x43a6('0xa')](_0x39ec04,_0x50afb3)[_0x43a6('0xb')](function(_0x5c88d3){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x585a87,_0x43a6('0xc'));logger['debug'](_0x43a6('0xd'),_0x585a87,_0x43a6('0xc'),JSON[_0x43a6('0xe')](_0x5c88d3));if(_0x5c88d3['error']){if(_0x5c88d3['error'][_0x43a6('0xf')]===0x1f4){logger['error'](_0x43a6('0x10'),_0x585a87,_0x5c88d3[_0x43a6('0x11')]['message']);return _0x9d8bf0(_0x5c88d3[_0x43a6('0x11')][_0x43a6('0x12')]);}logger[_0x43a6('0x11')](_0x43a6('0x10'),_0x585a87,_0x5c88d3['error']['message']);return _0x4427eb(_0x5c88d3[_0x43a6('0x11')][_0x43a6('0x12')]);}else{logger[_0x43a6('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x585a87,_0x43a6('0xc'));_0x4427eb(_0x5c88d3[_0x43a6('0x14')]['message']);}})[_0x43a6('0x15')](function(_0xc38e3a){logger['error'](_0x43a6('0x10'),_0x585a87,_0xc38e3a);_0x9d8bf0(_0xc38e3a);});});}