674847ac8aedd8fabb789f87f0019a269367d61f
[motion2.git] / server / api / intZohoAccount / intZohoAccount.controller.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 _0xa5cf=['filter','VIRTUAL','name','merge','options','includeAll','include','rows','catch','params','keys','find','create','body','getConfigurations','findOne','ZohoConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','clientId','serverUrl','zoho.eu','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','send','index','map','ZohoAccount','rawAttributes','fieldName','type','query','filters','model','intersection','fields','attributes','length','nolimit','order','sort','where','pick'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xa5cf,0xc7));var _0xfa5c=function(_0x2781c9,_0x331c04){_0x2781c9=_0x2781c9-0x0;var _0xb2c661=_0xa5cf[_0x2781c9];return _0xb2c661;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfa5c('0x0'));var jsonpatch=require(_0xfa5c('0x1'));var rp=require(_0xfa5c('0x2'));var moment=require(_0xfa5c('0x3'));var BPromise=require(_0xfa5c('0x4'));var Mustache=require(_0xfa5c('0x5'));var util=require('util');var path=require('path');var sox=require(_0xfa5c('0x6'));var csv=require(_0xfa5c('0x7'));var ejs=require(_0xfa5c('0x8'));var fs=require('fs');var fs_extra=require(_0xfa5c('0x9'));var _=require(_0xfa5c('0xa'));var squel=require('squel');var crypto=require(_0xfa5c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfa5c('0xc'));var toCsv=require(_0xfa5c('0x7'));var querystring=require(_0xfa5c('0xd'));var Papa=require(_0xfa5c('0xe'));var Redis=require(_0xfa5c('0xf'));var authService=require(_0xfa5c('0x10'));var qs=require(_0xfa5c('0x11'));var as=require(_0xfa5c('0x12'));var hardwareService=require(_0xfa5c('0x13'));var logger=require(_0xfa5c('0x14'))('api');var utils=require(_0xfa5c('0x15'));var config=require(_0xfa5c('0x16'));var licenseUtil=require(_0xfa5c('0x17'));var db=require(_0xfa5c('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4812fd,_0x30fba0){_0x30fba0=_0x30fba0||0xcc;return function(_0x2308a6){if(_0x2308a6){return _0x4812fd[_0xfa5c('0x19')](_0x30fba0);}return _0x4812fd[_0xfa5c('0x1a')](_0x30fba0)[_0xfa5c('0x1b')]();};}function respondWithResult(_0x37bd9b,_0x597841){_0x597841=_0x597841||0xc8;return function(_0xf97839){if(_0xf97839){return _0x37bd9b[_0xfa5c('0x1a')](_0x597841)['json'](_0xf97839);}};}function respondWithFilteredResult(_0x47eef2,_0x1759fe){return function(_0xdf0115){if(_0xdf0115){var _0x366c6d=typeof _0x1759fe[_0xfa5c('0x1c')]==='undefined'&&typeof _0x1759fe[_0xfa5c('0x1d')]===_0xfa5c('0x1e');var _0x20cf8e=_0xdf0115[_0xfa5c('0x1f')];var _0x24014a=_0x366c6d?0x0:_0x1759fe[_0xfa5c('0x1c')];var _0x4c0ac1=_0x366c6d?_0xdf0115[_0xfa5c('0x1f')]:_0x1759fe['offset']+_0x1759fe[_0xfa5c('0x1d')];var _0x58eab5;if(_0x4c0ac1>=_0x20cf8e){_0x4c0ac1=_0x20cf8e;_0x58eab5=0xc8;}else{_0x58eab5=0xce;}_0x47eef2[_0xfa5c('0x1a')](_0x58eab5);return _0x47eef2[_0xfa5c('0x20')](_0xfa5c('0x21'),_0x24014a+'-'+_0x4c0ac1+'/'+_0x20cf8e)[_0xfa5c('0x22')](_0xdf0115);}return null;};}function patchUpdates(_0x2ebd78){return function(_0x47ef54){try{jsonpatch[_0xfa5c('0x23')](_0x47ef54,_0x2ebd78,!![]);}catch(_0x2345ad){return BPromise[_0xfa5c('0x24')](_0x2345ad);}return _0x47ef54[_0xfa5c('0x25')]();};}function saveUpdates(_0x12c09b,_0x12fa86){return function(_0x4cb7a4){if(_0x4cb7a4){return _0x4cb7a4[_0xfa5c('0x26')](_0x12c09b)[_0xfa5c('0x27')](function(_0x3b85ec){return _0x3b85ec;});}return null;};}function removeEntity(_0x41cbd0,_0x2d971d){return function(_0x13a92f){if(_0x13a92f){return _0x13a92f[_0xfa5c('0x28')]()[_0xfa5c('0x27')](function(){_0x41cbd0[_0xfa5c('0x1a')](0xcc)[_0xfa5c('0x1b')]();});}};}function handleEntityNotFound(_0x190e0d,_0x4ec4a7){return function(_0x2f7f11){if(!_0x2f7f11){_0x190e0d[_0xfa5c('0x19')](0x194);}return _0x2f7f11;};}function handleError(_0x46fa8c,_0x2a5840){_0x2a5840=_0x2a5840||0x1f4;return function(_0x38d4b3){logger[_0xfa5c('0x29')](_0x38d4b3['stack']);if(_0x38d4b3['name']){delete _0x38d4b3['name'];}_0x46fa8c[_0xfa5c('0x1a')](_0x2a5840)[_0xfa5c('0x2a')](_0x38d4b3);};}exports[_0xfa5c('0x2b')]=function(_0x230209,_0x3bd7e8){var _0x4d1f16={},_0x1bb0b8={},_0x2697e8={'count':0x0,'rows':[]};var _0x425a79=_[_0xfa5c('0x2c')](db[_0xfa5c('0x2d')][_0xfa5c('0x2e')],function(_0x7a2d2f){return{'name':_0x7a2d2f[_0xfa5c('0x2f')],'type':_0x7a2d2f[_0xfa5c('0x30')]['key']};});_0x1bb0b8['model']=_['map'](_0x425a79,'name');_0x1bb0b8['query']=_['keys'](_0x230209[_0xfa5c('0x31')]);_0x1bb0b8[_0xfa5c('0x32')]=_['intersection'](_0x1bb0b8[_0xfa5c('0x33')],_0x1bb0b8[_0xfa5c('0x31')]);_0x4d1f16['attributes']=_[_0xfa5c('0x34')](_0x1bb0b8['model'],qs[_0xfa5c('0x35')](_0x230209[_0xfa5c('0x31')][_0xfa5c('0x35')]));_0x4d1f16['attributes']=_0x4d1f16[_0xfa5c('0x36')][_0xfa5c('0x37')]?_0x4d1f16['attributes']:_0x1bb0b8['model'];if(!_0x230209[_0xfa5c('0x31')]['hasOwnProperty'](_0xfa5c('0x38'))){_0x4d1f16[_0xfa5c('0x1d')]=qs[_0xfa5c('0x1d')](_0x230209[_0xfa5c('0x31')]['limit']);_0x4d1f16[_0xfa5c('0x1c')]=qs[_0xfa5c('0x1c')](_0x230209[_0xfa5c('0x31')][_0xfa5c('0x1c')]);}_0x4d1f16[_0xfa5c('0x39')]=qs[_0xfa5c('0x3a')](_0x230209[_0xfa5c('0x31')][_0xfa5c('0x3a')]);_0x4d1f16[_0xfa5c('0x3b')]=qs[_0xfa5c('0x32')](_[_0xfa5c('0x3c')](_0x230209[_0xfa5c('0x31')],_0x1bb0b8[_0xfa5c('0x32')]),_0x425a79);if(_0x230209[_0xfa5c('0x31')][_0xfa5c('0x3d')]){_0x4d1f16[_0xfa5c('0x3b')]=_['merge'](_0x4d1f16['where'],{'$or':_['map'](_0x425a79,function(_0x5e1161){if(_0x5e1161['type']!==_0xfa5c('0x3e')){var _0x36fa6a={};_0x36fa6a[_0x5e1161[_0xfa5c('0x3f')]]={'$like':'%'+_0x230209['query'][_0xfa5c('0x3d')]+'%'};return _0x36fa6a;}})});}_0x4d1f16=_[_0xfa5c('0x40')]({},_0x4d1f16,_0x230209[_0xfa5c('0x41')]);var _0x2412fb={'where':_0x4d1f16[_0xfa5c('0x3b')]};return db[_0xfa5c('0x2d')][_0xfa5c('0x1f')](_0x2412fb)[_0xfa5c('0x27')](function(_0x44ec2b){_0x2697e8[_0xfa5c('0x1f')]=_0x44ec2b;if(_0x230209[_0xfa5c('0x31')][_0xfa5c('0x42')]){_0x4d1f16[_0xfa5c('0x43')]=[{'all':!![]}];}return db['ZohoAccount']['findAll'](_0x4d1f16);})[_0xfa5c('0x27')](function(_0x47692b){_0x2697e8[_0xfa5c('0x44')]=_0x47692b;return _0x2697e8;})[_0xfa5c('0x27')](respondWithFilteredResult(_0x3bd7e8,_0x4d1f16))[_0xfa5c('0x45')](handleError(_0x3bd7e8,null));};exports['show']=function(_0x39835c,_0x4389eb){var _0x3289f5={'raw':![],'where':{'id':_0x39835c[_0xfa5c('0x46')]['id']}},_0x2969a2={};_0x2969a2['model']=_['keys'](db[_0xfa5c('0x2d')][_0xfa5c('0x2e')]);_0x2969a2[_0xfa5c('0x31')]=_[_0xfa5c('0x47')](_0x39835c['query']);_0x2969a2[_0xfa5c('0x32')]=_[_0xfa5c('0x34')](_0x2969a2['model'],_0x2969a2[_0xfa5c('0x31')]);_0x3289f5[_0xfa5c('0x36')]=_[_0xfa5c('0x34')](_0x2969a2[_0xfa5c('0x33')],qs[_0xfa5c('0x35')](_0x39835c[_0xfa5c('0x31')][_0xfa5c('0x35')]));_0x3289f5['attributes']=_0x3289f5['attributes']['length']?_0x3289f5['attributes']:_0x2969a2['model'];if(_0x39835c[_0xfa5c('0x31')][_0xfa5c('0x42')]){_0x3289f5[_0xfa5c('0x43')]=[{'all':!![]}];}_0x3289f5=_['merge']({},_0x3289f5,_0x39835c[_0xfa5c('0x41')]);return db['ZohoAccount'][_0xfa5c('0x48')](_0x3289f5)['then'](handleEntityNotFound(_0x4389eb,null))['then'](respondWithResult(_0x4389eb,null))['catch'](handleError(_0x4389eb,null));};exports[_0xfa5c('0x49')]=function(_0x554c16,_0x38a58e){return db[_0xfa5c('0x2d')][_0xfa5c('0x49')](_0x554c16['body'],{})['then'](respondWithResult(_0x38a58e,0xc9))[_0xfa5c('0x45')](handleError(_0x38a58e,null));};exports['update']=function(_0x2f90bc,_0x14cc54){if(_0x2f90bc[_0xfa5c('0x4a')]['id']){delete _0x2f90bc[_0xfa5c('0x4a')]['id'];}return db[_0xfa5c('0x2d')][_0xfa5c('0x48')]({'where':{'id':_0x2f90bc[_0xfa5c('0x46')]['id']}})[_0xfa5c('0x27')](handleEntityNotFound(_0x14cc54,null))[_0xfa5c('0x27')](saveUpdates(_0x2f90bc[_0xfa5c('0x4a')],null))[_0xfa5c('0x27')](respondWithResult(_0x14cc54,null))[_0xfa5c('0x45')](handleError(_0x14cc54,null));};exports[_0xfa5c('0x28')]=function(_0x310395,_0xb71728){return db[_0xfa5c('0x2d')][_0xfa5c('0x48')]({'where':{'id':_0x310395[_0xfa5c('0x46')]['id']}})[_0xfa5c('0x27')](handleEntityNotFound(_0xb71728,null))[_0xfa5c('0x27')](removeEntity(_0xb71728,null))[_0xfa5c('0x45')](handleError(_0xb71728,null));};exports[_0xfa5c('0x4b')]=function(_0x2c4dc9,_0x1882eb,_0x56d676){var _0x661e1c={};var _0x5b019b={};var _0x52baf6;var _0x3b3636;return db['ZohoAccount'][_0xfa5c('0x4c')]({'where':{'id':_0x2c4dc9[_0xfa5c('0x46')]['id']}})[_0xfa5c('0x27')](handleEntityNotFound(_0x1882eb,null))[_0xfa5c('0x27')](function(_0x335afc){if(_0x335afc){_0x52baf6=_0x335afc;_0x5b019b['model']=_[_0xfa5c('0x47')](db[_0xfa5c('0x4d')]['rawAttributes']);_0x5b019b['query']=_[_0xfa5c('0x47')](_0x2c4dc9['query']);_0x5b019b[_0xfa5c('0x32')]=_[_0xfa5c('0x34')](_0x5b019b[_0xfa5c('0x33')],_0x5b019b[_0xfa5c('0x31')]);_0x661e1c[_0xfa5c('0x36')]=_[_0xfa5c('0x34')](_0x5b019b[_0xfa5c('0x33')],qs['fields'](_0x2c4dc9[_0xfa5c('0x31')][_0xfa5c('0x35')]));_0x661e1c[_0xfa5c('0x36')]=_0x661e1c[_0xfa5c('0x36')][_0xfa5c('0x37')]?_0x661e1c[_0xfa5c('0x36')]:_0x5b019b[_0xfa5c('0x33')];_0x661e1c[_0xfa5c('0x39')]=qs['sort'](_0x2c4dc9[_0xfa5c('0x31')][_0xfa5c('0x3a')]);_0x661e1c[_0xfa5c('0x3b')]=qs['filters'](_['pick'](_0x2c4dc9[_0xfa5c('0x31')],_0x5b019b[_0xfa5c('0x32')]));if(_0x2c4dc9[_0xfa5c('0x31')]['filter']){_0x661e1c[_0xfa5c('0x3b')]=_[_0xfa5c('0x40')](_0x661e1c[_0xfa5c('0x3b')],{'$or':_[_0xfa5c('0x2c')](_0x661e1c[_0xfa5c('0x36')],function(_0x2c2ab0){var _0x477418={};_0x477418[_0x2c2ab0]={'$like':'%'+_0x2c4dc9[_0xfa5c('0x31')][_0xfa5c('0x3d')]+'%'};return _0x477418;})});}_0x661e1c=_[_0xfa5c('0x40')]({},_0x661e1c,_0x2c4dc9[_0xfa5c('0x41')]);return _0x52baf6[_0xfa5c('0x4b')](_0x661e1c);}})[_0xfa5c('0x27')](function(_0x51610d){if(_0x51610d){_0x3b3636=_0x51610d[_0xfa5c('0x37')];if(!_0x2c4dc9['query'][_0xfa5c('0x4e')](_0xfa5c('0x38'))){_0x661e1c[_0xfa5c('0x1d')]=qs[_0xfa5c('0x1d')](_0x2c4dc9[_0xfa5c('0x31')][_0xfa5c('0x1d')]);_0x661e1c[_0xfa5c('0x1c')]=qs['offset'](_0x2c4dc9[_0xfa5c('0x31')][_0xfa5c('0x1c')]);}return _0x52baf6['getConfigurations'](_0x661e1c);}})[_0xfa5c('0x27')](function(_0x4c37db){if(_0x4c37db){return _0x4c37db?{'count':_0x3b3636,'rows':_0x4c37db}:null;}})[_0xfa5c('0x27')](respondWithResult(_0x1882eb,null))[_0xfa5c('0x45')](handleError(_0x1882eb,null));};exports[_0xfa5c('0x4f')]=function(_0x575613,_0x51d50d,_0xa06649){if(_0x575613[_0xfa5c('0x4a')]['id']){delete _0x575613['body']['id'];}return db[_0xfa5c('0x2d')][_0xfa5c('0x4c')]({'where':{'id':_0x575613['params']['id']}})['then'](handleEntityNotFound(_0x51d50d,null))[_0xfa5c('0x27')](function(_0x58c821){if(_0x58c821){_0x575613[_0xfa5c('0x4a')][_0xfa5c('0x50')]=_0x58c821['id'];_0x575613[_0xfa5c('0x4a')][_0xfa5c('0x51')]=integrations[_0xfa5c('0x52')](_0x575613['body'][_0xfa5c('0x53')],_0x575613['body'][_0xfa5c('0x30')]);_0x575613[_0xfa5c('0x4a')][_0xfa5c('0x54')]=integrations[_0xfa5c('0x55')](_0x575613[_0xfa5c('0x4a')]['channel'],_0x575613['body'][_0xfa5c('0x30')]);return db[_0xfa5c('0x4d')]['create'](_0x575613[_0xfa5c('0x4a')],{'include':[{'model':db[_0xfa5c('0x56')],'as':_0xfa5c('0x51')},{'model':db['ZohoField'],'as':_0xfa5c('0x54')}]});}return null;})['then'](respondWithResult(_0x51d50d,null))[_0xfa5c('0x45')](handleError(_0x51d50d,null));};function getAccessToken(_0x53a800){return new Promise(function(_0x4084e5,_0x17e61f){var _0x47eeca;switch(_0x53a800[_0xfa5c('0x57')]){case'US':_0x47eeca=_0xfa5c('0x58');break;case'AU':_0x47eeca=_0xfa5c('0x59');break;case'EU':_0x47eeca=_0xfa5c('0x5a');break;case'IN':_0x47eeca=_0xfa5c('0x5b');break;case'CN':_0x47eeca=_0xfa5c('0x5c');break;default:_0x47eeca=_0xfa5c('0x5a');break;}var _0x371a3f={'method':'POST','uri':_0x47eeca+_0xfa5c('0x5d'),'qs':{'refresh_token':_0x53a800[_0xfa5c('0x5e')],'client_id':_0x53a800['clientId'],'client_secret':_0x53a800[_0xfa5c('0x5f')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x371a3f)[_0xfa5c('0x27')](function(_0x22f822){if(_0x22f822['access_token']){_0x4084e5(_0x22f822[_0xfa5c('0x60')]);}else{_0x17e61f(_0xfa5c('0x61'));}})[_0xfa5c('0x45')](function(_0x579cd0){_0x17e61f(_0x579cd0);});});}exports['getFields']=function(_0x491190,_0x3089d5,_0x4d8ad4){var _0x49ffb0,_0x11ff16,_0x34b27a,_0x18edc0,_0x566764;return db[_0xfa5c('0x2d')][_0xfa5c('0x4c')]({'where':{'id':_0x491190[_0xfa5c('0x46')]['id']},'attributes':['id',_0xfa5c('0x62'),_0xfa5c('0x57'),_0xfa5c('0x63'),_0xfa5c('0x5f'),_0xfa5c('0x64'),'code',_0xfa5c('0x5e')]})[_0xfa5c('0x27')](handleEntityNotFound(_0x3089d5,null))['then'](function(_0x3f6924){_0x566764=_0x3f6924;_0x49ffb0=_0x566764[_0xfa5c('0x62')];_0x11ff16=_0x49ffb0===_0xfa5c('0x65')?'eu':'com';_0x34b27a=_0x566764[_0xfa5c('0x64')];var _0x3f9046=_0x34b27a[_0xfa5c('0x66')](-0x1);if(_0x3f9046==='/'||_0x3f9046==='\x5c'||_0x3f9046===':'){_0x34b27a=_0x34b27a['substring'](0x0,_0x34b27a[_0xfa5c('0x67')](_0x3f9046));}if(!_0x566764[_0xfa5c('0x5e')]){throw new Error(_0xfa5c('0x68'));}return getAccessToken(_0x566764);})[_0xfa5c('0x27')](function(_0x512c1b){if(_0x512c1b){return rp({'method':_0xfa5c('0x69'),'uri':util['format'](_0xfa5c('0x6a'),_0x11ff16),'qs':{'module':'Calls'},'headers':{'Authorization':_0xfa5c('0x6b')+_0x512c1b},'json':!![]});}})[_0xfa5c('0x27')](function(_0x2851fb){if(_0x2851fb){if(_0x2851fb[_0xfa5c('0x6c')]&&_0x2851fb['response'][_0xfa5c('0x29')]){throw new Error(_0x2851fb[_0xfa5c('0x6c')]['error'][_0xfa5c('0x6d')]);}var _0x1e81b7=[];var _0x3a4eb8=[];var _0x59940e=[_0xfa5c('0x6e'),_0xfa5c('0x6f'),_0xfa5c('0x70'),_0xfa5c('0x71'),_0xfa5c('0x72'),_0xfa5c('0x73'),_0xfa5c('0x74'),_0xfa5c('0x75')];_0x3a4eb8=_[_0xfa5c('0x76')](_0x2851fb[_0xfa5c('0x35')],function(_0x2ee010){return _0x59940e[_0xfa5c('0x77')](_0x2ee010[_0xfa5c('0x78')]);});for(var _0x13eab5=0x0;_0x13eab5<_0x3a4eb8['length'];_0x13eab5++){if(_0x3a4eb8[_0x13eab5][_0xfa5c('0x79')]===![]){_0x1e81b7[_0xfa5c('0x7a')]({'id':_0x3a4eb8[_0x13eab5]['id'],'name':_0x3a4eb8[_0x13eab5][_0xfa5c('0x7b')],'custom':_0x3a4eb8[_0x13eab5]['custom_field'],'options':_0x3a4eb8[_0x13eab5][_0xfa5c('0x7c')]===_0xfa5c('0x7d')&&_0x3a4eb8[_0x13eab5]['pick_list_values'][_0xfa5c('0x37')]>-0x1?_[_0xfa5c('0x2c')](_0x3a4eb8[_0x13eab5][_0xfa5c('0x7e')],function(_0x1bd3a7){return{'name':_0x1bd3a7,'value':_0x1bd3a7};}):[]});}}return{'count':_0x1e81b7[_0xfa5c('0x37')],'rows':_0x1e81b7};}else{return{'count':0x0,'rows':[]};}})[_0xfa5c('0x27')](respondWithResult(_0x3089d5,null))[_0xfa5c('0x45')](function(_0x33b3cd){var _0x93864b=_0x491190['query']['test']?0x1f4:_0x33b3cd[_0xfa5c('0x7f')]||0x1f4;logger['error'](_0xfa5c('0x80'),'getFields',_0x93864b,JSON[_0xfa5c('0x81')](_0x33b3cd));delete _0x33b3cd[_0xfa5c('0x3f')];if(_0x93864b===0x191){_0x93864b=0x190;}_0x3089d5[_0xfa5c('0x1a')](_0x93864b)[_0xfa5c('0x2a')](_0x491190[_0xfa5c('0x31')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x33b3cd[_0xfa5c('0x7f')]}:_0x33b3cd);});};