Subversion Repositories SmartDukaan

Rev

Rev 32929 | Rev 33586 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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