Invoice Capture Features¶
Features from the Gini Capture SDK¶
The capture feature uses our Gini Capture SDK. All features listed in its documentation can be used here as well.
An important difference is in how you configure the capture features. In the Gini Bank SDK you need to use the
CaptureConfiguration
instead of the Gini Capture SDK’s GiniCapture.Builder
. The configuration names are the same
so you can easily map them to the CaptureConfiguration
.
File Import (Open With)¶
Another difference is related to the file import (or “open with”) feature which allows importing of files from other apps via Android’s “open with” or “share” functionality.
To handle imported files using the Gini Bank SDK you need to register an activity result handler with the
CaptureFlowImportContract()
and then pass the incoming intent to
GiniBank.startCaptureFlowForIntent()
:
// Use the androidx's Activity Result API to register a handler for the capture result.
val captureImportLauncher = registerForActivityResult(CaptureFlowImportContract()) { result: CaptureResult ->
when (result) {
is CaptureResult.Success -> {
handleExtractions(result.specificExtractions)
}
is CaptureResult.Error -> {
when (result.value) {
is ResultError.Capture -> {
val captureError: GiniCaptureError = (result.value as ResultError.Capture).giniCaptureError
handleCaptureError(captureError)
}
is ResultError.FileImport -> {
val fileImportError = result.value as ResultError.FileImport
handleFileImportError(fileImportError)
}
}
}
CaptureResult.Empty -> {
handleNoExtractions()
}
CaptureResult.Cancel -> {
handleCancellation()
}
}
}
fun handleFileImportError(exception: ImportedFileValidationException) {
var message = ...
exception.validationError?.let { validationError ->
// Get the default message
message = getString(validationError.textResource)
// Or use custom messages
message = when (validationError) {
FileImportValidator.Error.TYPE_NOT_SUPPORTED -> ...
FileImportValidator.Error.SIZE_TOO_LARGE -> ...
FileImportValidator.Error.TOO_MANY_PDF_PAGES -> ...
FileImportValidator.Error.PASSWORD_PROTECTED_PDF -> ...
FileImportValidator.Error.TOO_MANY_DOCUMENT_PAGES -> ...
}
}
AlertDialog.Builder(this)
.setMessage(message)
.setPositiveButton("OK") { _, _ -> finish() }
.show()
}
fun startGiniBankSDKForImportedFile(importedFileIntent: Intent) {
// Configure capture first
configureCapture();
fileImportCancellationToken =
GiniBank.startCaptureFlowForIntent(captureImportLauncher, this, importedFileIntent)
}
Return Assistant¶
The return assistant feature allows your users to view and edit payable items in an invoice. The total amount is updated to be the sum of only those items which the user opts to pay.
To enable this feature simply set returnAssistantEnabled
to true
in the CaptureConfiguration
:
GiniBank.setCaptureConfiguration(
CaptureConfiguration(
returnAssistantEnabled = true,
...
)
)
The Gini Bank SDK will show the return assistant automatically if the invoice contained payable items and will update the extractions returned to your app according to the user’s changes.
The amountToPay
extraction is updated to be the sum of items the user decided to pay. It includes discounts and
additional charges that might be present on the invoice.
The extractions related to the return assistant are stored in the compoundExtractions
field of the
CaptureResult
. See the Gini Bank API’s documentation to learn about the return assistant’s compound
extractions.
Accessibility¶
The SDK conforms to the following accessibility features:
- UI is zoomable using Android’s screen magnification feature.
- TalkBack screen reader support: all non-textual UI elements (e.g., icons and images) have content descriptions.
- Touchable elements (e.g., buttons and switches) have a minimum size of 48dp x 48dp.
- Font sizes can be increased in Android’s accessibility settings.
- Default color palette has sufficient color contrast.
- Color contrast can be increased in Android’s accessibility settings.
Warning
When customizing the SDK’s UI you can override accessibility conformance by changing colors, images and injecting custom UI elements. We strongly advise you to make your customizations accessibility friendly.