Built motion from commit 9d7072cc.|2.5.39
[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 _0x30f3=['request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ZohoConfiguration,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x30f3,0x185));var _0x330f=function(_0x11f1fd,_0xce95a8){_0x11f1fd=_0x11f1fd-0x0;var _0x2d1215=_0x30f3[_0x11f1fd];return _0x2d1215;};'use strict';var _=require(_0x330f('0x0'));var util=require(_0x330f('0x1'));var moment=require(_0x330f('0x2'));var BPromise=require(_0x330f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x330f('0x4'));var db=require(_0x330f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x330f('0x6'))('rpc');var config=require(_0x330f('0x7'));var jayson=require(_0x330f('0x8'));var client=jayson['client'][_0x330f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52901f,_0x21f9c0,_0x38a912){return new BPromise(function(_0x55b740,_0x3b3048){return client['request'](_0x52901f,_0x38a912)[_0x330f('0xa')](function(_0x449979){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x21f9c0,_0x330f('0xb'));logger[_0x330f('0xc')](_0x330f('0xd'),_0x21f9c0,_0x330f('0xb'),JSON[_0x330f('0xe')](_0x449979));if(_0x449979[_0x330f('0xf')]){if(_0x449979[_0x330f('0xf')]['code']===0x1f4){logger[_0x330f('0xf')](_0x330f('0x10'),_0x21f9c0,_0x449979['error']['message']);return _0x3b3048(_0x449979[_0x330f('0xf')]['message']);}logger[_0x330f('0xf')](_0x330f('0x10'),_0x21f9c0,_0x449979[_0x330f('0xf')][_0x330f('0x11')]);return _0x55b740(_0x449979[_0x330f('0xf')][_0x330f('0x11')]);}else{logger[_0x330f('0x12')](_0x330f('0x10'),_0x21f9c0,_0x330f('0xb'));_0x55b740(_0x449979[_0x330f('0x13')][_0x330f('0x11')]);}})['catch'](function(_0x286f2c){logger[_0x330f('0xf')](_0x330f('0x10'),_0x21f9c0,_0x286f2c);_0x3b3048(_0x286f2c);});});}