1c3dfb65c512cf3aedba85d9ee023fcaa111eeaa
[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 _0x079d=['then','catch','error','[%s][CLOSE]\x20%s','finally','stop','stringify','routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction'];(function(_0x575057,_0x14baf3){var _0x49dbc8=function(_0x23599a){while(--_0x23599a){_0x575057['push'](_0x575057['shift']());}};_0x49dbc8(++_0x14baf3);}(_0x079d,0x17d));var _0xd079=function(_0x4dbc7b,_0x35cbcd){_0x4dbc7b=_0x4dbc7b-0x0;var _0x1e80be=_0x079d[_0x4dbc7b];return _0x1e80be;};'use strict';var moment=require('moment');var logger=require('../../../../config/logger')(_0xd079('0x0'));var rpc={'chatInteraction':require(_0xd079('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xd079('0x2')),'mailInteraction':require(_0xd079('0x3')),'faxInteraction':require(_0xd079('0x4')),'whatsappInteraction':require(_0xd079('0x5'))};exports['consequence']=function(_0x76224,_0x297b9a,_0x122b17,_0x138233){return function(_0x589498){try{logger[_0xd079('0x6')](_0xd079('0x7'),_0x76224,_0x297b9a[0x0]);var _0x20569f={'closed':0x1,'closedAt':moment()[_0xd079('0x8')](_0xd079('0x9')),'closeReason':_0xd079('0xa'),'disposition':_0x297b9a[0x0]};if(rpc[_0x138233[_0xd079('0xb')]+'Interaction']){rpc[_0x138233['channel']+_0xd079('0xc')][_0xd079('0xd')](_0x138233[_0xd079('0xe')]['id'],_0x20569f)[_0xd079('0xf')](function(_0x78a60f){logger[_0xd079('0x6')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x76224,_0x138233[_0xd079('0xe')]['id']);})[_0xd079('0x10')](function(_0x13f533){logger[_0xd079('0x11')](_0xd079('0x12'),_0x76224,JSON['stringify'](_0x13f533));})[_0xd079('0x13')](function(){_0x589498[_0xd079('0x14')]();});}}catch(_0x15112d){logger['error'](_0xd079('0x12'),_0x76224,JSON[_0xd079('0x15')](_0x15112d));_0x589498[_0xd079('0x14')]();}};};