18a2f424e19cb9d172ec8646a99f1996a6778daf
[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 _0x0a83=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','moment','bluebird','randomstring'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0a83,0x16d));var _0x30a8=function(_0xb833b1,_0x1c3d3f){_0xb833b1=_0xb833b1-0x0;var _0x1ab87a=_0x0a83[_0xb833b1];return _0x1ab87a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x30a8('0x0'));var BPromise=require(_0x30a8('0x1'));var rs=require(_0x30a8('0x2'));var fs=require('fs');var Redis=require(_0x30a8('0x3'));var db=require(_0x30a8('0x4'))['db'];var utils=require(_0x30a8('0x5'));var logger=require(_0x30a8('0x6'))(_0x30a8('0x7'));var config=require(_0x30a8('0x8'));var jayson=require(_0x30a8('0x9'));var client=jayson[_0x30a8('0xa')][_0x30a8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46886f,_0x198198,_0x48ccf7){return new BPromise(function(_0x5d75bb,_0x7b2c4f){return client[_0x30a8('0xc')](_0x46886f,_0x48ccf7)['then'](function(_0x4ecd8a){logger[_0x30a8('0xd')](_0x30a8('0xe'),_0x198198,'request\x20sent');logger[_0x30a8('0xf')](_0x30a8('0x10'),_0x198198,_0x30a8('0x11'),JSON[_0x30a8('0x12')](_0x4ecd8a));if(_0x4ecd8a[_0x30a8('0x13')]){if(_0x4ecd8a[_0x30a8('0x13')]['code']===0x1f4){logger[_0x30a8('0x13')](_0x30a8('0xe'),_0x198198,_0x4ecd8a[_0x30a8('0x13')][_0x30a8('0x14')]);return _0x7b2c4f(_0x4ecd8a[_0x30a8('0x13')]['message']);}logger[_0x30a8('0x13')](_0x30a8('0xe'),_0x198198,_0x4ecd8a['error'][_0x30a8('0x14')]);return _0x5d75bb(_0x4ecd8a[_0x30a8('0x13')][_0x30a8('0x14')]);}else{logger[_0x30a8('0xd')](_0x30a8('0xe'),_0x198198,'request\x20sent');_0x5d75bb(_0x4ecd8a[_0x30a8('0x15')][_0x30a8('0x14')]);}})[_0x30a8('0x16')](function(_0x3a3652){logger[_0x30a8('0x13')](_0x30a8('0xe'),_0x198198,_0x3a3652);_0x7b2c4f(_0x3a3652);});});}