3f5364258e178f9826d9eef710b8d2a94dcc6481
[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 _0xb7bb=['request','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x508649,_0x5de0ce){var _0x3dd53d=function(_0xcd2817){while(--_0xcd2817){_0x508649['push'](_0x508649['shift']());}};_0x3dd53d(++_0x5de0ce);}(_0xb7bb,0xd9));var _0xbb7b=function(_0x4bc244,_0x13b9ff){_0x4bc244=_0x4bc244-0x0;var _0x3cbd9f=_0xb7bb[_0x4bc244];return _0x3cbd9f;};'use strict';var _=require('lodash');var util=require(_0xbb7b('0x0'));var moment=require(_0xbb7b('0x1'));var BPromise=require('bluebird');var rs=require(_0xbb7b('0x2'));var fs=require('fs');var Redis=require(_0xbb7b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb7b('0x4'));var logger=require(_0xbb7b('0x5'))(_0xbb7b('0x6'));var config=require(_0xbb7b('0x7'));var jayson=require(_0xbb7b('0x8'));var client=jayson[_0xbb7b('0x9')][_0xbb7b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x113ffa,_0x5c7b72,_0x52b4fc){return new BPromise(function(_0x1fb361,_0x44a97d){return client[_0xbb7b('0xb')](_0x113ffa,_0x52b4fc)['then'](function(_0xa27670){logger['info'](_0xbb7b('0xc'),_0x5c7b72,_0xbb7b('0xd'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x5c7b72,_0xbb7b('0xd'),JSON['stringify'](_0xa27670));if(_0xa27670[_0xbb7b('0xe')]){if(_0xa27670[_0xbb7b('0xe')][_0xbb7b('0xf')]===0x1f4){logger[_0xbb7b('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x5c7b72,_0xa27670[_0xbb7b('0xe')][_0xbb7b('0x10')]);return _0x44a97d(_0xa27670['error'][_0xbb7b('0x10')]);}logger['error'](_0xbb7b('0xc'),_0x5c7b72,_0xa27670[_0xbb7b('0xe')][_0xbb7b('0x10')]);return _0x1fb361(_0xa27670[_0xbb7b('0xe')][_0xbb7b('0x10')]);}else{logger[_0xbb7b('0x11')](_0xbb7b('0xc'),_0x5c7b72,'request\x20sent');_0x1fb361(_0xa27670['result'][_0xbb7b('0x10')]);}})[_0xbb7b('0x12')](function(_0x43e0fe){logger[_0xbb7b('0xe')](_0xbb7b('0xc'),_0x5c7b72,_0x43e0fe);_0x44a97d(_0x43e0fe);});});}