d39f0399e12c7ec0f8256af9bb1d188e068df3cd
[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 _0xa596=['FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','request\x20sent','debug'];(function(_0x4832c6,_0x594aa2){var _0x13c0f1=function(_0x1a51d4){while(--_0x1a51d4){_0x4832c6['push'](_0x4832c6['shift']());}};_0x13c0f1(++_0x594aa2);}(_0xa596,0x7b));var _0x6a59=function(_0x2cbc74,_0x30f7de){_0x2cbc74=_0x2cbc74-0x0;var _0x2ba7d8=_0xa596[_0x2cbc74];return _0x2ba7d8;};'use strict';var _=require(_0x6a59('0x0'));var util=require(_0x6a59('0x1'));var moment=require('moment');var BPromise=require(_0x6a59('0x2'));var rs=require(_0x6a59('0x3'));var fs=require('fs');var Redis=require(_0x6a59('0x4'));var db=require(_0x6a59('0x5'))['db'];var utils=require(_0x6a59('0x6'));var logger=require(_0x6a59('0x7'))(_0x6a59('0x8'));var config=require(_0x6a59('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6a59('0xa')][_0x6a59('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21e97f,_0x375a77,_0xb50532){return new BPromise(function(_0x3c392f,_0x5aa5fe){return client[_0x6a59('0xc')](_0x21e97f,_0xb50532)['then'](function(_0x21008c){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x375a77,_0x6a59('0xd'));logger[_0x6a59('0xe')](_0x6a59('0xf'),_0x375a77,'request\x20sent',JSON[_0x6a59('0x10')](_0x21008c));if(_0x21008c[_0x6a59('0x11')]){if(_0x21008c['error'][_0x6a59('0x12')]===0x1f4){logger['error'](_0x6a59('0x13'),_0x375a77,_0x21008c[_0x6a59('0x11')][_0x6a59('0x14')]);return _0x5aa5fe(_0x21008c[_0x6a59('0x11')][_0x6a59('0x14')]);}logger[_0x6a59('0x11')](_0x6a59('0x13'),_0x375a77,_0x21008c[_0x6a59('0x11')][_0x6a59('0x14')]);return _0x3c392f(_0x21008c[_0x6a59('0x11')][_0x6a59('0x14')]);}else{logger['info'](_0x6a59('0x13'),_0x375a77,_0x6a59('0xd'));_0x3c392f(_0x21008c[_0x6a59('0x15')][_0x6a59('0x14')]);}})[_0x6a59('0x16')](function(_0x39ad1e){logger['error'](_0x6a59('0x13'),_0x375a77,_0x39ad1e);_0x5aa5fe(_0x39ad1e);});});}