Built motion from commit (unavailable).|2.5.29
[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 _0xefda=['./sugarcrm','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','zoho','vtiger','dynamics365','freshsales','includes','data1','toLowerCase','data2','find','Configurations','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','zendesk','desk','servicenow','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','./salesforce'];(function(_0x20e764,_0x19811d){var _0x4ebc22=function(_0x4d9bdf){while(--_0x4d9bdf){_0x20e764['push'](_0x20e764['shift']());}};_0x4ebc22(++_0x19811d);}(_0xefda,0x96));var _0xaefd=function(_0x4314c9,_0x1a6d36){_0x4314c9=_0x4314c9-0x0;var _0x1f8798=_0xefda[_0x4314c9];return _0x1f8798;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0xaefd('0x1'));var sugarcrm=require(_0xaefd('0x2'));var freshdesk=require('./freshdesk');var zoho=require(_0xaefd('0x3'));var desk=require(_0xaefd('0x4'));var vtiger=require(_0xaefd('0x5'));var servicenow=require(_0xaefd('0x6'));var dynamics365=require(_0xaefd('0x7'));var freshsales=require(_0xaefd('0x8'));var integrations=['zendesk',_0xaefd('0x9'),_0xaefd('0xa'),_0xaefd('0xb'),_0xaefd('0xc'),'desk',_0xaefd('0xd'),_0xaefd('0xe'),_0xaefd('0xf'),'servicenow'];exports['exec']=function(_0x54a3b1,_0xa6239d,_0x16b36e,_0x20135c,_0x35eea5,_0x10272a){if(_0x16b36e){if(_[_0xaefd('0x10')](integrations,_0x54a3b1[_0xaefd('0x11')][_0xaefd('0x12')]())){try{var _0x27be0f=null;var _0x382983='';var _0x2a310c=_0x16b36e[_0x54a3b1['data1'][_0xaefd('0x12')]()];if(_0x2a310c){var _0x4ac467=_0x2a310c[_0x54a3b1[_0xaefd('0x13')]];if(_0x4ac467){var _0x1725af=_[_0xaefd('0x14')](_0x4ac467[_0xaefd('0x15')],{'id':parseInt(_0x54a3b1['data3'],0xa)});if(_0x1725af){if(_0x20135c){if(_0x35eea5&&_0xa6239d[_0xaefd('0x16')]){_0x382983=_0xaefd('0x16');}else if(_0xa6239d[_0xaefd('0x17')]){_0x382983=_0xaefd('0x18');}else{console[_0xaefd('0x19')](_0xaefd('0x1a'),_0xa6239d);}}else{_0x382983=_0xaefd('0x1b');}switch(_0x54a3b1[_0xaefd('0x11')]['toLowerCase']()){case _0xaefd('0x1c'):zendesk[_0x382983](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a);break;case _0xaefd('0x9'):salesforce[_0x382983](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a);break;case _0xaefd('0xa'):sugarcrm[_0x382983](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a);break;case _0xaefd('0xb'):freshdesk[_0x382983](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a);break;case _0xaefd('0xc'):zoho[_0x382983](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a);break;case _0xaefd('0x1d'):desk[_0x382983](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a);break;case'vtiger':vtiger[_0x382983](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a);break;case _0xaefd('0xf'):freshsales['cs'](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a,_0x382983);break;case _0xaefd('0x1e'):servicenow['cs'](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a,_0x382983);break;case _0xaefd('0xe'):dynamics365['cs'](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a,_0x382983);break;default:console[_0xaefd('0x19')](_0xaefd('0x1f'));}}else{_0x27be0f=require(_0xaefd('0x20'))(_0x54a3b1['data1'][_0xaefd('0x12')]());_0x27be0f[_0xaefd('0x21')](_0xaefd('0x22'),util[_0xaefd('0x23')](_0xaefd('0x24'),_0x54a3b1['data1']['toLowerCase'](),_0x54a3b1['data3']));}}else{_0x27be0f=require(_0xaefd('0x20'))(_0x54a3b1[_0xaefd('0x11')][_0xaefd('0x12')]());_0x27be0f['error'](_0xaefd('0x22'),util['format'](_0xaefd('0x25'),_0x54a3b1[_0xaefd('0x11')][_0xaefd('0x12')](),_0x54a3b1['data2']));}}else{}}catch(_0x435413){console[_0xaefd('0x21')](_0x435413);}}}};