15443f190edb6fe51c41163d9fe4a7e0f3b0f8d8
[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 _0x4fc2=['data3','queue','outbound','EVENT\x20UNKNOWN','unmanaged','sugarcrm','servicenow','unknown\x20integration','../../../../config/logger','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','format','%s\x20account\x20#%s\x20not\x20found','error','lodash','util','./zendesk','./salesforce','./freshdesk','./zoho','./desk','./servicenow','./dynamics365','zendesk','salesforce','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','exec','includes','toLowerCase','data1','data2','Configurations'];(function(_0x30f5bb,_0x4db4bd){var _0x1cfc00=function(_0x20f833){while(--_0x20f833){_0x30f5bb['push'](_0x30f5bb['shift']());}};_0x1cfc00(++_0x4db4bd);}(_0x4fc2,0x111));var _0x24fc=function(_0x3a6d3e,_0x4f0ac5){_0x3a6d3e=_0x3a6d3e-0x0;var _0x735896=_0x4fc2[_0x3a6d3e];return _0x735896;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var zendesk=require(_0x24fc('0x2'));var salesforce=require(_0x24fc('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x24fc('0x4'));var zoho=require(_0x24fc('0x5'));var desk=require(_0x24fc('0x6'));var vtiger=require('./vtiger');var servicenow=require(_0x24fc('0x7'));var dynamics365=require(_0x24fc('0x8'));var freshsales=require('./freshsales');var integrations=[_0x24fc('0x9'),_0x24fc('0xa'),'sugarcrm',_0x24fc('0xb'),_0x24fc('0xc'),_0x24fc('0xd'),_0x24fc('0xe'),_0x24fc('0xf'),_0x24fc('0x10'),'servicenow'];exports[_0x24fc('0x11')]=function(_0x1819a5,_0x1a4462,_0x133438,_0x24998d,_0x2de64d,_0x3b3e6c){if(_0x133438){if(_[_0x24fc('0x12')](integrations,_0x1819a5['data1'][_0x24fc('0x13')]())){try{var _0x1cde5d=null;var _0x5cc65e='';var _0x306873=_0x133438[_0x1819a5[_0x24fc('0x14')][_0x24fc('0x13')]()];if(_0x306873){var _0x3bc30b=_0x306873[_0x1819a5[_0x24fc('0x15')]];if(_0x3bc30b){var _0x326276=_['find'](_0x3bc30b[_0x24fc('0x16')],{'id':parseInt(_0x1819a5[_0x24fc('0x17')],0xa)});if(_0x326276){if(_0x24998d){if(_0x2de64d&&_0x1a4462[_0x24fc('0x18')]){_0x5cc65e=_0x24fc('0x18');}else if(_0x1a4462['routeId']){_0x5cc65e=_0x24fc('0x19');}else{console['log'](_0x24fc('0x1a'),_0x1a4462);}}else{_0x5cc65e=_0x24fc('0x1b');}switch(_0x1819a5[_0x24fc('0x14')][_0x24fc('0x13')]()){case _0x24fc('0x9'):zendesk[_0x5cc65e](_0x1819a5,_0x1a4462,_0x326276,_0x24998d,_0x2de64d,_0x3bc30b,_0x3b3e6c);break;case'salesforce':salesforce[_0x5cc65e](_0x1819a5,_0x1a4462,_0x326276,_0x24998d,_0x2de64d,_0x3bc30b,_0x3b3e6c);break;case _0x24fc('0x1c'):sugarcrm[_0x5cc65e](_0x1819a5,_0x1a4462,_0x326276,_0x24998d,_0x2de64d,_0x3bc30b,_0x3b3e6c);break;case _0x24fc('0xb'):freshdesk[_0x5cc65e](_0x1819a5,_0x1a4462,_0x326276,_0x24998d,_0x2de64d,_0x3bc30b,_0x3b3e6c);break;case _0x24fc('0xc'):zoho[_0x5cc65e](_0x1819a5,_0x1a4462,_0x326276,_0x24998d,_0x2de64d,_0x3bc30b,_0x3b3e6c);break;case _0x24fc('0xd'):desk[_0x5cc65e](_0x1819a5,_0x1a4462,_0x326276,_0x24998d,_0x2de64d,_0x3bc30b,_0x3b3e6c);break;case'vtiger':vtiger[_0x5cc65e](_0x1819a5,_0x1a4462,_0x326276,_0x24998d,_0x2de64d,_0x3bc30b,_0x3b3e6c);break;case _0x24fc('0x10'):freshsales['cs'](_0x1819a5,_0x1a4462,_0x326276,_0x24998d,_0x2de64d,_0x3bc30b,_0x3b3e6c,_0x5cc65e);break;case _0x24fc('0x1d'):servicenow['cs'](_0x1819a5,_0x1a4462,_0x326276,_0x24998d,_0x2de64d,_0x3bc30b,_0x3b3e6c,_0x5cc65e);break;case _0x24fc('0xf'):dynamics365['cs'](_0x1819a5,_0x1a4462,_0x326276,_0x24998d,_0x2de64d,_0x3bc30b,_0x3b3e6c,_0x5cc65e);break;default:console['log'](_0x24fc('0x1e'));}}else{_0x1cde5d=require(_0x24fc('0x1f'))(_0x1819a5[_0x24fc('0x14')][_0x24fc('0x13')]());_0x1cde5d['error'](_0x24fc('0x20'),util['format'](_0x24fc('0x21'),_0x1819a5['data1'][_0x24fc('0x13')](),_0x1819a5[_0x24fc('0x17')]));}}else{_0x1cde5d=require(_0x24fc('0x1f'))(_0x1819a5['data1'][_0x24fc('0x13')]());_0x1cde5d['error'](_0x24fc('0x20'),util[_0x24fc('0x22')](_0x24fc('0x23'),_0x1819a5[_0x24fc('0x14')][_0x24fc('0x13')](),_0x1819a5[_0x24fc('0x15')]));}}else{}}catch(_0x3f0875){console[_0x24fc('0x24')](_0x3f0875);}}}};