Subversion Repositories SmartDukaan

Rev

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

Rev 33400 Rev 33419
Line 199... Line 199...
199
        }
199
        }
200
 
200
 
201
        return "response";
201
        return "response";
202
    }
202
    }
203
 
203
 
-
 
204
    @RequestMapping(value = "/wa-send-invoice", method = RequestMethod.GET)
-
 
205
    public String sendWhatsappMessage(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.ORDER_ID) int orderId, Model model) {
-
 
206
        try {
-
 
207
            this.sendWhatsappInvoice(fofoOrderRepository.selectByOrderId(orderId));
-
 
208
        } catch (Exception e) {
-
 
209
            LOGGER.info("Could not send whatsapp message");
-
 
210
            e.printStackTrace();
-
 
211
        }
-
 
212
        model.addAttribute("response1", true);
-
 
213
        return "response";
-
 
214
    }
-
 
215
 
204
    @RequestMapping(value = "/get-order", method = RequestMethod.GET)
216
    @RequestMapping(value = "/get-order", method = RequestMethod.GET)
205
    public String getOrder(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.ORDER_ID) int orderId,
217
    public String getOrder(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.ORDER_ID) int orderId,
206
                           Model model) throws ProfitMandiBusinessException {
218
                           Model model) throws ProfitMandiBusinessException {
207
        LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
219
        LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
208
        FofoOrder fofoOrder = fofoOrderRepository.selectByFofoIdAndOrderId(fofoDetails.getFofoId(), orderId);
220
        FofoOrder fofoOrder = fofoOrderRepository.selectByFofoIdAndOrderId(fofoDetails.getFofoId(), orderId);
Line 592... Line 604...
592
                "Download our app for offers and updates on new products.\n" +
604
                "Download our app for offers and updates on new products.\n" +
593
                "https://www.smartdukaan.com/b2c\n" +
605
                "https://www.smartdukaan.com/b2c\n" +
594
                "\n" +
606
                "\n" +
595
                "Best Regards\n" +
607
                "Best Regards\n" +
596
                "SmartDukaan", customer.getFirstName(), retailer.getBusinessName(), retailer.getAddress().getCity());
608
                "SmartDukaan", customer.getFirstName(), retailer.getBusinessName(), retailer.getAddress().getCity());
597
        boolean sentMessage = notificationService.isWhatMessageSend(customer.getMobileNumber());
609
        boolean shouldSendWhatsappMessage = notificationService.shouldSendWhatsappMessage(customer.getMobileNumber());
598
        if (sentMessage) {
610
        if (shouldSendWhatsappMessage) {
599
            notificationService.sendWhatsappMediaMessage(message, customer.getMobileNumber(), this.getPublicInvoiceUrl(fofoOrder.getInvoiceNumber()),
611
            notificationService.sendWhatsappMediaMessage(message, customer.getMobileNumber(), this.getPublicInvoiceUrl(fofoOrder.getInvoiceNumber()),
600
                    this.getFileName(fofoOrder.getInvoiceNumber()), WhatsappMessageType.DOCUMENT);
612
                    this.getFileName(fofoOrder.getInvoiceNumber()), WhatsappMessageType.DOCUMENT);
601
        }
613
        }
602
    }
614
    }
603
 
615