Built motion from commit 8356fca3.|2.6.19
[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 _0xd5c0=['routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','finally','stringify','stop','moment','../../../../config/logger'];(function(_0x14a47c,_0x3f32fd){var _0xd43546=function(_0x5656a0){while(--_0x5656a0){_0x14a47c['push'](_0x14a47c['shift']());}};_0xd43546(++_0x3f32fd);}(_0xd5c0,0x157));var _0x0d5c=function(_0x57c662,_0x2c9ffe){_0x57c662=_0x57c662-0x0;var _0x216916=_0xd5c0[_0x57c662];return _0x216916;};'use strict';var moment=require(_0x0d5c('0x0'));var logger=require(_0x0d5c('0x1'))(_0x0d5c('0x2'));var rpc={'chatInteraction':require(_0x0d5c('0x3')),'openchannelInteraction':require(_0x0d5c('0x4')),'smsInteraction':require(_0x0d5c('0x5')),'mailInteraction':require(_0x0d5c('0x6')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x0d5c('0x7'))};exports['consequence']=function(_0x283326,_0x1e9ca2,_0x45ec65,_0x1187df){return function(_0x21c384){try{logger[_0x0d5c('0x8')](_0x0d5c('0x9'),_0x283326,_0x1e9ca2[0x0]);var _0x148ab3={'closed':0x1,'closedAt':moment()[_0x0d5c('0xa')](_0x0d5c('0xb')),'closeReason':_0x0d5c('0xc'),'disposition':_0x1e9ca2[0x0]};if(rpc[_0x1187df[_0x0d5c('0xd')]+_0x0d5c('0xe')]){rpc[_0x1187df['channel']+_0x0d5c('0xe')][_0x0d5c('0xf')](_0x1187df[_0x0d5c('0x10')]['id'],_0x148ab3)['then'](function(_0x4af1cf){logger[_0x0d5c('0x8')](_0x0d5c('0x11'),_0x283326,_0x1187df[_0x0d5c('0x10')]['id']);})['catch'](function(_0x19f5bc){logger[_0x0d5c('0x12')](_0x0d5c('0x13'),_0x283326,JSON['stringify'](_0x19f5bc));})[_0x0d5c('0x14')](function(){_0x21c384['stop']();});}}catch(_0x1a8113){logger[_0x0d5c('0x12')](_0x0d5c('0x13'),_0x283326,JSON[_0x0d5c('0x15')](_0x1a8113));_0x21c384[_0x0d5c('0x16')]();}};};