6a9fee5041fea10a84281cbd3fa67fd846287097
[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 _0xd3c0=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis'];(function(_0x21c7d8,_0x32acc5){var _0x277d59=function(_0x1f5ca9){while(--_0x1f5ca9){_0x21c7d8['push'](_0x21c7d8['shift']());}};_0x277d59(++_0x32acc5);}(_0xd3c0,0xb0));var _0x0d3c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd3c0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0d3c('0x0'));var util=require('util');var moment=require(_0x0d3c('0x1'));var BPromise=require('bluebird');var rs=require(_0x0d3c('0x2'));var fs=require('fs');var Redis=require(_0x0d3c('0x3'));var db=require(_0x0d3c('0x4'))['db'];var utils=require(_0x0d3c('0x5'));var logger=require('../../config/logger')(_0x0d3c('0x6'));var config=require(_0x0d3c('0x7'));var jayson=require(_0x0d3c('0x8'));var client=jayson[_0x0d3c('0x9')][_0x0d3c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x124dbf,_0x237d80,_0x3e938e){return new BPromise(function(_0x5e84db,_0x1dda9d){return client['request'](_0x124dbf,_0x3e938e)[_0x0d3c('0xb')](function(_0x2ed6c5){logger[_0x0d3c('0xc')](_0x0d3c('0xd'),_0x237d80,'request\x20sent');logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x237d80,_0x0d3c('0xe'),JSON[_0x0d3c('0xf')](_0x2ed6c5));if(_0x2ed6c5[_0x0d3c('0x10')]){if(_0x2ed6c5[_0x0d3c('0x10')][_0x0d3c('0x11')]===0x1f4){logger[_0x0d3c('0x10')](_0x0d3c('0xd'),_0x237d80,_0x2ed6c5[_0x0d3c('0x10')][_0x0d3c('0x12')]);return _0x1dda9d(_0x2ed6c5['error'][_0x0d3c('0x12')]);}logger[_0x0d3c('0x10')](_0x0d3c('0xd'),_0x237d80,_0x2ed6c5[_0x0d3c('0x10')][_0x0d3c('0x12')]);return _0x5e84db(_0x2ed6c5[_0x0d3c('0x10')][_0x0d3c('0x12')]);}else{logger[_0x0d3c('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x237d80,'request\x20sent');_0x5e84db(_0x2ed6c5['result'][_0x0d3c('0x12')]);}})[_0x0d3c('0x13')](function(_0x43891e){logger[_0x0d3c('0x10')](_0x0d3c('0xd'),_0x237d80,_0x43891e);_0x1dda9d(_0x43891e);});});}