Package com.inttegro
Class Client.OtpClient
java.lang.Object
com.inttegro.Client.OtpClient
- Enclosing class:
- Client
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCancels an OTP transaction (POST /otp/cancel).initialize(InitiateOtpParams params) Backwards-compatible alias for initiate().initiate(InitiateOtpParams params) Initiates an OTP transaction and delivers the code to the recipient (POST /otp/initiate).lookup(LookupOtpParams params) Retrieves an existing OTP transaction (POST /otp/lookup).verify(VerifyOtpParams params) Verifies a submitted OTP code for a given session (POST /otp/verify).
-
Constructor Details
-
OtpClient
-
-
Method Details
-
initiate
public OtpTransaction initiate(InitiateOtpParams params) throws IOException, InterruptedException, ApiException Initiates an OTP transaction and delivers the code to the recipient (POST /otp/initiate).Creates a new OTP transaction and sends the verification code via SMS or email. Returns a transaction identifier that must be used with the verify endpoint to validate the code.
- Parameters:
params- initiation parameters including recipient contact and optional settings- Returns:
- the initiated OTP transaction
- Throws:
IOException- if network communication failsInterruptedException- if the request is interruptedApiException- if invalid parameters or delivery fails
-
verify
public OtpVerification verify(VerifyOtpParams params) throws IOException, InterruptedException, ApiException Verifies a submitted OTP code for a given session (POST /otp/verify).Validates the OTP code provided by the user against the session. Returns verification status and any associated data. Failed verifications may allow retries up to a maximum attempt limit.
- Parameters:
params- verification parameters including transaction identifier and OTP code- Returns:
- the verification attempt and updated transaction
- Throws:
IOException- if network communication failsInterruptedException- if the request is interruptedApiException- if session invalid, code incorrect, or maximum attempts exceeded
-
lookup
public OtpTransaction lookup(LookupOtpParams params) throws IOException, InterruptedException, ApiException Retrieves an existing OTP transaction (POST /otp/lookup).- Parameters:
params- lookup parameters including the transaction identifier- Returns:
- the OTP transaction
- Throws:
IOExceptionInterruptedExceptionApiException
-
cancel
public OtpTransaction cancel(Map<String, Object> payload) throws IOException, InterruptedException, ApiExceptionCancels an OTP transaction (POST /otp/cancel).- Parameters:
payload- cancellation parameters including transaction_id and reason- Returns:
- map containing canceled transaction information
- Throws:
IOExceptionInterruptedExceptionApiException
-
initialize
public OtpTransaction initialize(InitiateOtpParams params) throws IOException, InterruptedException, ApiException Backwards-compatible alias for initiate().
-