in src/main/java/com/epam/digital/data/platform/settings/api/service/impl/ChannelVerificationServiceImpl.java [92:117]
public boolean verify(
Channel channel, String accessToken, String verificationCode, String address) {
var userId = jwtInfoProvider.getUserId(accessToken);
var id = String.format(ID_PATTERN, userId, channel.getValue());
var otpEntity = repository.findById(id);
if (otpEntity.isEmpty()) {
log.error("Verification code expired");
} else {
if (!otpEntity.get().getOtpData().getVerificationCode().equals(verificationCode)) {
log.error("Invalid verification code. Expected '{}' but received '{}'",
otpEntity.get().getOtpData().getVerificationCode(), verificationCode);
}
if (!otpEntity.get().getOtpData().getAddress().equals(address)) {
log.error("Invalid address. Expected '{}' but received '{}'",
otpEntity.get().getOtpData().getAddress(), address);
}
}
return otpEntity.isPresent()
&& otpEntity.get().getOtpData().getVerificationCode().equals(verificationCode)
&& otpEntity.get().getOtpData().getAddress().equals(address)
&& channelSpecificVerifications(channel, accessToken, address);
}