e6ef8e4ee94fb5a4f81990ef16ceedd6202b3b6f
[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 _0xc5ec=['request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s'];(function(_0xfb0281,_0x3ff38b){var _0x408dd3=function(_0x5d8017){while(--_0x5d8017){_0xfb0281['push'](_0xfb0281['shift']());}};_0x408dd3(++_0x3ff38b);}(_0xc5ec,0x17e));var _0xcc5e=function(_0x28f493,_0x94fd4b){_0x28f493=_0x28f493-0x0;var _0x4b0409=_0xc5ec[_0x28f493];return _0x4b0409;};'use strict';var _=require(_0xcc5e('0x0'));var util=require(_0xcc5e('0x1'));var moment=require(_0xcc5e('0x2'));var BPromise=require(_0xcc5e('0x3'));var rs=require(_0xcc5e('0x4'));var fs=require('fs');var Redis=require(_0xcc5e('0x5'));var db=require(_0xcc5e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xcc5e('0x7'));var client=jayson[_0xcc5e('0x8')][_0xcc5e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ff4a0,_0x24fdad,_0x23d6b5){return new BPromise(function(_0x5f50aa,_0x1c4c90){return client[_0xcc5e('0xa')](_0x1ff4a0,_0x23d6b5)[_0xcc5e('0xb')](function(_0x1d5f77){logger[_0xcc5e('0xc')](_0xcc5e('0xd'),_0x24fdad,_0xcc5e('0xe'));logger[_0xcc5e('0xf')](_0xcc5e('0x10'),_0x24fdad,_0xcc5e('0xe'),JSON[_0xcc5e('0x11')](_0x1d5f77));if(_0x1d5f77[_0xcc5e('0x12')]){if(_0x1d5f77[_0xcc5e('0x12')]['code']===0x1f4){logger[_0xcc5e('0x12')](_0xcc5e('0xd'),_0x24fdad,_0x1d5f77[_0xcc5e('0x12')][_0xcc5e('0x13')]);return _0x1c4c90(_0x1d5f77[_0xcc5e('0x12')][_0xcc5e('0x13')]);}logger['error'](_0xcc5e('0xd'),_0x24fdad,_0x1d5f77[_0xcc5e('0x12')][_0xcc5e('0x13')]);return _0x5f50aa(_0x1d5f77[_0xcc5e('0x12')][_0xcc5e('0x13')]);}else{logger['info'](_0xcc5e('0xd'),_0x24fdad,'request\x20sent');_0x5f50aa(_0x1d5f77[_0xcc5e('0x14')][_0xcc5e('0x13')]);}})[_0xcc5e('0x15')](function(_0x157c20){logger[_0xcc5e('0x12')](_0xcc5e('0xd'),_0x24fdad,_0x157c20);_0x1c4c90(_0x157c20);});});}