8bec5c461c4517dba5c6a6c9355e80be5eab337f
[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 _0x4f21=['debug','error','code','message','info','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','ZohoConfiguration,\x20%s,\x20%s'];(function(_0x4b5150,_0x39f55d){var _0x5917c3=function(_0x2c90c2){while(--_0x2c90c2){_0x4b5150['push'](_0x4b5150['shift']());}};_0x5917c3(++_0x39f55d);}(_0x4f21,0x71));var _0x14f2=function(_0x2806f6,_0x294105){_0x2806f6=_0x2806f6-0x0;var _0x32ebb1=_0x4f21[_0x2806f6];return _0x32ebb1;};'use strict';var _=require(_0x14f2('0x0'));var util=require('util');var moment=require(_0x14f2('0x1'));var BPromise=require('bluebird');var rs=require(_0x14f2('0x2'));var fs=require('fs');var Redis=require(_0x14f2('0x3'));var db=require(_0x14f2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x14f2('0x5'))(_0x14f2('0x6'));var config=require('../../config/environment');var jayson=require(_0x14f2('0x7'));var client=jayson[_0x14f2('0x8')][_0x14f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa0f9d7,_0xa15cc1,_0x300e93){return new BPromise(function(_0x1ad76a,_0x298c77){return client[_0x14f2('0xa')](_0xa0f9d7,_0x300e93)[_0x14f2('0xb')](function(_0x126220){logger['info'](_0x14f2('0xc'),_0xa15cc1,'request\x20sent');logger[_0x14f2('0xd')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0xa15cc1,'request\x20sent',JSON['stringify'](_0x126220));if(_0x126220[_0x14f2('0xe')]){if(_0x126220['error'][_0x14f2('0xf')]===0x1f4){logger[_0x14f2('0xe')](_0x14f2('0xc'),_0xa15cc1,_0x126220[_0x14f2('0xe')][_0x14f2('0x10')]);return _0x298c77(_0x126220[_0x14f2('0xe')][_0x14f2('0x10')]);}logger['error'](_0x14f2('0xc'),_0xa15cc1,_0x126220[_0x14f2('0xe')][_0x14f2('0x10')]);return _0x1ad76a(_0x126220[_0x14f2('0xe')]['message']);}else{logger[_0x14f2('0x11')](_0x14f2('0xc'),_0xa15cc1,_0x14f2('0x12'));_0x1ad76a(_0x126220[_0x14f2('0x13')][_0x14f2('0x10')]);}})[_0x14f2('0x14')](function(_0x323f85){logger[_0x14f2('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0xa15cc1,_0x323f85);_0x298c77(_0x323f85);});});}