175f6036c7a48c3c208b7f2afd28ac2fec8d843b
[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 _0xe89c=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x44f36e,_0x15d2cf){var _0x36d838=function(_0xe704c){while(--_0xe704c){_0x44f36e['push'](_0x44f36e['shift']());}};_0x36d838(++_0x15d2cf);}(_0xe89c,0x16f));var _0xce89=function(_0x22e012,_0x48a505){_0x22e012=_0x22e012-0x0;var _0x5a6bf2=_0xe89c[_0x22e012];return _0x5a6bf2;};'use strict';var _=require(_0xce89('0x0'));var util=require(_0xce89('0x1'));var moment=require('moment');var BPromise=require(_0xce89('0x2'));var rs=require(_0xce89('0x3'));var fs=require('fs');var Redis=require(_0xce89('0x4'));var db=require(_0xce89('0x5'))['db'];var utils=require(_0xce89('0x6'));var logger=require(_0xce89('0x7'))(_0xce89('0x8'));var config=require('../../config/environment');var jayson=require(_0xce89('0x9'));var client=jayson[_0xce89('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13b82a,_0x1ed7e0,_0x205f7f){return new BPromise(function(_0x4a69ff,_0x51327e){return client['request'](_0x13b82a,_0x205f7f)[_0xce89('0xb')](function(_0x4b4630){logger[_0xce89('0xc')](_0xce89('0xd'),_0x1ed7e0,'request\x20sent');logger[_0xce89('0xe')](_0xce89('0xf'),_0x1ed7e0,_0xce89('0x10'),JSON[_0xce89('0x11')](_0x4b4630));if(_0x4b4630[_0xce89('0x12')]){if(_0x4b4630['error'][_0xce89('0x13')]===0x1f4){logger[_0xce89('0x12')](_0xce89('0xd'),_0x1ed7e0,_0x4b4630[_0xce89('0x12')]['message']);return _0x51327e(_0x4b4630[_0xce89('0x12')][_0xce89('0x14')]);}logger[_0xce89('0x12')](_0xce89('0xd'),_0x1ed7e0,_0x4b4630[_0xce89('0x12')][_0xce89('0x14')]);return _0x4a69ff(_0x4b4630['error']['message']);}else{logger[_0xce89('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x1ed7e0,_0xce89('0x10'));_0x4a69ff(_0x4b4630[_0xce89('0x15')]['message']);}})[_0xce89('0x16')](function(_0x5a1624){logger[_0xce89('0x12')](_0xce89('0xd'),_0x1ed7e0,_0x5a1624);_0x51327e(_0x5a1624);});});}