From 89f76bbaed79482e04eb4fff52ced329351de19b Mon Sep 17 00:00:00 2001 From: Loganathan Sekar Date: Fri, 9 Feb 2024 17:57:02 +0530 Subject: [PATCH] Minor fix to OTP generation time setting Signed-off-by: Loganathan Sekar --- .../service/integration/OTPManager.java | 32 +++++++------------ 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/integration/OTPManager.java b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/integration/OTPManager.java index 8da66c8f2cb..6494dfd8538 100644 --- a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/integration/OTPManager.java +++ b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/integration/OTPManager.java @@ -118,26 +118,18 @@ public boolean sendOtp(OtpRequestDTO otpRequestDTO, String idvid, String idvidTy + EnvUtil.getKeySplitter() + otpRequestDTO.getTransactionID() + EnvUtil.getKeySplitter() + otp).getBytes()); - OtpTransaction otpTxn; - if (otpEntityOpt.isPresent() - && (otpTxn = otpEntityOpt.get()).getStatusCode().equals(IdAuthCommonConstants.ACTIVE_STATUS)) { - otpTxn.setOtpHash(otpHash); - otpTxn.setUpdBy(securityManager.getUser()); - otpTxn.setUpdDTimes(otpGenerationTime); - otpTxn.setExpiryDtimes(otpGenerationTime.plusSeconds(EnvUtil.getOtpExpiryTime())); - otpRepo.save(otpTxn); - } else { - OtpTransaction txn = new OtpTransaction(); - txn.setId(UUID.randomUUID().toString()); - txn.setRefId(securityManager.hash(otpRequestDTO.getIndividualId())); - txn.setOtpHash(otpHash); - txn.setCrBy(securityManager.getUser()); - txn.setCrDtimes(otpGenerationTime); - txn.setExpiryDtimes(otpGenerationTime.plusSeconds( - EnvUtil.getOtpExpiryTime())); - txn.setStatusCode(IdAuthCommonConstants.ACTIVE_STATUS); - otpRepo.save(txn); - } + OtpTransaction txn = new OtpTransaction(); + txn.setId(UUID.randomUUID().toString()); + txn.setRefId(securityManager.hash(otpRequestDTO.getIndividualId())); + txn.setOtpHash(otpHash); + txn.setCrBy(securityManager.getUser()); + txn.setGeneratedDtimes(otpGenerationTime); + txn.setCrDtimes(otpGenerationTime); + txn.setExpiryDtimes(otpGenerationTime.plusSeconds( + EnvUtil.getOtpExpiryTime())); + txn.setStatusCode(IdAuthCommonConstants.ACTIVE_STATUS); + otpRepo.save(txn); + String notificationProperty = null; notificationProperty = otpRequestDTO .getOtpChannel().stream().map(channel -> NotificationType.getNotificationTypeForChannel(channel)