com.sinch.sdk.domains.verification.api.v1.WebHooksService Maven / Gradle / Ivy
Show all versions of sinch-sdk-java Show documentation
package com.sinch.sdk.domains.verification.api.v1;
import com.sinch.sdk.core.exceptions.ApiMappingException;
import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationEvent;
import com.sinch.sdk.domains.verification.models.v1.webhooks.VerificationRequestEventResponse;
import java.util.Map;
/**
* Webhooks service
*
* Callback events are used to authorize and manage your verification requests and return
* verification results.
*
*
see https://developers.sinch.com/docs/verification/api-reference/verification/tag/Verification-callbacks/#tag/Verification-callbacks/paths/VerificationRequestEvent/post
*
* @since 1.1
*/
public interface WebHooksService {
/**
* The Sinch Platform can initiate callback requests to a URL you define (Callback URL) on request
* and result events. All callback requests are signed using your Application key and secret pair
* found on your dashboard. The signature is included in the Authorization header of the request
*
*
By using following function, you can ensure authentication according to received payload
* from your backend
*
* @param method The HTTP method used ot handle the callback
* @param path The path to you backend endpoint used for callback
* @param headers Received headers
* @param jsonPayload Received payload
* @return Is authentication is validated (true) or not (false)
*
see https://developers.sinch.com/docs/verification/api-reference/authentication/callback-signed-request
* @since 1.1
*/
boolean validateAuthenticationHeader(
String method, String path, Map headers, String jsonPayload);
/**
* This function can be called to deserialize received payload onto callback onto proper java
* verification event class
*
* @param jsonPayload Received payload to be deserialized
* @return The verification event instance class
* see https://developers.sinch.com/docs/verification/api-reference/verification/tag/Verification-callbacks/
* @since 1.1
*/
VerificationEvent parseEvent(String jsonPayload) throws ApiMappingException;
/**
* This function can be called to serialize a verification response to be sent as JSON
*
* @param response The response to be serialized
* @return The JSON string to be sent
*
see https://developers.sinch.com/docs/verification/api-reference/verification/tag/Verification-callbacks/
* @since 1.1
*/
String serializeResponse(VerificationRequestEventResponse response) throws ApiMappingException;
}