Built motion from commit 616d3211.|2.6.4
[motion2.git] / server / services / ami / trigger / integration / index.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 _0xbf2a=['toLowerCase','data2','Configurations','data3','queue','outbound','log','EVENT\x20UNKNOWN','unmanaged','salesforce','freshdesk','unknown\x20integration','error','format','../../../../config/logger','[EXEC]','lodash','util','./zendesk','./sugarcrm','./desk','./vtiger','./servicenow','./freshsales','zendesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1'];(function(_0x3c147b,_0xd62258){var _0x324d34=function(_0x544a33){while(--_0x544a33){_0x3c147b['push'](_0x3c147b['shift']());}};_0x324d34(++_0xd62258);}(_0xbf2a,0x1ec));var _0xabf2=function(_0x59118a,_0xb6849e){_0x59118a=_0x59118a-0x0;var _0x1600df=_0xbf2a[_0x59118a];return _0x1600df;};'use strict';var _=require(_0xabf2('0x0'));var util=require(_0xabf2('0x1'));var zendesk=require(_0xabf2('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0xabf2('0x3'));var freshdesk=require('./freshdesk');var zoho=require('./zoho');var desk=require(_0xabf2('0x4'));var vtiger=require(_0xabf2('0x5'));var servicenow=require(_0xabf2('0x6'));var dynamics365=require('./dynamics365');var freshsales=require(_0xabf2('0x7'));var integrations=[_0xabf2('0x8'),'salesforce','sugarcrm','freshdesk',_0xabf2('0x9'),_0xabf2('0xa'),_0xabf2('0xb'),_0xabf2('0xc'),_0xabf2('0xd'),_0xabf2('0xe')];exports[_0xabf2('0xf')]=function(_0x2bc342,_0x219bb5,_0x407be8,_0x48d679,_0x53f778,_0xff512f){if(_0x407be8){if(_[_0xabf2('0x10')](integrations,_0x2bc342[_0xabf2('0x11')][_0xabf2('0x12')]())){try{var _0xc81f19=null;var _0x369a9e='';var _0xd73f84=_0x407be8[_0x2bc342['data1'][_0xabf2('0x12')]()];if(_0xd73f84){var _0x5eb60e=_0xd73f84[_0x2bc342[_0xabf2('0x13')]];if(_0x5eb60e){var _0x34e603=_['find'](_0x5eb60e[_0xabf2('0x14')],{'id':parseInt(_0x2bc342[_0xabf2('0x15')],0xa)});if(_0x34e603){if(_0x48d679){if(_0x53f778&&_0x219bb5[_0xabf2('0x16')]){_0x369a9e=_0xabf2('0x16');}else if(_0x219bb5['routeId']){_0x369a9e=_0xabf2('0x17');}else{console[_0xabf2('0x18')](_0xabf2('0x19'),_0x219bb5);}}else{_0x369a9e=_0xabf2('0x1a');}switch(_0x2bc342[_0xabf2('0x11')][_0xabf2('0x12')]()){case _0xabf2('0x8'):zendesk[_0x369a9e](_0x2bc342,_0x219bb5,_0x34e603,_0x48d679,_0x53f778,_0x5eb60e,_0xff512f);break;case _0xabf2('0x1b'):salesforce[_0x369a9e](_0x2bc342,_0x219bb5,_0x34e603,_0x48d679,_0x53f778,_0x5eb60e,_0xff512f);break;case'sugarcrm':sugarcrm[_0x369a9e](_0x2bc342,_0x219bb5,_0x34e603,_0x48d679,_0x53f778,_0x5eb60e,_0xff512f);break;case _0xabf2('0x1c'):freshdesk[_0x369a9e](_0x2bc342,_0x219bb5,_0x34e603,_0x48d679,_0x53f778,_0x5eb60e,_0xff512f);break;case _0xabf2('0x9'):zoho[_0x369a9e](_0x2bc342,_0x219bb5,_0x34e603,_0x48d679,_0x53f778,_0x5eb60e,_0xff512f);break;case _0xabf2('0xa'):desk[_0x369a9e](_0x2bc342,_0x219bb5,_0x34e603,_0x48d679,_0x53f778,_0x5eb60e,_0xff512f);break;case _0xabf2('0xb'):vtiger[_0x369a9e](_0x2bc342,_0x219bb5,_0x34e603,_0x48d679,_0x53f778,_0x5eb60e,_0xff512f);break;case _0xabf2('0xd'):freshsales['cs'](_0x2bc342,_0x219bb5,_0x34e603,_0x48d679,_0x53f778,_0x5eb60e,_0xff512f,_0x369a9e);break;case _0xabf2('0xe'):servicenow['cs'](_0x2bc342,_0x219bb5,_0x34e603,_0x48d679,_0x53f778,_0x5eb60e,_0xff512f,_0x369a9e);break;case'dynamics365':dynamics365['cs'](_0x2bc342,_0x219bb5,_0x34e603,_0x48d679,_0x53f778,_0x5eb60e,_0xff512f,_0x369a9e);break;default:console[_0xabf2('0x18')](_0xabf2('0x1d'));}}else{_0xc81f19=require('../../../../config/logger')(_0x2bc342[_0xabf2('0x11')][_0xabf2('0x12')]());_0xc81f19[_0xabf2('0x1e')]('[EXEC]',util[_0xabf2('0x1f')]('%s\x20configuration\x20#%s\x20not\x20found',_0x2bc342[_0xabf2('0x11')][_0xabf2('0x12')](),_0x2bc342[_0xabf2('0x15')]));}}else{_0xc81f19=require(_0xabf2('0x20'))(_0x2bc342['data1'][_0xabf2('0x12')]());_0xc81f19[_0xabf2('0x1e')](_0xabf2('0x21'),util[_0xabf2('0x1f')]('%s\x20account\x20#%s\x20not\x20found',_0x2bc342[_0xabf2('0x11')][_0xabf2('0x12')](),_0x2bc342[_0xabf2('0x13')]));}}else{}}catch(_0xc30480){console[_0xabf2('0x1e')](_0xc30480);}}}};