Subversion Repositories SmartDukaan

Rev

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

Rev 34053 Rev 35963
Line 7... Line 7...
7
import com.spice.profitmandi.dao.entity.dtr.Otp;
7
import com.spice.profitmandi.dao.entity.dtr.Otp;
8
import com.spice.profitmandi.dao.entity.onBoarding.LoiForm;
8
import com.spice.profitmandi.dao.entity.onBoarding.LoiForm;
9
import com.spice.profitmandi.dao.enumuration.dtr.OtpType;
9
import com.spice.profitmandi.dao.enumuration.dtr.OtpType;
10
import com.spice.profitmandi.dao.repository.dtr.OtpRepository;
10
import com.spice.profitmandi.dao.repository.dtr.OtpRepository;
11
import com.spice.profitmandi.dao.repository.user.LoiFormRepository;
11
import com.spice.profitmandi.dao.repository.user.LoiFormRepository;
-
 
12
import com.spice.profitmandi.service.mail.MailOutboxService;
12
import org.apache.logging.log4j.LogManager;
13
import org.apache.logging.log4j.LogManager;
13
import org.apache.logging.log4j.Logger;
14
import org.apache.logging.log4j.Logger;
14
import org.springframework.beans.factory.annotation.Autowired;
15
import org.springframework.beans.factory.annotation.Autowired;
15
import org.springframework.beans.factory.annotation.Value;
16
import org.springframework.beans.factory.annotation.Value;
16
import org.springframework.mail.javamail.JavaMailSender;
17
import org.springframework.mail.javamail.JavaMailSender;
Line 49... Line 50...
49
    OtpRepository otpRepository;
50
    OtpRepository otpRepository;
50
 
51
 
51
    @Autowired
52
    @Autowired
52
    JavaMailSender mailSender;
53
    JavaMailSender mailSender;
53
    @Autowired
54
    @Autowired
-
 
55
    MailOutboxService mailOutboxService;
-
 
56
    @Autowired
54
    RestClient restClient;
57
    RestClient restClient;
55
    @Autowired
58
    @Autowired
56
    LoiFormRepository loiFormRepository;
59
    LoiFormRepository loiFormRepository;
57
    @Value("${prod}")
60
    @Value("${prod}")
58
    private boolean prodEnv;
61
    private boolean prodEnv;
Line 175... Line 178...
175
        String ownerName = pod.getFirstName();
178
        String ownerName = pod.getFirstName();
176
        String message = String.format(LOI_ACCEPTANCE_OTP_TEMPLATE, ownerName, otp);
179
        String message = String.format(LOI_ACCEPTANCE_OTP_TEMPLATE, ownerName, otp);
177
        this.sendSms(LOI_ACCEPTANCE_OTP_TEMPLATE_ID, message, otp1.getMobile());
180
        this.sendSms(LOI_ACCEPTANCE_OTP_TEMPLATE_ID, message, otp1.getMobile());
178
        String emailTo[] = {pod.getEmail()};
181
        String emailTo[] = {pod.getEmail()};
179
        try {
182
        try {
180
            Utils.sendMailWithAttachments(mailSender, emailTo, null, "LOI ACCEPTANCE OTP", message);
183
            mailOutboxService.queueMail(emailTo, null, "LOI ACCEPTANCE OTP", message, "OtpProcessor.sendOtpForLoiAcceptance");
181
        } catch (Exception e) {
184
        } catch (Exception e) {
182
            LOGGER.error("Loi OTP not send on email couse -  ", e);
185
            LOGGER.error("Loi OTP not send on email couse -  ", e);
183
        }
186
        }
184
 
187
 
185
    }
188
    }