f8d8b9a12e1ed18bf0c152aa71a835c385a8f64b
[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 _0x2865=['FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info'];(function(_0xd2b809,_0x5efcb5){var _0x388d37=function(_0x3397c6){while(--_0x3397c6){_0xd2b809['push'](_0xd2b809['shift']());}};_0x388d37(++_0x5efcb5);}(_0x2865,0x1d5));var _0x5286=function(_0x2cd8ec,_0x5f2f9c){_0x2cd8ec=_0x2cd8ec-0x0;var _0x370f68=_0x2865[_0x2cd8ec];return _0x370f68;};'use strict';var _=require(_0x5286('0x0'));var util=require(_0x5286('0x1'));var moment=require(_0x5286('0x2'));var BPromise=require(_0x5286('0x3'));var rs=require(_0x5286('0x4'));var fs=require('fs');var Redis=require(_0x5286('0x5'));var db=require(_0x5286('0x6'))['db'];var utils=require(_0x5286('0x7'));var logger=require(_0x5286('0x8'))(_0x5286('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5286('0xa')][_0x5286('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x597812,_0x368628,_0x1cb9ee){return new BPromise(function(_0x2ff48b,_0xdd662a){return client[_0x5286('0xc')](_0x597812,_0x1cb9ee)['then'](function(_0x569670){logger[_0x5286('0xd')](_0x5286('0xe'),_0x368628,_0x5286('0xf'));logger[_0x5286('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x368628,_0x5286('0xf'),JSON[_0x5286('0x11')](_0x569670));if(_0x569670[_0x5286('0x12')]){if(_0x569670[_0x5286('0x12')][_0x5286('0x13')]===0x1f4){logger[_0x5286('0x12')](_0x5286('0xe'),_0x368628,_0x569670['error']['message']);return _0xdd662a(_0x569670['error'][_0x5286('0x14')]);}logger['error'](_0x5286('0xe'),_0x368628,_0x569670[_0x5286('0x12')][_0x5286('0x14')]);return _0x2ff48b(_0x569670[_0x5286('0x12')][_0x5286('0x14')]);}else{logger[_0x5286('0xd')](_0x5286('0xe'),_0x368628,_0x5286('0xf'));_0x2ff48b(_0x569670[_0x5286('0x15')][_0x5286('0x14')]);}})[_0x5286('0x16')](function(_0xac3624){logger[_0x5286('0x12')](_0x5286('0xe'),_0x368628,_0xac3624);_0xdd662a(_0xac3624);});});}