Built motion from commit 0415ced0.|2.6.28
[motion2.git] / server / services / ami / trigger / integration / sugarcrm.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 _0xf224=['stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','The\x20Enduser\x20ID\x20is:','Inbound','The\x20Ticket\x20ID\x20is:','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','Ticket\x20created!','users','version','user:%s','unmanaged','lastevent','toUpperCase','calleridnum','Fields','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','sugarcrm','redis','defaults','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','created_by','description','Descriptions','toISOString','replace','parent_id','parent_type','parent_name','direction','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','length','find','entry_list','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','then','phone_home','Enduser\x20found!','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','map','type','string','nameField','customField','toLowerCase','custom_fields','content','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue'];(function(_0x433cee,_0x38b4a6){var _0x2ca2e0=function(_0x1ef995){while(--_0x1ef995){_0x433cee['push'](_0x433cee['shift']());}};_0x2ca2e0(++_0x38b4a6);}(_0xf224,0x122));var _0x4f22=function(_0x32db1e,_0x27556a){_0x32db1e=_0x32db1e-0x0;var _0x58fdcc=_0xf224[_0x32db1e];return _0x58fdcc;};'use strict';var _=require(_0x4f22('0x0'));var rp=require(_0x4f22('0x1'));var BPromise=require(_0x4f22('0x2'));var md5=require(_0x4f22('0x3'));var util=require(_0x4f22('0x4'));var Redis=require(_0x4f22('0x5'));var intUtil=require(_0x4f22('0x6'));var config=require(_0x4f22('0x7'));var logger=require('../../../../config/logger')(_0x4f22('0x8'));config[_0x4f22('0x9')]=_[_0x4f22('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x4f22('0xb'))(new Redis(config[_0x4f22('0x9')]));var def={'method':_0x4f22('0xc'),'json':!![]};function emit(_0x3f18cb,_0x37d3d1,_0x24bdc5){io['to'](_0x3f18cb)[_0x4f22('0xd')](_0x37d3d1,_0x24bdc5);}function getTicket(_0x235a01,_0x5b9c9a,_0xb5c424,_0x3b0997,_0x47b66b,_0x4a6caf,_0x49984f,_0x3c8495){logger[_0x4f22('0xe')](_0x4f22('0xf'));var _0x446c21=new Date();var _0x2e7101=[{'name':_0x4f22('0x10'),'value':intUtil[_0x4f22('0x11')](_0x3b0997[_0x4f22('0x12')],_0x47b66b,'\x20')},{'name':'assigned_user_id','value':_0x5b9c9a['id']},{'name':_0x4f22('0x13'),'value':_0x5b9c9a['id']},{'name':_0x4f22('0x14'),'value':intUtil[_0x4f22('0x11')](_0x3b0997[_0x4f22('0x15')],_0x47b66b,'\x0a')},{'name':'date_start','value':_0x446c21[_0x4f22('0x16')]()['slice'](0x0,0x13)[_0x4f22('0x17')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x4f22('0x18'),'value':_0xb5c424['id']},{'name':_0x4f22('0x19'),'value':'Contacts'},{'name':_0x4f22('0x1a'),'value':_0xb5c424[_0x4f22('0x10')]},{'name':_0x4f22('0x1b'),'value':_0x3c8495}];if(_0x4a6caf['length']){_[_0x4f22('0x1c')](_0x4a6caf,function(_0x4e5467){if(_0x47b66b[_0x4e5467[_0x4f22('0x1d')]]){_0x2e7101[_0x4f22('0x1e')]({'name':_0x4e5467[_0x4f22('0x1f')],'value':_0x47b66b[_0x4e5467[_0x4f22('0x1d')]]});}});}return request({'form':{'method':_0x4f22('0x20'),'input_type':_0x4f22('0x21'),'response_type':_0x4f22('0x21'),'rest_data':JSON[_0x4f22('0x22')]({'session':_0x49984f['id'],'module_name':_0x4f22('0x23'),'name_value_list':_0x2e7101})}});}function getAuth(_0x2d98cc){return util[_0x4f22('0x24')](_0x4f22('0x25'),new Buffer(_0x2d98cc[_0x4f22('0x26')]+':X')[_0x4f22('0x27')](_0x4f22('0x28')));}function getServerInfo(_0x35e3c8){return request({'form':{'method':_0x4f22('0x29'),'input_type':'JSON','response_type':_0x4f22('0x21'),'rest_data':JSON[_0x4f22('0x22')]({'session':_0x35e3c8['id']})}});}function getUser(_0x1c3952,_0x1e5449,_0x343774){if(!_[_0x4f22('0x2a')](_0x1e5449)){logger[_0x4f22('0xe')](_0x4f22('0x2b'),_0x1e5449);return request({'form':{'method':_0x4f22('0x2c'),'input_type':_0x4f22('0x21'),'response_type':_0x4f22('0x21'),'rest_data':JSON[_0x4f22('0x22')]({'session':_0x343774['id'],'module_name':_0x4f22('0x2d'),'query':util[_0x4f22('0x24')](_0x4f22('0x2e'),_0x1e5449),'order_by':'','offset':'0','select_fields':['id','name',_0x4f22('0x2f')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x2f54b1){if(_0x2f54b1['entry_list'][_0x4f22('0x30')]){var _0x35df88=_[_0x4f22('0x31')](_0x2f54b1[_0x4f22('0x32')],function(_0x4680e7){return _0x4680e7[_0x4f22('0x33')]['user_name'][_0x4f22('0x34')]===_0x1e5449;});if(_0x35df88){logger['info']('Agent\x20found!');return BPromise[_0x4f22('0x35')]({'id':_0x35df88[_0x4f22('0x33')]['id'][_0x4f22('0x34')],'name':_0x35df88[_0x4f22('0x33')][_0x4f22('0x10')][_0x4f22('0x34')]});}}logger[_0x4f22('0xe')](_0x4f22('0x36'));return BPromise[_0x4f22('0x35')]({'id':_0x343774[_0x4f22('0x33')][_0x4f22('0x37')][_0x4f22('0x34')],'name':_0x343774[_0x4f22('0x33')]['user_name'][_0x4f22('0x34')]});});}else{logger['info'](_0x4f22('0x38'));return BPromise[_0x4f22('0x35')]({'id':_0x343774[_0x4f22('0x33')][_0x4f22('0x37')][_0x4f22('0x34')],'name':_0x343774[_0x4f22('0x33')][_0x4f22('0x2f')][_0x4f22('0x34')]});}}function getEndUser(_0x4d0e32,_0x4738cc,_0x595191,_0x5295bd){logger[_0x4f22('0xe')](_0x4f22('0x39'),_0x595191);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x4f22('0x22')]({'session':_0x5295bd['id'],'module_name':_0x4f22('0x3a'),'query':util[_0x4f22('0x24')](_0x4f22('0x3b'),_0x595191),'order_by':'','offset':'0','select_fields':['id',_0x4f22('0x10'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4f22('0x3c')](function(_0x5d61aa){if(_0x5d61aa[_0x4f22('0x32')][_0x4f22('0x30')]){var _0xe312f5=_['find'](_0x5d61aa[_0x4f22('0x32')],function(_0x5dbc38){return _0x5dbc38['name_value_list'][_0x4f22('0x3d')][_0x4f22('0x34')]===_0x595191;});if(_0xe312f5){logger['info'](_0x4f22('0x3e'));return BPromise[_0x4f22('0x35')]({'id':_0xe312f5[_0x4f22('0x33')]['id'][_0x4f22('0x34')],'name':_0xe312f5[_0x4f22('0x33')][_0x4f22('0x10')]['value'],'phone':_0xe312f5[_0x4f22('0x33')]['phone_home'][_0x4f22('0x34')]});}}else{logger[_0x4f22('0xe')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x4f22('0x20'),'input_type':_0x4f22('0x21'),'response_type':_0x4f22('0x21'),'rest_data':JSON[_0x4f22('0x22')]({'session':_0x5295bd['id'],'module_name':_0x4f22('0x3a'),'name_value_list':[{'name':_0x4f22('0x3f'),'value':_0x4738cc!=='<unknown>'?_0x4738cc:util[_0x4f22('0x24')](_0x4f22('0x40'),_0x595191)},{'name':'phone_home','value':_0x595191}]})}})[_0x4f22('0x3c')](function(_0x422e2c){logger[_0x4f22('0xe')](_0x4f22('0x41'));return BPromise[_0x4f22('0x35')]({'id':_0x422e2c['id'],'name':_0x422e2c['entry_list'][_0x4f22('0x3f')][_0x4f22('0x34')],'phone':_0x422e2c[_0x4f22('0x32')][_0x4f22('0x3d')]['value']});});}});}function request(_0x1ef8b4){logger[_0x4f22('0x42')](_0x4f22('0x43'),JSON['stringify'](_0x1ef8b4));return rp(_['merge'](def,_0x1ef8b4));}function getTags(_0x29f1c7,_0x3d2887){var _0x28fce1=[];if(_0x29f1c7&&_0x29f1c7['length']>0x0){_0x28fce1=_[_0x4f22('0x44')](_0x29f1c7,_0x3d2887);}return _0x28fce1;}function getCustomFields(_0x3c6170,_0x463973){var _0x24ddae=[];var _0x56acfd={'custom_fields':[]};if(_0x3c6170['length']>0x0){_['forEach'](_0x3c6170,function(_0x135429){if(_0x135429[_0x4f22('0x45')]===_0x4f22('0x46')&&_0x135429[_0x4f22('0x47')]&&!_0x135429[_0x4f22('0x48')]){_0x56acfd[_0x135429[_0x4f22('0x47')][_0x4f22('0x49')]()]=_0x135429['content'][_0x4f22('0x27')]();}else if(_0x135429[_0x4f22('0x45')]===_0x4f22('0x46')&&_0x135429['idField']&&_0x135429[_0x4f22('0x48')]){_0x56acfd[_0x4f22('0x4a')][_0x4f22('0x1e')]({'id':_0x135429[_0x4f22('0x1f')],'value':_0x135429[_0x4f22('0x4b')][_0x4f22('0x27')]()});}else if(_0x135429['type']===_0x4f22('0x4c')&&_0x135429['variableName']&&_0x135429['idField']&&_0x135429['customField']){_0x463973[_0x135429[_0x4f22('0x1d')]]&&_0x56acfd[_0x4f22('0x4a')][_0x4f22('0x1e')]({'id':_0x135429[_0x4f22('0x1f')],'value':_0x463973[_0x135429[_0x4f22('0x1d')]][_0x4f22('0x27')]()});}else if(_0x135429['type']===_0x4f22('0x4d')&&_0x135429[_0x4f22('0x4e')]&&_0x135429[_0x4f22('0x4e')][_0x4f22('0x10')]&&_0x135429[_0x4f22('0x1f')]&&_0x135429['customField']){_0x463973[_0x135429[_0x4f22('0x4e')][_0x4f22('0x10')][_0x4f22('0x49')]()]&&_0x56acfd['custom_fields'][_0x4f22('0x1e')]({'id':_0x135429[_0x4f22('0x1f')],'value':_0x463973[_0x135429[_0x4f22('0x4e')][_0x4f22('0x10')][_0x4f22('0x49')]()][_0x4f22('0x27')]()});}});}return _0x56acfd;}function getConnection(_0x363a47){return request({'method':'POST','form':{'method':_0x4f22('0x4f'),'input_type':_0x4f22('0x21'),'response_type':_0x4f22('0x21'),'rest_data':JSON[_0x4f22('0x22')]({'user_auth':{'user_name':_0x363a47[_0x4f22('0x50')],'password':_0x363a47[_0x4f22('0x51')],'encryption':_0x4f22('0x52')},'application':_0x4f22('0x53')})}})[_0x4f22('0x3c')](function(_0x22154f){var _0x5a833c=_0x22154f;if(_0x5a833c['id']){def[_0x4f22('0x54')]=_0x5a833c['id'];return BPromise['resolve'](_0x5a833c);}else{throw new Error(util['format'](_0x4f22('0x55'),_0x363a47['id']));}});}function setRelationship(_0x49bfaf,_0x3849f4,_0x59418b,_0x4ea5f3){return request({'form':{'method':_0x4f22('0x56'),'input_type':'JSON','response_type':_0x4f22('0x21'),'rest_data':JSON['stringify']({'session':_0x49bfaf['id'],'module_name':'Calls','module_id':_0x59418b['id'],'link_field_name':_0x4ea5f3,'related_ids':[_0x3849f4['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x4f22('0x57')]=function(_0x575132,_0x5a6232,_0x22a3fd,_0x484a32,_0x7f772c,_0x2ab6f4){var _0x261d9c,_0x31ad88,_0x1e60ea,_0x22a74b;_0x2ab6f4['remoteUri']=intUtil[_0x4f22('0x58')](_0x2ab6f4[_0x4f22('0x59')]);_0x2ab6f4[_0x4f22('0x5a')]=intUtil[_0x4f22('0x58')](_0x2ab6f4[_0x4f22('0x5a')]);def[_0x4f22('0x5b')]=util[_0x4f22('0x24')](_0x4f22('0x5c'),_0x2ab6f4['remoteUri']);if(_0x7f772c&&_0x7f772c[_0x4f22('0x5d')]){logger[_0x4f22('0xe')]('[QUEUE]','Recording\x20is\x20enabled!');_0x5a6232[_0x4f22('0x5e')]=util[_0x4f22('0x24')](_0x4f22('0x5f'),_0x2ab6f4[_0x4f22('0x5a')],_0x5a6232['uniqueid'],md5(_0x5a6232[_0x4f22('0x60')]));}else{_0x5a6232['recordingURL']='';}return getConnection(_0x2ab6f4)[_0x4f22('0x3c')](function(_0x4dd377){_0x22a74b=_0x4dd377;return getUser(_0x2ab6f4,_0x484a32[_0x4f22('0x10')],_0x22a74b);})[_0x4f22('0x3c')](function(_0x28da9f){_0x261d9c=_0x28da9f;logger[_0x4f22('0xe')]('The\x20User\x20ID\x20is:',_0x261d9c['id']);return getEndUser(_0x2ab6f4,_0x5a6232[_0x4f22('0x61')],_0x5a6232['calleridnum'],_0x22a74b);})['then'](function(_0x7025fe){_0x31ad88=_0x7025fe;logger[_0x4f22('0xe')](_0x4f22('0x62'),_0x31ad88['id']);return getTicket(_0x2ab6f4,_0x261d9c,_0x31ad88,_0x22a3fd,_0x5a6232,_0x22a3fd['Fields'],_0x22a74b,_0x4f22('0x63'));})[_0x4f22('0x3c')](function(_0x7abdcb){_0x1e60ea=_0x7abdcb;logger[_0x4f22('0xe')]('Ticket\x20created!');logger[_0x4f22('0xe')](_0x4f22('0x64'),_0x1e60ea['id']);return setRelationship(_0x22a74b,_0x261d9c,_0x1e60ea,'users');})[_0x4f22('0x3c')](function(){return setRelationship(_0x22a74b,_0x31ad88,_0x1e60ea,_0x4f22('0x65'));})[_0x4f22('0x3c')](function(){return getServerInfo(_0x22a74b);})[_0x4f22('0x3c')](function(_0x136883){var _0xe4bee5=parseInt(_0x136883['version'][_0x4f22('0x66')](0x0));var _0x310c39=util[_0x4f22('0x24')](_0x4f22('0x67'),_0x2ab6f4['remoteUri'],_0x1e60ea['id']);if(_0xe4bee5>0x6){_0x310c39=util[_0x4f22('0x24')](_0x4f22('0x68'),_0x2ab6f4[_0x4f22('0x59')],_0x1e60ea['id']);}logger[_0x4f22('0xe')](_0x4f22('0x69'),_0x4f22('0x6a'));emit(util[_0x4f22('0x24')]('user:%s',_0x484a32[_0x4f22('0x10')]),_0x4f22('0x6b'),{'uri':_0x310c39});})[_0x4f22('0x6c')](function(_0x46b02f){logger[_0x4f22('0x6d')](_0x4f22('0x69'),JSON['stringify'](_0x46b02f));});};exports[_0x4f22('0x6e')]=function(_0x4018ba,_0xa1c3d5,_0x175431,_0xfa119d,_0x1ebc48,_0x41b6dd,_0x31e1ab){var _0xb810ee,_0x3b39a0,_0x5cbedf,_0x1f75dd;_0x41b6dd['remoteUri']=intUtil[_0x4f22('0x58')](_0x41b6dd[_0x4f22('0x59')]);_0x41b6dd[_0x4f22('0x5a')]=intUtil[_0x4f22('0x58')](_0x41b6dd['serverUrl']);def['uri']=util[_0x4f22('0x24')](_0x4f22('0x5c'),_0x41b6dd[_0x4f22('0x59')]);if(_0x31e1ab&&_0x31e1ab[_0x4f22('0x6f')]&&_0x31e1ab[_0x4f22('0x6f')]!=='none'){logger['info'](_0x4f22('0x70'),'Recording\x20is\x20enabled!');_0xa1c3d5[_0x4f22('0x5e')]=util[_0x4f22('0x24')](_0x4f22('0x5f'),_0x41b6dd['serverUrl'],_0xa1c3d5['uniqueid'],md5(_0xa1c3d5[_0x4f22('0x60')]));}return getConnection(_0x41b6dd)['then'](function(_0x5be105){_0x1f75dd=_0x5be105;return getUser(_0x41b6dd,_0xfa119d['name'],_0x1f75dd);})['then'](function(_0x3b3ba4){_0xb810ee=_0x3b3ba4;logger[_0x4f22('0xe')](_0x4f22('0x71'),_0xb810ee['id']);return getEndUser(_0x41b6dd,_0xa1c3d5[_0x4f22('0x72')],_0xa1c3d5[_0x4f22('0x73')],_0x1f75dd);})[_0x4f22('0x3c')](function(_0xbdf27b){_0x3b39a0=_0xbdf27b;logger[_0x4f22('0xe')](_0x4f22('0x62'),_0x3b39a0['id']);return getTicket(_0x41b6dd,_0xb810ee,_0x3b39a0,_0x175431,_0xa1c3d5,_0x175431['Fields'],_0x1f75dd,_0x4f22('0x74'));})[_0x4f22('0x3c')](function(_0x2703e1){_0x5cbedf=_0x2703e1;logger[_0x4f22('0xe')](_0x4f22('0x75'));logger['info'](_0x4f22('0x64'),_0x5cbedf['id']);return setRelationship(_0x1f75dd,_0xb810ee,_0x5cbedf,_0x4f22('0x76'));})['then'](function(){return setRelationship(_0x1f75dd,_0x3b39a0,_0x5cbedf,_0x4f22('0x65'));})[_0x4f22('0x3c')](function(){return getServerInfo(_0x1f75dd);})[_0x4f22('0x3c')](function(_0x17d4ba){var _0x1fa940=parseInt(_0x17d4ba[_0x4f22('0x77')][_0x4f22('0x66')](0x0));var _0x5d54ea=util[_0x4f22('0x24')](_0x4f22('0x67'),_0x41b6dd[_0x4f22('0x59')],_0x5cbedf['id']);if(_0x1fa940>0x6){_0x5d54ea=util[_0x4f22('0x24')](_0x4f22('0x68'),_0x41b6dd[_0x4f22('0x59')],_0x5cbedf['id']);}logger[_0x4f22('0xe')](_0x4f22('0x70'),_0x4f22('0x6a'));emit(util[_0x4f22('0x24')](_0x4f22('0x78'),_0xfa119d[_0x4f22('0x10')]),'trigger:browser:url',{'uri':_0x5d54ea});})[_0x4f22('0x6c')](function(_0x56be87){logger[_0x4f22('0x6d')](_0x4f22('0x70'),JSON['stringify'](_0x56be87));});};exports[_0x4f22('0x79')]=function(_0x4b771c,_0x541b68,_0x9025ce,_0x69ef97,_0x558139,_0x5e634b){var _0x2fa8a4,_0x38ee5d,_0x4f214e,_0x51eead;_0x5e634b[_0x4f22('0x59')]=intUtil[_0x4f22('0x58')](_0x5e634b[_0x4f22('0x59')]);_0x5e634b['serverUrl']=intUtil[_0x4f22('0x58')](_0x5e634b[_0x4f22('0x5a')]);def[_0x4f22('0x5b')]=util[_0x4f22('0x24')](_0x4f22('0x5c'),_0x5e634b[_0x4f22('0x59')]);if(_0x558139&&_0x558139['monitor_format']){logger[_0x4f22('0xe')]('['+_0x541b68[_0x4f22('0x7a')][_0x4f22('0x7b')]()+']','Recording\x20is\x20enabled!');_0x541b68[_0x4f22('0x5e')]=util[_0x4f22('0x24')](_0x4f22('0x5f'),_0x5e634b[_0x4f22('0x5a')],_0x541b68[_0x4f22('0x60')],md5(_0x541b68[_0x4f22('0x60')]));}else{_0x541b68[_0x4f22('0x5e')]='';}return getConnection(_0x5e634b)[_0x4f22('0x3c')](function(_0x5eba4f){_0x51eead=_0x5eba4f;if(!_['isNil'](_0x69ef97)){return getUser(_0x5e634b,_0x69ef97[_0x4f22('0x10')],_0x51eead);}else{return getUser(_0x5e634b,null,_0x51eead);}})[_0x4f22('0x3c')](function(_0x5a3e0b){_0x2fa8a4=_0x5a3e0b;logger[_0x4f22('0xe')]('The\x20User\x20ID\x20is:',_0x2fa8a4['id']);return getEndUser(_0x5e634b,_0x541b68[_0x4f22('0x61')],_0x541b68[_0x4f22('0x7c')],_0x51eead);})[_0x4f22('0x3c')](function(_0x4d3c75){_0x38ee5d=_0x4d3c75;logger[_0x4f22('0xe')](_0x4f22('0x62'),_0x38ee5d['id']);return getTicket(_0x5e634b,_0x2fa8a4,_0x38ee5d,_0x9025ce,_0x541b68,_0x9025ce[_0x4f22('0x7d')],_0x51eead,_0x4f22('0x63'));})['then'](function(_0x202a40){_0x4f214e=_0x202a40;logger['info']('Ticket\x20created!');logger[_0x4f22('0xe')](_0x4f22('0x64'),_0x4f214e['id']);return setRelationship(_0x51eead,_0x2fa8a4,_0x4f214e,_0x4f22('0x76'));})['then'](function(){return setRelationship(_0x51eead,_0x38ee5d,_0x4f214e,_0x4f22('0x65'));})[_0x4f22('0x3c')](function(){return getServerInfo(_0x51eead);})[_0x4f22('0x6c')](function(_0x1eb368){logger[_0x4f22('0x6d')]('['+_0x541b68[_0x4f22('0x7a')]['toUpperCase']()+']',JSON['stringify'](_0x1eb368));});};