d4f35fe17684b2db7a4183f7e87adeeec9d256c4
[motion2.git] / server / services / routing / server / applications / close.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 _0x67fb=['../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','channel','Interaction','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','stringify','finally','stop','../../../../config/logger','routing','../../rpc/chatInteraction'];(function(_0x119280,_0x439c3e){var _0x481797=function(_0x4265cb){while(--_0x4265cb){_0x119280['push'](_0x119280['shift']());}};_0x481797(++_0x439c3e);}(_0x67fb,0x105));var _0xb67f=function(_0x502299,_0x3cd47a){_0x502299=_0x502299-0x0;var _0x45bbca=_0x67fb[_0x502299];return _0x45bbca;};'use strict';var moment=require('moment');var logger=require(_0xb67f('0x0'))(_0xb67f('0x1'));var rpc={'chatInteraction':require(_0xb67f('0x2')),'openchannelInteraction':require(_0xb67f('0x3')),'smsInteraction':require(_0xb67f('0x4')),'mailInteraction':require(_0xb67f('0x5')),'faxInteraction':require(_0xb67f('0x6')),'whatsappInteraction':require(_0xb67f('0x7'))};exports[_0xb67f('0x8')]=function(_0x564fea,_0x373c3b,_0x7b31f9,_0x40fda9){return function(_0x426a5f){try{logger[_0xb67f('0x9')](_0xb67f('0xa'),_0x564fea,_0x373c3b[0x0]);var _0x6d7410={'closed':0x1,'closedAt':moment()[_0xb67f('0xb')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':'system','disposition':_0x373c3b[0x0]};if(rpc[_0x40fda9[_0xb67f('0xc')]+_0xb67f('0xd')]){rpc[_0x40fda9[_0xb67f('0xc')]+_0xb67f('0xd')][_0xb67f('0xe')](_0x40fda9[_0xb67f('0xf')]['id'],_0x6d7410)['then'](function(_0x401f19){logger['info'](_0xb67f('0x10'),_0x564fea,_0x40fda9[_0xb67f('0xf')]['id']);})['catch'](function(_0x49e9cf){logger[_0xb67f('0x11')](_0xb67f('0x12'),_0x564fea,JSON[_0xb67f('0x13')](_0x49e9cf));})[_0xb67f('0x14')](function(){_0x426a5f[_0xb67f('0x15')]();});}}catch(_0x1e3f6a){logger[_0xb67f('0x11')]('[%s][CLOSE]\x20%s',_0x564fea,JSON['stringify'](_0x1e3f6a));_0x426a5f[_0xb67f('0x15')]();}};};