6d58e53ca064e2577c498a810f1da64a57266036
[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 _0xec66=['request','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','ZohoConfiguration,\x20%s,\x20%s','info','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xec66,0x19a));var _0x6ec6=function(_0x39f34f,_0x298f45){_0x39f34f=_0x39f34f-0x0;var _0x59fee1=_0xec66[_0x39f34f];return _0x59fee1;};'use strict';var _=require(_0x6ec6('0x0'));var util=require('util');var moment=require(_0x6ec6('0x1'));var BPromise=require(_0x6ec6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ec6('0x3'));var db=require(_0x6ec6('0x4'))['db'];var utils=require(_0x6ec6('0x5'));var logger=require(_0x6ec6('0x6'))(_0x6ec6('0x7'));var config=require(_0x6ec6('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6ec6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3bcf3b,_0x55f383,_0x2a62c6){return new BPromise(function(_0x4c3782,_0x12c615){return client[_0x6ec6('0xa')](_0x3bcf3b,_0x2a62c6)['then'](function(_0x2295eb){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x55f383,_0x6ec6('0xb'));logger[_0x6ec6('0xc')](_0x6ec6('0xd'),_0x55f383,'request\x20sent',JSON[_0x6ec6('0xe')](_0x2295eb));if(_0x2295eb[_0x6ec6('0xf')]){if(_0x2295eb[_0x6ec6('0xf')]['code']===0x1f4){logger[_0x6ec6('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x55f383,_0x2295eb[_0x6ec6('0xf')][_0x6ec6('0x10')]);return _0x12c615(_0x2295eb[_0x6ec6('0xf')][_0x6ec6('0x10')]);}logger[_0x6ec6('0xf')](_0x6ec6('0x11'),_0x55f383,_0x2295eb[_0x6ec6('0xf')][_0x6ec6('0x10')]);return _0x4c3782(_0x2295eb[_0x6ec6('0xf')][_0x6ec6('0x10')]);}else{logger[_0x6ec6('0x12')](_0x6ec6('0x11'),_0x55f383,'request\x20sent');_0x4c3782(_0x2295eb['result'][_0x6ec6('0x10')]);}})[_0x6ec6('0x13')](function(_0x4ad90e){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x55f383,_0x4ad90e);_0x12c615(_0x4ad90e);});});}