Subversion Repositories SmartDukaan

Rev

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

Rev 32402 Rev 32404
Line 1825... Line 1825...
1825
    @RequestMapping(value = "/createCombo", method = RequestMethod.GET)
1825
    @RequestMapping(value = "/createCombo", method = RequestMethod.GET)
1826
    public String createCombo(HttpServletRequest request, Model model) throws Exception {
1826
    public String createCombo(HttpServletRequest request, Model model) throws Exception {
1827
 
1827
 
1828
        Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1828
        Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1829
 
1829
 
1830
        FofoOrder fofoOrder = fofoOrderRepository.selectByOrderId(315604);
-
 
1831
        Customer customer = customerRepository.selectById(fofoOrder.getCustomerId());
-
 
1832
        CustomRetailer retailer = retailerService.getFofoRetailer(fofoOrder.getFofoId());
-
 
1833
        String message = String.format("Dear %s,\n" + "Thank you for your purchase from SmartDukaan store - %s, %s.\n" + "Your purchase invoice is attached for your reference.\n" + "\n" + "Download our app for offers and updates on new products.\n" + "https://www.smartdukaan.com/b2c\n" + "\n" + "Best Regards\n" + "SmartDukaan", customer.getFirstName(), retailer.getBusinessName(), retailer.getAddress().getCity());
-
 
1834
        notificationService.sendWhatsappMediaMessage(message, "9816068341", this.getPublicInvoiceUrl(fofoOrder.getInvoiceNumber()), this.getFileName(fofoOrder.getInvoiceNumber()));
-
 
1835
 
-
 
1836
 
1830
 
1837
        List<ComboModel> comboModels = comboModelRepository.selectAll();
1831
        List<ComboModel> comboModels = comboModelRepository.selectAll();
1838
 
1832
 
1839
        model.addAttribute("warehouseMap", warehouseMap);
1833
        model.addAttribute("warehouseMap", warehouseMap);
1840
        model.addAttribute("comboModels", comboModels);
1834
        model.addAttribute("comboModels", comboModels);
1841
        return "create-combo";
1835
        return "create-combo";
1842
    }
1836
    }
1843
 
1837
 
1844
 
-
 
1845
    private String getFileName(String invoiceNumber) {
-
 
1846
        return "INV-" + invoiceNumber.replace("/", "-") + ".pdf";
-
 
1847
    }
-
 
1848
 
-
 
1849
    private String getPublicInvoiceUrl(String invoiceNumber) {
-
 
1850
        String base64Encoded = Base64.getMimeEncoder().encodeToString(invoiceNumber.getBytes(StandardCharsets.UTF_8));
-
 
1851
        String publicUrl = "https://partners.smartdukaan.com/wa-invoice-send/" + base64Encoded + ".pdf";
-
 
1852
        return publicUrl;
-
 
1853
    }
-
 
1854
 
-
 
1855
    @RequestMapping(value = "/addCombo", method = RequestMethod.POST)
1838
    @RequestMapping(value = "/addCombo", method = RequestMethod.POST)
1856
    public String addCombo(HttpServletRequest request, @RequestBody Combo combo, Model model) throws Exception {
1839
    public String addCombo(HttpServletRequest request, @RequestBody Combo combo, Model model) throws Exception {
1857
        List<Integer> warehouseIds = new ArrayList<Integer>();
1840
        List<Integer> warehouseIds = new ArrayList<Integer>();
1858
 
1841
 
1859
 
1842