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