Built motion from commit e02f907f.|2.6.14
[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 _0x3f54=['Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','exec','includes','data1','toLowerCase','data2'];(function(_0xadd567,_0xc48bf6){var _0x1cf3d4=function(_0x321196){while(--_0x321196){_0xadd567['push'](_0xadd567['shift']());}};_0x1cf3d4(++_0xc48bf6);}(_0x3f54,0xd2));var _0x43f5=function(_0x216d45,_0x4989fe){_0x216d45=_0x216d45-0x0;var _0xbaac0b=_0x3f54[_0x216d45];return _0xbaac0b;};'use strict';var _=require('lodash');var util=require(_0x43f5('0x0'));var zendesk=require(_0x43f5('0x1'));var salesforce=require(_0x43f5('0x2'));var sugarcrm=require(_0x43f5('0x3'));var freshdesk=require(_0x43f5('0x4'));var zoho=require('./zoho');var desk=require(_0x43f5('0x5'));var vtiger=require(_0x43f5('0x6'));var servicenow=require(_0x43f5('0x7'));var dynamics365=require(_0x43f5('0x8'));var freshsales=require(_0x43f5('0x9'));var integrations=[_0x43f5('0xa'),_0x43f5('0xb'),_0x43f5('0xc'),_0x43f5('0xd'),_0x43f5('0xe'),_0x43f5('0xf'),_0x43f5('0x10'),_0x43f5('0x11'),_0x43f5('0x12'),'servicenow'];exports[_0x43f5('0x13')]=function(_0x338028,_0x6b8fdc,_0x32f2c5,_0x22fbe1,_0x2c94c5,_0x2f0695){if(_0x32f2c5){if(_[_0x43f5('0x14')](integrations,_0x338028[_0x43f5('0x15')][_0x43f5('0x16')]())){try{var _0x240a02=null;var _0x25f84e='';var _0x2c80c9=_0x32f2c5[_0x338028[_0x43f5('0x15')][_0x43f5('0x16')]()];if(_0x2c80c9){var _0x4b89c9=_0x2c80c9[_0x338028[_0x43f5('0x17')]];if(_0x4b89c9){var _0x29f2dc=_['find'](_0x4b89c9[_0x43f5('0x18')],{'id':parseInt(_0x338028[_0x43f5('0x19')],0xa)});if(_0x29f2dc){if(_0x22fbe1){if(_0x2c94c5&&_0x6b8fdc[_0x43f5('0x1a')]){_0x25f84e=_0x43f5('0x1a');}else if(_0x6b8fdc[_0x43f5('0x1b')]){_0x25f84e=_0x43f5('0x1c');}else{console[_0x43f5('0x1d')](_0x43f5('0x1e'),_0x6b8fdc);}}else{_0x25f84e=_0x43f5('0x1f');}switch(_0x338028[_0x43f5('0x15')][_0x43f5('0x16')]()){case _0x43f5('0xa'):zendesk[_0x25f84e](_0x338028,_0x6b8fdc,_0x29f2dc,_0x22fbe1,_0x2c94c5,_0x4b89c9,_0x2f0695);break;case'salesforce':salesforce[_0x25f84e](_0x338028,_0x6b8fdc,_0x29f2dc,_0x22fbe1,_0x2c94c5,_0x4b89c9,_0x2f0695);break;case _0x43f5('0xc'):sugarcrm[_0x25f84e](_0x338028,_0x6b8fdc,_0x29f2dc,_0x22fbe1,_0x2c94c5,_0x4b89c9,_0x2f0695);break;case _0x43f5('0xd'):freshdesk[_0x25f84e](_0x338028,_0x6b8fdc,_0x29f2dc,_0x22fbe1,_0x2c94c5,_0x4b89c9,_0x2f0695);break;case _0x43f5('0xe'):zoho[_0x25f84e](_0x338028,_0x6b8fdc,_0x29f2dc,_0x22fbe1,_0x2c94c5,_0x4b89c9,_0x2f0695);break;case _0x43f5('0xf'):desk[_0x25f84e](_0x338028,_0x6b8fdc,_0x29f2dc,_0x22fbe1,_0x2c94c5,_0x4b89c9,_0x2f0695);break;case _0x43f5('0x10'):vtiger[_0x25f84e](_0x338028,_0x6b8fdc,_0x29f2dc,_0x22fbe1,_0x2c94c5,_0x4b89c9,_0x2f0695);break;case _0x43f5('0x12'):freshsales['cs'](_0x338028,_0x6b8fdc,_0x29f2dc,_0x22fbe1,_0x2c94c5,_0x4b89c9,_0x2f0695,_0x25f84e);break;case'servicenow':servicenow['cs'](_0x338028,_0x6b8fdc,_0x29f2dc,_0x22fbe1,_0x2c94c5,_0x4b89c9,_0x2f0695,_0x25f84e);break;case _0x43f5('0x11'):dynamics365['cs'](_0x338028,_0x6b8fdc,_0x29f2dc,_0x22fbe1,_0x2c94c5,_0x4b89c9,_0x2f0695,_0x25f84e);break;default:console[_0x43f5('0x1d')](_0x43f5('0x20'));}}else{_0x240a02=require(_0x43f5('0x21'))(_0x338028[_0x43f5('0x15')][_0x43f5('0x16')]());_0x240a02[_0x43f5('0x22')](_0x43f5('0x23'),util[_0x43f5('0x24')](_0x43f5('0x25'),_0x338028[_0x43f5('0x15')]['toLowerCase'](),_0x338028[_0x43f5('0x19')]));}}else{_0x240a02=require(_0x43f5('0x21'))(_0x338028[_0x43f5('0x15')][_0x43f5('0x16')]());_0x240a02[_0x43f5('0x22')]('[EXEC]',util[_0x43f5('0x24')](_0x43f5('0x26'),_0x338028[_0x43f5('0x15')]['toLowerCase'](),_0x338028['data2']));}}else{}}catch(_0x327eaa){console['error'](_0x327eaa);}}}};