|
|
|
|
@ -32,7 +32,7 @@ public class NotificationService {
|
|
|
|
|
String otp = otpRequest.isOtpRequired() ? otpService.generateOtp() : "123456";
|
|
|
|
|
Pin pin = new Pin();
|
|
|
|
|
final LocalDateTime createDate = LocalDateTime.now();
|
|
|
|
|
final LocalDateTime expiryDate = LocalDateTime.now().plusMinutes(5);
|
|
|
|
|
final LocalDateTime expiryDate = LocalDateTime.now().plusMinutes(1);
|
|
|
|
|
pin.setPinCreatedate(createDate);
|
|
|
|
|
pin.setPinExpirydate(expiryDate);
|
|
|
|
|
pin.setChannelCode(otpRequest.getChannelCode());
|
|
|
|
|
@ -44,7 +44,7 @@ public class NotificationService {
|
|
|
|
|
pin.setPinstatus("Unverified");
|
|
|
|
|
pin.setUserName(otpRequest.getEmail());
|
|
|
|
|
pinRepository.save(pin);
|
|
|
|
|
webClient.post().uri("/notification/otp/email").bodyValue(Map.of("email", otpRequest.getEmail(), "subject", otpRequest.getSubject(), "otp", otp, "userName", otpRequest.getUsername())).retrieve()
|
|
|
|
|
webClient.post().uri("/notification/otp/email").bodyValue(Map.of("email", otpRequest.getEmail(), "subject", otpRequest.getSubject(), "otp", otp, "userName", otpRequest.getUsername(),"phoneNumber",otpRequest.getPhone())).retrieve()
|
|
|
|
|
.onStatus(status -> status.is4xxClientError() || status.is5xxServerError(), clientResponse
|
|
|
|
|
-> Mono.error(new RuntimeException("Response has error status."))).bodyToMono(String.class).block();
|
|
|
|
|
return pin.getPinserial();
|
|
|
|
|
|