Subversion Repositories SmartDukaan

Rev

Rev 33595 | Rev 33672 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
32916 amit.gupta 1
package com.spice.profitmandi.web.controller;
2
 
33581 ranu 3
import com.spice.profitmandi.common.web.util.ResponseSender;
33595 ranu 4
import com.spice.profitmandi.dao.repository.cs.AgentRecordingRepository;
33602 ranu 5
import com.spice.profitmandi.service.integrations.kommuno.KommunoService;
32929 amit.gupta 6
import com.spice.profitmandi.service.integrations.smartping.SmartPingService;
7
import com.spice.profitmandi.service.integrations.smartping.model.CallDetailModel;
32916 amit.gupta 8
import com.spice.profitmandi.web.util.MVCResponseSender;
9
import org.apache.logging.log4j.LogManager;
10
import org.apache.logging.log4j.Logger;
11
import org.springframework.beans.factory.annotation.Autowired;
33581 ranu 12
import org.springframework.http.MediaType;
13
import org.springframework.http.ResponseEntity;
32916 amit.gupta 14
import org.springframework.stereotype.Controller;
15
import org.springframework.ui.Model;
33591 ranu 16
import org.springframework.web.bind.annotation.ModelAttribute;
32916 amit.gupta 17
import org.springframework.web.bind.annotation.RequestMapping;
18
import org.springframework.web.bind.annotation.RequestMethod;
19
 
20
import javax.servlet.http.HttpServletRequest;
21
import javax.transaction.Transactional;
22
 
23
@Controller
24
@Transactional(rollbackOn = Throwable.class)
25
public class WebHookController {
26
 
27
    @Autowired
28
    MVCResponseSender mvcResponseSender;
29
 
33581 ranu 30
    @Autowired
31
    private ResponseSender<?> responseSender;
32
 
32916 amit.gupta 33
    private static final Logger LOGGER = LogManager.getLogger(WebHookController.class);
34
 
32919 amit.gupta 35
    @Autowired
32929 amit.gupta 36
    SmartPingService smartPingService;
32916 amit.gupta 37
 
33595 ranu 38
    @Autowired
33602 ranu 39
    KommunoService kommunoService;
40
 
41
    @Autowired
33595 ranu 42
    AgentRecordingRepository agentRecordingRepository;
43
 
33590 ranu 44
    @RequestMapping(value = "/click2call/report-handler", method = RequestMethod.POST, consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
33591 ranu 45
    public ResponseEntity<?> click2callReportHandlerPost(HttpServletRequest request, Model model, @ModelAttribute CallDetailModel callDetail) throws Exception {
33581 ranu 46
        LOGGER.info("first event call detail {}", callDetail);
33602 ranu 47
        kommunoService.updateAgentRecording(callDetail);
33581 ranu 48
 
49
        return responseSender.ok(true);
32917 amit.gupta 50
    }
33581 ranu 51
 
52
 
33590 ranu 53
    @RequestMapping(value = "/click2call/report-handler/recording-url", method = RequestMethod.POST, consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
33591 ranu 54
    public ResponseEntity<?> click2callReportHandlerUpdateRecordingUrlPost(HttpServletRequest request, Model model, @ModelAttribute CallDetailModel callDetail) throws Exception {
33581 ranu 55
        LOGGER.info("update call detail {}", callDetail);
33602 ranu 56
        kommunoService.updateAgentRecordingUrl(callDetail);
33581 ranu 57
        return responseSender.ok(true);
58
    }
32916 amit.gupta 59
}