Skip to content

Commit

Permalink
Minor refectoring
Browse files Browse the repository at this point in the history
Signed-off-by: Loganathan Sekar <[email protected]>
  • Loading branch information
Loganathan Sekar authored and Loganathan Sekar committed Feb 7, 2024
1 parent 03d93bf commit 4a1d1db
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public boolean sendOtp(OtpRequestDTO otpRequestDTO, String idvid, String idvidTy
if(otpEntityOpt.isPresent()) {
OtpTransaction otpEntity = otpEntityOpt.get();
if(otpEntity.getStatusCode().equals(IdAuthCommonConstants.FROZEN)) {
if(checkFrozenStatusAndDuration(otpEntity)) {
if(isAfterFrozenDuration(otpEntity)) {
logger.info("OTP Frozen wait time is over. Allowing further.");
otpEntity.setValidationRetryCount(0);
otpEntity.setStatusCode(IdAuthCommonConstants.ACTIVE_STATUS);
Expand Down Expand Up @@ -198,7 +198,7 @@ public boolean validateOtp(String pinValue, String otpKey, String individualId)
OtpTransaction otpEntity = otpEntityOpt.get();

if(otpEntity.getStatusCode().equals(IdAuthCommonConstants.FROZEN)) {
if(otpEntity.getUpdDTimes() != null && checkFrozenStatusAndDuration(otpEntity)) {
if(otpEntity.getUpdDTimes() != null && isAfterFrozenDuration(otpEntity)) {
logger.info("OTP Frozen wait time is over. Allowing further.");
otpEntity.setValidationRetryCount(0);
otpEntity.setStatusCode(IdAuthCommonConstants.ACTIVE_STATUS);
Expand Down Expand Up @@ -239,7 +239,7 @@ public boolean validateOtp(String pinValue, String otpKey, String individualId)
}
}

private boolean checkFrozenStatusAndDuration(OtpTransaction otpEntity) {
private boolean isAfterFrozenDuration(OtpTransaction otpEntity) {
return DateUtils.getUTCCurrentDateTime().isAfter(otpEntity.getUpdDTimes().plus(otpFrozenTimeMinutes, ChronoUnit.MINUTES));
}

Expand Down

0 comments on commit 4a1d1db

Please sign in to comment.