43dacd3e16bb5178bd4cebcc79768c1ad133544a
[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 _0xf74a=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x510052,_0xf1e2e6){var _0x1a17ce=function(_0x5ee7b4){while(--_0x5ee7b4){_0x510052['push'](_0x510052['shift']());}};_0x1a17ce(++_0xf1e2e6);}(_0xf74a,0x135));var _0xaf74=function(_0x4e9818,_0x570039){_0x4e9818=_0x4e9818-0x0;var _0x7889c2=_0xf74a[_0x4e9818];return _0x7889c2;};'use strict';var _=require(_0xaf74('0x0'));var util=require(_0xaf74('0x1'));var moment=require('moment');var BPromise=require(_0xaf74('0x2'));var rs=require(_0xaf74('0x3'));var fs=require('fs');var Redis=require(_0xaf74('0x4'));var db=require(_0xaf74('0x5'))['db'];var utils=require(_0xaf74('0x6'));var logger=require(_0xaf74('0x7'))(_0xaf74('0x8'));var config=require(_0xaf74('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaf74('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16e945,_0x767bd0,_0x4239cf){return new BPromise(function(_0x237ce6,_0x13cb80){return client[_0xaf74('0xb')](_0x16e945,_0x4239cf)[_0xaf74('0xc')](function(_0x230e47){logger[_0xaf74('0xd')](_0xaf74('0xe'),_0x767bd0,_0xaf74('0xf'));logger[_0xaf74('0x10')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x767bd0,_0xaf74('0xf'),JSON[_0xaf74('0x11')](_0x230e47));if(_0x230e47[_0xaf74('0x12')]){if(_0x230e47[_0xaf74('0x12')]['code']===0x1f4){logger[_0xaf74('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x767bd0,_0x230e47[_0xaf74('0x12')][_0xaf74('0x13')]);return _0x13cb80(_0x230e47['error']['message']);}logger[_0xaf74('0x12')](_0xaf74('0xe'),_0x767bd0,_0x230e47['error'][_0xaf74('0x13')]);return _0x237ce6(_0x230e47[_0xaf74('0x12')][_0xaf74('0x13')]);}else{logger['info'](_0xaf74('0xe'),_0x767bd0,_0xaf74('0xf'));_0x237ce6(_0x230e47[_0xaf74('0x14')][_0xaf74('0x13')]);}})['catch'](function(_0x5074c8){logger[_0xaf74('0x12')](_0xaf74('0xe'),_0x767bd0,_0x5074c8);_0x13cb80(_0x5074c8);});});}