Subversion Repositories SmartDukaan

Rev

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

Rev 33617 Rev 33867
Line 50... Line 50...
50
    @Autowired
50
    @Autowired
51
    JavaMailSender mailSender;
51
    JavaMailSender mailSender;
52
    @Autowired
52
    @Autowired
53
    RestClient restClient;
53
    RestClient restClient;
54
    @Autowired
54
    @Autowired
55
    LoiFormRepository partnerOnBoardingDataRepository;
55
    LoiFormRepository loiFormRepository;
56
    @Value("${prod}")
56
    @Value("${prod}")
57
    private boolean prodEnv;
57
    private boolean prodEnv;
58
 
58
 
59
    private String getOtp() {
59
    private String getOtp() {
60
        Random rndm_method = new Random();
60
        Random rndm_method = new Random();
Line 168... Line 168...
168
    }
168
    }
169
 
169
 
170
    //todo
170
    //todo
171
    public void sendOtpForLoiAcceptance(Otp otp1) throws Exception {
171
    public void sendOtpForLoiAcceptance(Otp otp1) throws Exception {
172
        String otp = otp1.getOtp();
172
        String otp = otp1.getOtp();
173
        LoiForm pod = partnerOnBoardingDataRepository.selectByEmailOrMobile(otp1.getMobile());
173
        LoiForm pod = loiFormRepository.selectByEmailOrMobile(otp1.getMobile());
174
        String ownerName = pod.getFirstName();
174
        String ownerName = pod.getFirstName();
175
        String message = String.format(LOI_ACCEPTANCE_OTP_TEMPLATE, ownerName, otp);
175
        String message = String.format(LOI_ACCEPTANCE_OTP_TEMPLATE, ownerName, otp);
176
        this.sendSms(LOI_ACCEPTANCE_OTP_TEMPLATE_ID, message, otp1.getMobile());
176
        this.sendSms(LOI_ACCEPTANCE_OTP_TEMPLATE_ID, message, otp1.getMobile());
177
        String emailTo[] = {pod.getEmail()};
177
        String emailTo[] = {pod.getEmail()};
-
 
178
        try {
178
        Utils.sendMailWithAttachments(mailSender, emailTo, null, "LOI ACCEPTANCE OTP", message);
179
            Utils.sendMailWithAttachments(mailSender, emailTo, null, "LOI ACCEPTANCE OTP", message);
-
 
180
        } catch (Exception e) {
-
 
181
            LOGGER.error("Loi OTP not send on email couse -  ", e);
-
 
182
        }
179
 
183
 
180
    }
184
    }
181
 
185
 
182
    public String sendSms(String dltTemplateId, String message, String mobileNumber) throws Exception {
186
    public String sendSms(String dltTemplateId, String message, String mobileNumber) throws Exception {
183
        Map<String, String> queryParams = new HashMap<>();
187
        Map<String, String> queryParams = new HashMap<>();