Default Implementation

The capture feature is unaware of any networking implementations and it requires you to set them in the CaptureConfiguration. The networking related logic is abstracted behind the GiniCaptureNetworkService interface which is used to upload, analyze and delete documents. Find more details in the reference documentation.

We provide a default implementation of GiniCaptureNetworkService called GiniCaptureDefaultNetworkService. You can use the helper method to create it with minimal configuration and pass it to the CaptureConfiguration:

val networkService = getDefaultNetworkService( context = this, clientId = myClientId, clientSecret = myClientSecret, emailDomain = myEmailDomain, documentMetadata = myDocumentMetadata ) GiniBank.setCaptureConfiguration(context, CaptureConfiguration( networkService = networkService ) )

If you want to use only your own authentication, please implement the SessionManager interface and use the GiniCaptureDefaultNetworkService.builder() to create the default network service with a your own SessionManager implementation:

class YourSessionManager: SessionManager { override suspend fun getSession(): Resource<Session> { // Retrieve the session token from your backend val sessionToken: String = (...) val expirationDate: Date = (...) // Note: When the token expires the SDK calls this method // again to get a new token. return Resource.Success(Session(sessionToken, expirationDate)) } } val networkService = GiniCaptureDefaultNetworkService.builder(context) .setClientCredentials(clientId, clientSecret, emailDomain) .setDocumentMetadata(documentMetadata) .setSessionManager(YourSessionManager()) .build() GiniBank.setCaptureConfiguration(context, CaptureConfiguration( networkService = networkService ) )

If you want to use a transparent proxy with your own authentication, specify your own domain and also pass in your implementation of the SessionManager interface:

class YourSessionManager: SessionManager { (...) } val networkService = GiniCaptureDefaultNetworkService.builder(context) .setClientCredentials(clientId, clientSecret, emailDomain) .setDocumentMetadata(documentMetadata) .setBaseUrl("https://api.custom.net/") .setSessionManager(YourSessionManager()) .build() GiniBank.setCaptureConfiguration(context, CaptureConfiguration( networkService = networkService ) )

The token you provide is added as a bearer token to all api.custom.net requests.

You can also specify a custom path segment in the base URL if your proxy URL requires it:

For all configuration options of the default networking implementation, see the documentation of GiniCaptureDefaultNetworkService.Builder.

 

Gini GmbH | Ridlerstr. 57 | 80339 München