8615d01e9472462c3c634d73d05fa30c225f3231
[motion2.git] / server / api / intZohoConfiguration / intZohoConfiguration.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 _0xfbb9=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x16351e,_0x1983fa){var _0x4010f3=function(_0x40dac5){while(--_0x40dac5){_0x16351e['push'](_0x16351e['shift']());}};_0x4010f3(++_0x1983fa);}(_0xfbb9,0x1b8));var _0x9fbb=function(_0x5c5ab2,_0x320152){_0x5c5ab2=_0x5c5ab2-0x0;var _0x12c85=_0xfbb9[_0x5c5ab2];return _0x12c85;};'use strict';var _=require(_0x9fbb('0x0'));var util=require(_0x9fbb('0x1'));var moment=require('moment');var BPromise=require(_0x9fbb('0x2'));var rs=require(_0x9fbb('0x3'));var fs=require('fs');var Redis=require(_0x9fbb('0x4'));var db=require(_0x9fbb('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9fbb('0x6'));var config=require(_0x9fbb('0x7'));var jayson=require(_0x9fbb('0x8'));var client=jayson[_0x9fbb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x277a63,_0x298c95,_0x2228f9){return new BPromise(function(_0x226c8d,_0x1e4090){return client['request'](_0x277a63,_0x2228f9)[_0x9fbb('0xa')](function(_0x32f5a9){logger[_0x9fbb('0xb')](_0x9fbb('0xc'),_0x298c95,_0x9fbb('0xd'));logger[_0x9fbb('0xe')](_0x9fbb('0xf'),_0x298c95,'request\x20sent',JSON['stringify'](_0x32f5a9));if(_0x32f5a9['error']){if(_0x32f5a9[_0x9fbb('0x10')][_0x9fbb('0x11')]===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x298c95,_0x32f5a9[_0x9fbb('0x10')][_0x9fbb('0x12')]);return _0x1e4090(_0x32f5a9[_0x9fbb('0x10')][_0x9fbb('0x12')]);}logger[_0x9fbb('0x10')](_0x9fbb('0xc'),_0x298c95,_0x32f5a9[_0x9fbb('0x10')][_0x9fbb('0x12')]);return _0x226c8d(_0x32f5a9[_0x9fbb('0x10')][_0x9fbb('0x12')]);}else{logger[_0x9fbb('0xb')](_0x9fbb('0xc'),_0x298c95,_0x9fbb('0xd'));_0x226c8d(_0x32f5a9[_0x9fbb('0x13')]['message']);}})['catch'](function(_0x2b12ad){logger[_0x9fbb('0x10')](_0x9fbb('0xc'),_0x298c95,_0x2b12ad);_0x1e4090(_0x2b12ad);});});}