Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Page Properties
hiddentrue

Status

Status
colourGreen
titleapproved

Approver

Alpar Szotyori (Unlicensed)

We recommend using Capture Flow with Fragments instead of activities.

In order to launch the Gini Capture SDK, you need tofollow these steps:

  1. Request camera access.

  2. Configure a new instance of GiniCapture.

  3. Launch CameraActivity.

  4. Handle the extraction results.

  5. Send the final transfer summary values to Gini by calling GiniCapture.sendTransferSummary()method which will be used to improve the future extraction accuracy

  6. Clean up the SDK by calling GiniCapture.cleanup() while also providing the required extraction feedback to improve future extraction accuracy. Follow the recommendations below which will release the resources used by SDK.

Follow these recommendations:

Note
  • Provide values for all necessary fields, including those that were not extracted.

  • Provide the final data approved by the user (and not the initially extracted only).

  • Do cleanup Send transfer summary only after TAN verification.

You don’t need to implement any extra steps.

...

The diagram below shows the interaction between your app and the SDK:

Drawio
mVer2
simple0
zoom1
inComment0
pageId2982265
custContentId12124413
diagramDisplayNameUntitled Diagram-1683895745279.drawio
lbox1
contentVer25
revision25
baseUrlhttps://gini.atlassian.net/wiki
diagramNameUntitled Diagram-1683895745279.drawio
pCenter0
width860
links
tbstyle
height379.5
Info

Check out an example app to see how an integration could can look like.

The CameraActivity can return with returns one of the following result codesresults:

  • Activity.RESULT_OK

A document was analyzed and the extractions are available in the EXTRA_OUT_EXTRACTIONS result extra. It contains a Bundle with the extraction labels as keys and GiniCaptureSpecificExtraction parcelables as values.

  • Activity.RESULT_CANCELED

The user

...

canceled Gini Capture SDK.

  • CameraActivity.RESULT_ERROR

An error occurred and the details are available in the EXTRA_OUT_ERROR result extra. It contains a parseable extra of type GiniCaptureError detailing what went wrong.

  • CameraActivity.RESULT_ENTER_MANUALLY

The document analysis finished with no results or an error and the user clicked the Enter manually button on either the No Results Screen or the Error Screen.

...

To enable manual entry of payment information, let your app prompt users for manual input.

...

Learn how to launch Gini Capture SDK and how to handle the results from the example:

Code Block
languagekotlinjava
void launchGiniCapturestartGiniCaptureSDK() {
    // Make sure camera permission has been already granted at this point.

    // Check that the device fulfills the requirements.
    RequirementsReport report = GiniCaptureRequirements.checkRequirements((Context) this);

   if (!report.isFulfilled()) {
        handleUnfulfilledRequirements(report);
        return;
    }

    // Instantiate the networking implementations.
    GiniCaptureNetworkService networkService = ...

    // Configure GiniCapture and create a new singleton instance.
    GiniCapture.newInstance()
            .setGiniCaptureNetworkService(networkService)
            ...
            .build();

    // Launch the CameraActivity and wait for the result.
    Intent intent = new Intent(this, CameraActivity.class);
    startActivityForResult(intent, GINI_CAPTURE_REQUEST);
}

@Override
protected void onActivityResult(final int requestCode, final int resultCode,
        final Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == GINI_CAPTURE_REQUEST) {
        switch (resultCode) {
            case Activity.RESULT_CANCELED:
                GiniCapture.cleanup(this, "", "",
                            "", "","", Amount.EMPTY);
                break;

            case Activity.RESULT_OK:
                // Retrieve the extractions
                Bundle extractionsBundle = data.getBundleExtra(
                        CameraActivity.EXTRA_OUT_EXTRACTIONS);

                // Retrieve the extractions from the extractionsBundle
                Map<String, GiniCaptureSpecificExtraction> extractions = new HashMap<>();
                for (String extractionLabel : extractionsBundle.keySet()) {
                    GiniCaptureSpecificExtraction extraction = extractionsBundle.getParcelable(extractionLabel);
                    extractions.put(extractionLabel, extraction);
                }
                handleExtractionsshowExtractions(extractions);

                break;

            case CameraActivity.RESULT_ERROR:
                // Something went wrong, retrieve and handle the error
                final GiniCaptureError error = data.getParcelableExtra(
                        CameraActivity.EXTRA_OUT_ERROR);
                if (error != null) {
                    handleError(error);
                }
                GiniCapture.cleanup(this, "", "",);
                break;

           "", "","", Amount.EMPTY); case CameraActivity.RESULT_ENTER_MANUALLY:
                breakhandleEnterManually();
             case   CameraActivity.RESULT_ENTER_MANUALLY:GiniCapture.cleanup(this);
                handleEnterManually()break;
        }
    }
}

GiniCapture.cleanup(this, "", "",void stopGiniCaptureSDKWithTransferSummary(String paymentRecipient, 
                                           String paymentReference, 
                                           String paymentPurpose,
                                           String "", "","", Amount.EMPTY);iban,
                                           String bic,
                             break;         }     }Amount }amount
 void stopGiniCaptureSDK() {
    // After the user has seen and potentially corrected the extractions, send the final
 // cleanup the SDK// while passing in the final extraction transfer summary values to Gini   // which will be used as feedback to improve the future extraction accuracy:
    GiniCapture.cleanup((Context) this,sendTransferSummary(
            paymentRecipient,
            paymentReference,
            paymentPurpose,
            iban,
            bic,
            amount
            )
            
    // cleanup the capture SDK after sending the transfer summary
    GiniCapture.cleanup(this)
}