Built motion from commit 3c2ce842.|2.6.31
[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 _0xfc89=['toLowerCase','data1','find','Configurations','queue','outbound','log','unmanaged','zendesk','dynamics365','unknown\x20integration','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','data3','[EXEC]','%s\x20account\x20#%s\x20not\x20found','data2','./zendesk','./sugarcrm','./zoho','./desk','./dynamics365','./freshsales','sugarcrm','freshdesk','zoho','vtiger','servicenow','exec','includes'];(function(_0x20a086,_0x15cef2){var _0x379cc3=function(_0xe4c176){while(--_0xe4c176){_0x20a086['push'](_0x20a086['shift']());}};_0x379cc3(++_0x15cef2);}(_0xfc89,0xf3));var _0x9fc8=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xfc89[_0x618414];return _0x21c19a;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require(_0x9fc8('0x0'));var salesforce=require('./salesforce');var sugarcrm=require(_0x9fc8('0x1'));var freshdesk=require('./freshdesk');var zoho=require(_0x9fc8('0x2'));var desk=require(_0x9fc8('0x3'));var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require(_0x9fc8('0x4'));var freshsales=require(_0x9fc8('0x5'));var integrations=['zendesk','salesforce',_0x9fc8('0x6'),_0x9fc8('0x7'),_0x9fc8('0x8'),'desk',_0x9fc8('0x9'),'dynamics365','freshsales',_0x9fc8('0xa')];exports[_0x9fc8('0xb')]=function(_0x35ecf0,_0x463b45,_0xd246c8,_0x459ec9,_0x5d5b18,_0x32991c){if(_0xd246c8){if(_[_0x9fc8('0xc')](integrations,_0x35ecf0['data1'][_0x9fc8('0xd')]())){try{var _0x500801=null;var _0x44cba8='';var _0x3c45e4=_0xd246c8[_0x35ecf0[_0x9fc8('0xe')][_0x9fc8('0xd')]()];if(_0x3c45e4){var _0x408381=_0x3c45e4[_0x35ecf0['data2']];if(_0x408381){var _0x1a59b6=_[_0x9fc8('0xf')](_0x408381[_0x9fc8('0x10')],{'id':parseInt(_0x35ecf0['data3'],0xa)});if(_0x1a59b6){if(_0x459ec9){if(_0x5d5b18&&_0x463b45[_0x9fc8('0x11')]){_0x44cba8=_0x9fc8('0x11');}else if(_0x463b45['routeId']){_0x44cba8=_0x9fc8('0x12');}else{console[_0x9fc8('0x13')]('EVENT\x20UNKNOWN',_0x463b45);}}else{_0x44cba8=_0x9fc8('0x14');}switch(_0x35ecf0[_0x9fc8('0xe')][_0x9fc8('0xd')]()){case _0x9fc8('0x15'):zendesk[_0x44cba8](_0x35ecf0,_0x463b45,_0x1a59b6,_0x459ec9,_0x5d5b18,_0x408381,_0x32991c);break;case'salesforce':salesforce[_0x44cba8](_0x35ecf0,_0x463b45,_0x1a59b6,_0x459ec9,_0x5d5b18,_0x408381,_0x32991c);break;case _0x9fc8('0x6'):sugarcrm[_0x44cba8](_0x35ecf0,_0x463b45,_0x1a59b6,_0x459ec9,_0x5d5b18,_0x408381,_0x32991c);break;case _0x9fc8('0x7'):freshdesk[_0x44cba8](_0x35ecf0,_0x463b45,_0x1a59b6,_0x459ec9,_0x5d5b18,_0x408381,_0x32991c);break;case _0x9fc8('0x8'):zoho[_0x44cba8](_0x35ecf0,_0x463b45,_0x1a59b6,_0x459ec9,_0x5d5b18,_0x408381,_0x32991c);break;case'desk':desk[_0x44cba8](_0x35ecf0,_0x463b45,_0x1a59b6,_0x459ec9,_0x5d5b18,_0x408381,_0x32991c);break;case'vtiger':vtiger[_0x44cba8](_0x35ecf0,_0x463b45,_0x1a59b6,_0x459ec9,_0x5d5b18,_0x408381,_0x32991c);break;case'freshsales':freshsales['cs'](_0x35ecf0,_0x463b45,_0x1a59b6,_0x459ec9,_0x5d5b18,_0x408381,_0x32991c,_0x44cba8);break;case _0x9fc8('0xa'):servicenow['cs'](_0x35ecf0,_0x463b45,_0x1a59b6,_0x459ec9,_0x5d5b18,_0x408381,_0x32991c,_0x44cba8);break;case _0x9fc8('0x16'):dynamics365['cs'](_0x35ecf0,_0x463b45,_0x1a59b6,_0x459ec9,_0x5d5b18,_0x408381,_0x32991c,_0x44cba8);break;default:console[_0x9fc8('0x13')](_0x9fc8('0x17'));}}else{_0x500801=require(_0x9fc8('0x18'))(_0x35ecf0[_0x9fc8('0xe')][_0x9fc8('0xd')]());_0x500801[_0x9fc8('0x19')]('[EXEC]',util[_0x9fc8('0x1a')](_0x9fc8('0x1b'),_0x35ecf0['data1'][_0x9fc8('0xd')](),_0x35ecf0[_0x9fc8('0x1c')]));}}else{_0x500801=require(_0x9fc8('0x18'))(_0x35ecf0[_0x9fc8('0xe')][_0x9fc8('0xd')]());_0x500801['error'](_0x9fc8('0x1d'),util[_0x9fc8('0x1a')](_0x9fc8('0x1e'),_0x35ecf0[_0x9fc8('0xe')]['toLowerCase'](),_0x35ecf0[_0x9fc8('0x1f')]));}}else{}}catch(_0x5390f5){console[_0x9fc8('0x19')](_0x5390f5);}}}};