ab4836ea19ac03c24e0c7a5d3b77aa79edb98bc7
[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 _0x031d=['[%s][CLOSE]\x20%s','stringify','finally','stop','moment','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error'];(function(_0x36feb2,_0x53abef){var _0x292b43=function(_0x52a460){while(--_0x52a460){_0x36feb2['push'](_0x36feb2['shift']());}};_0x292b43(++_0x53abef);}(_0x031d,0xcc));var _0xd031=function(_0x314a8c,_0x1c2e8d){_0x314a8c=_0x314a8c-0x0;var _0x1d4607=_0x031d[_0x314a8c];return _0x1d4607;};'use strict';var moment=require(_0xd031('0x0'));var logger=require('../../../../config/logger')(_0xd031('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xd031('0x2')),'smsInteraction':require(_0xd031('0x3')),'mailInteraction':require(_0xd031('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xd031('0x5')]=function(_0x1e83e2,_0x40d0c2,_0xd60dee,_0xee0998){return function(_0x2f43c6){try{logger['info'](_0xd031('0x6'),_0x1e83e2,_0x40d0c2[0x0]);var _0x452d84={'closed':0x1,'closedAt':moment()['format'](_0xd031('0x7')),'closeReason':_0xd031('0x8'),'disposition':_0x40d0c2[0x0]};if(rpc[_0xee0998[_0xd031('0x9')]+'Interaction']){rpc[_0xee0998[_0xd031('0x9')]+_0xd031('0xa')][_0xd031('0xb')](_0xee0998[_0xd031('0xc')]['id'],_0x452d84)['then'](function(_0x5a22ed){logger['info'](_0xd031('0xd'),_0x1e83e2,_0xee0998[_0xd031('0xc')]['id']);})[_0xd031('0xe')](function(_0x436339){logger[_0xd031('0xf')](_0xd031('0x10'),_0x1e83e2,JSON[_0xd031('0x11')](_0x436339));})[_0xd031('0x12')](function(){_0x2f43c6[_0xd031('0x13')]();});}}catch(_0x122619){logger[_0xd031('0xf')](_0xd031('0x10'),_0x1e83e2,JSON['stringify'](_0x122619));_0x2f43c6[_0xd031('0x13')]();}};};