9cc123911ebee22cbbb6f13145d9a76ce125a0ad
[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 _0xfeb4=['../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','info','ZohoConfiguration,\x20%s,\x20%s','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfeb4,0x127));var _0x4feb=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xfeb4[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0x4feb('0x0'));var util=require('util');var moment=require(_0x4feb('0x1'));var BPromise=require(_0x4feb('0x2'));var rs=require(_0x4feb('0x3'));var fs=require('fs');var Redis=require(_0x4feb('0x4'));var db=require(_0x4feb('0x5'))['db'];var utils=require(_0x4feb('0x6'));var logger=require('../../config/logger')(_0x4feb('0x7'));var config=require(_0x4feb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4feb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15e80b,_0x2b727e,_0x36926d){return new BPromise(function(_0x57d3ce,_0x43e141){return client['request'](_0x15e80b,_0x36926d)[_0x4feb('0xa')](function(_0x347ceb){logger[_0x4feb('0xb')](_0x4feb('0xc'),_0x2b727e,'request\x20sent');logger['debug'](_0x4feb('0xd'),_0x2b727e,_0x4feb('0xe'),JSON[_0x4feb('0xf')](_0x347ceb));if(_0x347ceb[_0x4feb('0x10')]){if(_0x347ceb[_0x4feb('0x10')]['code']===0x1f4){logger[_0x4feb('0x10')](_0x4feb('0xc'),_0x2b727e,_0x347ceb[_0x4feb('0x10')][_0x4feb('0x11')]);return _0x43e141(_0x347ceb[_0x4feb('0x10')][_0x4feb('0x11')]);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x2b727e,_0x347ceb[_0x4feb('0x10')][_0x4feb('0x11')]);return _0x57d3ce(_0x347ceb[_0x4feb('0x10')][_0x4feb('0x11')]);}else{logger['info'](_0x4feb('0xc'),_0x2b727e,_0x4feb('0xe'));_0x57d3ce(_0x347ceb[_0x4feb('0x12')][_0x4feb('0x11')]);}})[_0x4feb('0x13')](function(_0x19f5aa){logger[_0x4feb('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x2b727e,_0x19f5aa);_0x43e141(_0x19f5aa);});});}