Skip to content

Commit

Permalink
Fixed error handling in verify OTP endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
kober32 committed Nov 10, 2023
1 parent c271df0 commit 2ef85f6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ class VerificationService(
}
}
/** PowerAuth instance cannot start the activation. */
object ActivationNotActiveException: Exception("PowerAuth instance cannot start the activation.")
object ActivationNotActiveException: Exception("PowerAuth instance is not in the active state.")
/** Verification status needs to be fetched first */
object ActivationMissingStatusException: Exception("Verification status needs to be fetched first.")

Expand All @@ -564,8 +564,10 @@ class VerificationService(
override fun onActivationStatusSucceed(status: ActivationStatus?) {
if (status?.state != ActivationStatus.State_Active) {
listener?.powerAuthActivationStatusChanged(this@VerificationService, status)
markCompleted(Fail(ApiError(ActivationNotActiveException)), callback)
} else {
markCompleted(Fail(error), callback)
}
markCompleted(Fail(ApiError(ActivationNotActiveException)), callback)
}

override fun onActivationStatusFailed(t: Throwable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ internal class CustomerVerificationApi(
private val presenceCheckEndpoint = EndpointSigned<PresenceCheckRequest, PresenceCheckResponse>("api/identity/presence-check/init", "/api/identity/presence-check/init")
private val presenceCheckSubmitEndpoint = EndpointSigned<PresenceCheckSubmitRequest, StatusResponse>("api/identity/presence-check/submit", "/api/identity/presence-check/submit")
private val resendOtpEndpoint = EndpointSigned<VerificationResendOtpRequest, ResendOtpResponse>("api/identity/otp/resend", "/api/identity/otp/resend")
private val resendVerifyEndpoint = EndpointBasic<VerifyOtpRequest, VerifyOtpResponse>("api/identity/otp/verify")
private val otpVerifyEndpoint = EndpointBasic<VerifyOtpRequest, VerifyOtpResponse>("api/identity/otp/verify")
}

/**
Expand Down Expand Up @@ -277,7 +277,7 @@ internal class CustomerVerificationApi(
fun verifyOtp(processId: String, otp: String, listener: IApiCallResponseListener<VerifyOtpResponse>) {
post(
VerifyOtpRequest(processId, otp),
resendVerifyEndpoint,
otpVerifyEndpoint,
null,
powerAuthSDK.getEciesEncryptorForActivationScope(appContext),
null,
Expand Down

0 comments on commit 2ef85f6

Please sign in to comment.