9ae3875791f7c4947842abbb7c113c9e65a84996
[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 _0xa5c3=['message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','ZohoConfiguration,\x20%s,\x20%s','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x36d943,_0xb53c07){var _0x1d2444=function(_0x59abe1){while(--_0x59abe1){_0x36d943['push'](_0x36d943['shift']());}};_0x1d2444(++_0xb53c07);}(_0xa5c3,0x17e));var _0x3a5c=function(_0x981fb0,_0x4e4227){_0x981fb0=_0x981fb0-0x0;var _0xc07e75=_0xa5c3[_0x981fb0];return _0xc07e75;};'use strict';var _=require(_0x3a5c('0x0'));var util=require('util');var moment=require(_0x3a5c('0x1'));var BPromise=require(_0x3a5c('0x2'));var rs=require(_0x3a5c('0x3'));var fs=require('fs');var Redis=require(_0x3a5c('0x4'));var db=require(_0x3a5c('0x5'))['db'];var utils=require(_0x3a5c('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x3a5c('0x7'));var jayson=require(_0x3a5c('0x8'));var client=jayson[_0x3a5c('0x9')][_0x3a5c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ce6eb,_0x3a7cbe,_0x44163d){return new BPromise(function(_0x24eda1,_0x1ab0d6){return client['request'](_0x5ce6eb,_0x44163d)[_0x3a5c('0xb')](function(_0x76bbe2){logger[_0x3a5c('0xc')](_0x3a5c('0xd'),_0x3a7cbe,'request\x20sent');logger['debug'](_0x3a5c('0xe'),_0x3a7cbe,_0x3a5c('0xf'),JSON[_0x3a5c('0x10')](_0x76bbe2));if(_0x76bbe2[_0x3a5c('0x11')]){if(_0x76bbe2['error']['code']===0x1f4){logger[_0x3a5c('0x11')](_0x3a5c('0xd'),_0x3a7cbe,_0x76bbe2[_0x3a5c('0x11')][_0x3a5c('0x12')]);return _0x1ab0d6(_0x76bbe2[_0x3a5c('0x11')][_0x3a5c('0x12')]);}logger[_0x3a5c('0x11')](_0x3a5c('0xd'),_0x3a7cbe,_0x76bbe2[_0x3a5c('0x11')][_0x3a5c('0x12')]);return _0x24eda1(_0x76bbe2[_0x3a5c('0x11')][_0x3a5c('0x12')]);}else{logger[_0x3a5c('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x3a7cbe,'request\x20sent');_0x24eda1(_0x76bbe2[_0x3a5c('0x13')][_0x3a5c('0x12')]);}})['catch'](function(_0x4dcd4c){logger[_0x3a5c('0x11')](_0x3a5c('0xd'),_0x3a7cbe,_0x4dcd4c);_0x1ab0d6(_0x4dcd4c);});});}