| Line 625... |
Line 625... |
| 625 |
}
|
625 |
}
|
| 626 |
|
626 |
|
| 627 |
return "response";
|
627 |
return "response";
|
| 628 |
}
|
628 |
}
|
| 629 |
|
629 |
|
| - |
|
630 |
@RequestMapping(value = "/admin/policy/certificate", method = RequestMethod.GET)
|
| - |
|
631 |
public ResponseEntity<byte[]> downloadPolicyCertificate(HttpServletRequest request,
|
| - |
|
632 |
@RequestParam String policyNumber) throws Exception {
|
| - |
|
633 |
LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
634 |
if (!roleManager.isAdmin(fofoDetails.getRoleIds())) {
|
| - |
|
635 |
return ResponseEntity.status(HttpStatus.FORBIDDEN).build();
|
| - |
|
636 |
}
|
| - |
|
637 |
|
| - |
|
638 |
String filePath = iciciLombardService.fetchPolicyCertificateByPolicyNumber(policyNumber);
|
| - |
|
639 |
byte[] pdfBytes = Files.readAllBytes(new File(filePath).toPath());
|
| - |
|
640 |
|
| - |
|
641 |
String safeName = "policy-" + policyNumber.replace("/", "-") + ".pdf";
|
| - |
|
642 |
HttpHeaders headers = new HttpHeaders();
|
| - |
|
643 |
headers.setContentType(MediaType.APPLICATION_PDF);
|
| - |
|
644 |
headers.setContentDispositionFormData("inline", safeName);
|
| - |
|
645 |
headers.setContentLength(pdfBytes.length);
|
| - |
|
646 |
return new ResponseEntity<>(pdfBytes, headers, HttpStatus.OK);
|
| - |
|
647 |
}
|
| - |
|
648 |
|
| 630 |
|
649 |
|
| 631 |
@RequestMapping(value = "/order/bad_return", method = RequestMethod.POST)
|
650 |
@RequestMapping(value = "/order/bad_return", method = RequestMethod.POST)
|
| 632 |
public ResponseEntity<?> badReturn(HttpServletRequest request, @RequestBody FoiBadReturnRequest foiBadReturnRequest,
|
651 |
public ResponseEntity<?> badReturn(HttpServletRequest request, @RequestBody FoiBadReturnRequest foiBadReturnRequest,
|
| 633 |
Model model) throws ProfitMandiBusinessException {
|
652 |
Model model) throws ProfitMandiBusinessException {
|
| 634 |
LOGGER.info("request at uri {} body {}", request.getRequestURI(), foiBadReturnRequest);
|
653 |
LOGGER.info("request at uri {} body {}", request.getRequestURI(), foiBadReturnRequest);
|