Subversion Repositories SmartDukaan

Rev

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

Rev 32710 Rev 32711
Line 599... Line 599...
599
    }
599
    }
600
 
600
 
601
    @GetMapping(value = "/wa-invoice-send/{invoiceHash}")
601
    @GetMapping(value = "/wa-invoice-send/{invoiceHash}")
602
    public ResponseEntity<?> generateInvoice(@PathVariable String invoiceHash) throws ProfitMandiBusinessException {
602
    public ResponseEntity<?> generateInvoice(@PathVariable String invoiceHash) throws ProfitMandiBusinessException {
603
        String decodedInvoiceNumber = new String(Base64.getMimeDecoder().decode(invoiceHash));
603
        String decodedInvoiceNumber = new String(Base64.getMimeDecoder().decode(invoiceHash));
-
 
604
        LOGGER.info("Invoice Hash {}", invoiceHash);
-
 
605
 
-
 
606
 
604
        FofoOrder fofoOrder = fofoOrderRepository.selectByInvoiceNumber(decodedInvoiceNumber);
607
        FofoOrder fofoOrder = fofoOrderRepository.selectByInvoiceNumber(decodedInvoiceNumber);
605
 
608
 
606
        InvoicePdfModel pdfModel = orderService.getInvoicePdfModel(fofoOrder.getId());
609
        InvoicePdfModel pdfModel = orderService.getInvoicePdfModel(fofoOrder.getId());
607
 
610
 
608
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
611
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
609
        PdfUtils.generateAndWrite(Arrays.asList(pdfModel), byteArrayOutputStream);
612
        PdfUtils.generateAndWrite(Arrays.asList(pdfModel), byteArrayOutputStream);
610
        LOGGER.info("Pdf Stream length {}", byteArrayOutputStream.toByteArray().length);
-
 
611
        final HttpHeaders headers = new HttpHeaders();
613
        final HttpHeaders headers = new HttpHeaders();
612
        //headers.setContentDispositionFormData("inline", number + ".pdf");
614
        //headers.setContentDispositionFormData("inline", number + ".pdf");
613
        headers.add(HttpHeaders.CONTENT_DISPOSITION, "inline;filename=" + pdfModel.getInvoiceNumber() + ".pdf");
615
        headers.add(HttpHeaders.CONTENT_DISPOSITION, "inline;filename=" + pdfModel.getInvoiceNumber() + ".pdf");
614
        int contentLength = byteArrayOutputStream.toByteArray().length;
616
        int contentLength = byteArrayOutputStream.toByteArray().length;
615
        final InputStream inputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
617
        final InputStream inputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());